“How do I ensure that the ids are unique? Can I create a reliably unique identifier in Power Automate that’ll never repeat?”
There’re some situations when you’ll need a unique identifier. If you’re working with SharePoint lists you can just use the item id, but what if there’s no id by default? If you need to connect multiple MS Forms, or create multiple Planner checklist items? In these situations it’s up to you to create some form of an id, and this post will show you two approaches.
Get a random number
The first solution is to create a random number. This approach is less reliable, but it’s easier for the users as it’s a single number. You can use the Power Automate expression rand(…) with two parameters to get it.
rand(<from number (included)>, <to number (not included)>)
The outcome will be a random number between the two numbers, e.g.
rand(0,3) => 0 or 1 or 2
If you enter the second number big enough, e.g. 1000000, you can still get quite a unique number.
Get a guid
The other option, more reliable, but also much harder for users to work with, is a guid. This time it’s not a number, it’s a combination of 32 characters and number with 4 hyphens, e.g.
Power Automate has an expression guid() with no parameters that’ll create such guid for you.
You’ve got two options how to create a unique identifier within Power Automate flow. The first one is to create a random number, which is better if it’s some identifier that the users have to work with. It’s a bit less reliable, but it’s easier to read and remember.
The second one is a proper guid. An identifier that’ll be unique in the whole universe, but as a downside you can’t ask users to remember or use it. That’s why I use guid only when it’s hidden somewhere on the background, not visible to the eyes of the users.