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.
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.
Next, provide the flow name and then select Manually trigger a flow action and click on Create.
You can see “Manually trigger” a flow action is added to the Power Automate Canvas.
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:
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),''),'}')
Step 4: Now run the flow manually, and you can see the results; the guid is created from string with or without braces.
This is how to convert a string to a guid format using Power Automate.
Conclusion
In this Power Automate tutorial, we saw how to convert a string to a guid format using Power Automate.
You may also like:
- How to Get File Content using Path in Power Automate
- Populate a Word Template using Power Automate
- How to do Error Handling in Power Automate?
- Format Number as Currency in Power Automate
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.