Power Automate Convert a String to GUID

Yawer IqbalDyn365CE4 years ago15 Views

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),'')

Same way to convert this string to a formated GUID with curly braces I m using this expression with a variable.

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.

CodeProject

Let’s Connect

 twIcon lnIcon fbicon

Original Post https://yaweriqbal.com/2021/01/26/power-automate-convert-a-string-to-guid/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
March 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31       
« Feb   Apr »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...