Suppose you need to create a new globally unique identifier (GUID). In that case, Power Automate provides guid() function which generates and returns a new GUID as string. It is a useful function, but it doesn’t create a GUID based on string we provide, the way it works in C#. This post will explain how to convert a string into GUID format with dashes (with or without curly braces).
I m making this cloud flow manually triggerable for the sake of post, initializing a variable with the GUID string.
Next, I m converting this string to GUID (with dashes) using expression and storing in a variable.
Here is expression I used, for me variable name is StringGuid, please change as per your situation.
concat(substring(variables('StringGuid'),0,8),'-',substring(variables('StringGuid'),8,4),'-',substring(variables('StringGuid'),12,4),'-',substring(variables('StringGuid'),16,4),'-',substring(variables('StringGuid'),20,12),'')
Here is expression to generate GUID with curly braces
concat('{',concat(substring(variables('StringGuid'),0,8),'-',substring(variables('StringGuid'),8,4),'-',substring(variables('StringGuid'),12,4),'-',substring(variables('StringGuid'),16,4),'-',substring(variables('StringGuid'),20,12),''),'}')
Output:
I hope you found this post helpful. If you like to see this available as a feature please vote this idea.
Let’s Connect
*This post is locked for comments