Power Automate: Update A Lookup Column In Dataverse

Power Automate: Update A Lookup Column In Dataverse

The Power Automate syntax to update a lookup column in Dataverse is difficult to memorize so I have written a quick-guide on how to do it. It requires you to know the entity set name of the lookup table and the unique identifier of the lookup record. Then you can use some special syntax to create the lookup column reference.


Table of Contents
• Introduction: Update The Primary Contact Of An AccountIdentify The Lookup Column And Lookup Value In DataverseGet The Entity Set Name Of The Lookup TableUpdate A Dataverse Lookup Column In Power AutomateRun The Power Automate Flow To Update A Lookup Column




Introduction: Update The Primary Contact Of An Account

The Dataverse Accounts table has a lookup column to the Contacts table named Primary Contact. A Power Automate flow is used to update the Dataverse lookup column with a Contact record.



Once the flow runs a Contact appears in the Accounts table.




Identify The Lookup Column And Lookup Value In Dataverse

To build the flow, we need to select an Account to update with a new Primary Contact and a Contact record to populate the field. We will use the A Datum Corporation included in the Accounts table sample data.



The A. Datum Corporation’s Primary Contact will be updated with the Contact Rene Valdes.




Get The Entity Set Name Of The Lookup Table

The syntax to populate a lookup column in Power Automate requires us to know the set name of the table. To get this open the Contact table, go to the Tools menu and select Copy set name.



To view the entity set name open Windows Notepad and press CTRL+V to paste. The entity set name of the Contact table is contacts.




Update A Dataverse Lookup Column In Power Automate

We are ready to build our Power Automate flow. Create a new flow with an instant trigger in Power Automate. Add a Dataverse – Update A Row action, select the Accounts table and input the unique identifier for the A. Datum Corporation in the Row Id field.



Populate the Primary Contact field with this code. The unique identifier for the Contact Rene Valdes should be used here.

/contacts(e4f24fe7-c768-eb11-b0b0-000d3ae8e48a)




Run The Power Automate Flow To Update A Lookup Column

The flow is now completed. Test the flow to make sure it works.



The Dataverse Account record for A. Datum Corporation now has Rene Valdes as the Primary Contact.





Questions?

If you have any questions or feedback about Power Automate: Update A Lookup Column In Dataverse please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Matthew Devaney

Subscribe
Notify of
guest

7 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Yuri
Yuri
2 days ago

Hi Matthew! Do you know if it is possible update Users Table? Specially Business Unit Column?

Roland
Roland
2 days ago

To easily get the “logicalcollectionname” for a table I’m not sure about, I usually add a Get a row by ID action, set the table and then look at the action’s code, as it’s right there.
I didn’t know about the api call to get all tables’ data though, so thanks for that 🙂

Jon Russell
Jon Russell
2 days ago

Hey. To get the entity set name you can click on the Tools link on the Dataverse table and click “copy set name”.

IMG_0720.jpeg
MKK
MKK
1 day ago

Thanks for this post! A challenge I’ve had with updating a lookup column using Power Automate is the use case of clearing a lookup column/setting it to blank/null.

The internets tell me it’s possible, but I’ve been unable to accomplish this with expressions directly through the Update a Row and the HTTP Request actions trying out a variety of syntax options like null, blank, empty, etc.

Is there an expression or other strategy that can be used to set a value if one exists, else set the column to null?