Power Automate Guid Function Explained

Power Automate Guid Function

The Power Automate Guid function can be used to generate a unique identifier for any purpose.

In this article, I’ll introduce you to the guid function and will provide a step-by-step guide on how to use the function in a Microsoft flow.

Power Automate Guid Function

Create a unique identifier string, known as a GUID, in a default format of 32 digits separated by hyphens, or in a different format of your choice, for example, “a7abb88d-99h9-4156-812h-d7a2e2b138ce”.

Syntax

guid('<format>')

Input parameters

  • format (optional):: The input is a single character that represents the format of the returned GUID. The default format is “D”, but it can also be “N”, “B”, “P”, or “X”.

Return value

  • Returns a string representation of a universally unique identifier (GUID).

Power Automate Guid Expression Example

guid()
=> "63d5594d-00e3-4ea9-8dfd-e643a128477e"

See examples of all formats below:

formatguid expressionexample result
Dguid(‘D’)e1213c00-35db-4c9a-8983-4c39501716e2
Nguid(‘N’)35e36a2eeab84fd4b816494a401ac0ec
Bguid(‘B’){49e90ac9-2731-4f55-a50d-ca1af6645d4f}
Pguid(‘P’)(04c81d7e-7394-4896-9508-569d38922271)
Xguid(‘X’){0x62324e9c,0x93cc,0x4daf,{0xa3,0xc3,0x85,0x6f,0x4c,0xa9,0xfe,0x01}}
guid formats

How To Use The Power Automate Guid Function

Follow the steps to use the Power Automate Guid function in a flow.

  1. Create a new flow with trigger ‘Manually trigger a flow’

    Power Automate Guid Function new flow

    New flow

  2. Add a new step by clicking on ‘+ New step’

    Power Automate Guid Function new step

    Add a new step

  3. Search for ‘initialize’ and click on ‘Initialize variable’

    Power Automate Guid Function initialize variable

    Add Initialize variable action

  4. Setup Initialize variable: 1) Provide a name ‘guids’ for example, 2) select type Array

    Power Automate Guid Function initialize variable setup

    Setup array variable guids

  5. Add a new initialize variable step and 1) set name to ‘formats’, 2) set type to Array 3) set value to ‘[“D”, “N”, “B”, “P”, “X”]’

    Power Automate Guid Function initialize variable formats

    Setup variable formats

  6. Add a new step by searching for ‘apply to each’ and clicking on ‘Apply to each’

    Power Automate Guid Function add apply to each

    Add an Apply to each step

  7. Setup ‘Apply to each’ by clicking into the text field, popup opens, click on formats in the popup

    Power Automate Guid Function setup apply to each

    Setup Apply to each

  8. Add a step within Apply to each by clicking on ‘Add an action’

    Power Automate Guid Function apply to each add steo

    Add an action in Apply to each

  9. Search for ‘append to array’ and click on ‘Append to array variable’

    Power Automate Guid Function add append to array variable

    Add an Append to array variable action

  10. Setup Append to array variable 1) select Name ‘guids’ and 2) click into Value text field (popup appears) 3) click on Expression, 4) set expression to ‘guid(item())’ 5) Click on ‘Update’

    Power Automate Guid Function setup append to array variable

    Setup Append to array variable

  11. Save and do a test run

    Power Automate Guid Function result test run

    Result test run – Power Automate Guid function example

Leave a Comment

Your email address will not be published. Required fields are marked *