Update a Dataverse Lookup Column Using Power Automate
Lookup Columns in Dataverse
When creating or modifying records in Dataverse with power Automate, a frequent challenge is formatting lookup columns correctly. Since a lookup column refers to a record in a related table, the format is slightly different to that you’d apply to other columns.
Lookup columns are relationships that link one table to another. Typically, they assign a child record to a parent record in a many to one relationship. Unlike regular fields, they store GUIDs (unique identifiers) rather than text or numerical values.
Step-by-Step Guide to Updating a Lookup Column
In this example we’ll update an existing record in Dataverse. The process is very similar when creating a new record.
1. Identify the Target Table of the Lookup Column & Record GUID
You require two items of data.
The first item is the set name of the table to which the lookup column points to. If you are not sure which table that is, you can find it by viewing the lookup column in Dataverse.
Now you know the name of the table, you can find it’s set name. View the table in Dataverse, down click on Tools and copy the set name.
2. Use the Required Format
When assigning a lookup value, Power Automate requires a specific format:
/<set_name>(GUID)
For example, if you need to set the “Primary Contact” lookup on an Account record to a specific Contact with the GUID 7fd19e3b-bf2d-ec11-b6e6-0022481a97f6, your format should be of the form:
/contacts(7fd19e3b-bf2d-ec11-b6e6-0022481a97f6)
Note the plural name must be changed to lower case
3. Configure Power Automate to Update the Record Using the Dataverse ‘Update a Row’ Action
Add a new Dataverse action: “Update a row.”
Select the table you want to update (e.g., “Accounts”).
Enter the Row ID (GUID) of the record you want to update. Typically you would do this by referencing a previous step in the flow
Set the lookup value using the required format (/<table_plural_name>(GUID)).
Save and test your flow.
4. Using Expressions for Dynamic GUIDs
Rather than being hard-coded, the GUID is typically retrieved dynamically from a previous step, as in the case below
This ensures that your lookup reference dynamically picks up the correct record.
Final Thought
Updating lookup fields in Dataverse might seem tricky at first, but once you understand the formatting and retrieval process, it becomes much simpler. By following the right structure and using dynamic expressions, you can ensure your flows work efficiently and accurately.