How to Convert String to GUID in Power Automate?

Assume you need to generate a new globally unique identifier (GUID). In that instance, Power Automate offers the guid(), which generates and returns a new GUID as a string. It is a handy function, however, it does not generate a GUID based on the string we provide.

So, this Power Automate tutorial will explain how to convert a string into a GUID format with dashes (with or without curly braces), unlike the guid() in Power Automate, which generates and returns a new unique identifier.

For example, I will create an Instant cloud flow, and that will trigger manually. Then, it will convert the string to a guid with curly or without curly braces.

Microsoft power automate flow convert string to guid

How to convert String to guid in Power Automate

Here, we will see how to convert string to guid using Power Automate.

To create the guid from string using Power Automate, follow the below steps:

Step 1: Open Power Automate Cloud, then click on the +Create icon -> select Instant Cloud flow.

How to convert string to guid using Microsoft power automate flow

Next, provide the flow name and then select Manually trigger a flow action and click on Create.

How to convert string to guid using power automate flow

You can see “Manually trigger” a flow action is added to the Power Automate Canvas.

power automate convert string to guid

Step 2: Now will initialize a string variable and assign a string to it; for this, click on the +New step -> select Initialize variable action. Then provide the below information:

  • Name: Provide the variable name
  • Type: Provide the type as a string
  • Value: Provide the value as below:
power automate convert string to guid

Step 3: Now we will convert the string to guid(), and then click on the +new step -> select Compose action. Then provide the below information:

  • Inputs: Without curly braces
concat(substring(variables('guidString'),0,8),'-',substring(variables('guidString'),8,4),'-',substring(variables('guidString'),12,4),'-',substring(variables('guidString'),16,4),'-',substring(variables('guidString'),20,12),'')

With curly braces

concat('{',concat(substring(variables('guidString'),0,8),'-',substring(variables('guidString'),8,4),'-',substring(variables('guidString'),12,4),'-',substring(variables('guidString'),16,4),'-',substring(variables('guidString'),20,12),''),'}')
power automate flow convert string to guid

Step 4: Now run the flow manually, and you can see the results; the guid is created from string with or without braces.

How to convert string to guid using power automate

This is how to convert a string to a guid format using Power Automate.

See also  Parsing odata select and expand failed: an identifier was expected at position 0.

Conclusion

In this Power Automate tutorial, we saw how to convert a string to a guid format using Power Automate.

You may also like:

>