dataverse-lookup-featured
CategoriesDataverseDataverse for TeamsPower Platform

Dataverse – Create Item with Lookup field in Power Automate

Dataverse is a secure platform used for managing and storing data used by business applications. If you’re using Dataverse (or Dataverse for Teams 🙂 ) and your’re trying to creare (or update) row with lookup field, you may can find useful this article.

Initial situation

We have two tables:

  • Customers
  • CustomerContacts

In our table “CustomerContacts” we have two field: Name and Customer, wich is Lookup Column who refers to Customer table.

Tables

I created three record for customer:

Customer table

Table CustomerContracts is empty:

Customer Contacts

Create new customer contact

Let’s assume we need to create through Power Automate (eg for an import from Excel File) our Customer Contacts. How should we do that?

Our Excel File:

Excel File

Let’s see our Flow.

NB: We use “Microsoft Dataverse” actions for both Dataverse and Dataverse for Teams.

Flow with error

This flow don’t need to much explications. We get our Excel File and for each row, we use “Add new row” action to create row. But it doesn’t work. We got this error:

URL was not parsed due to an ODataUnrecognizedPathException. Resource not found for the segment provided in the URL.

We can’t create row using text field (from Excel) in Lookup field.

How can we set Lookup field value?

We need logical name of table and RowId of record we want to refer:

Find internal name of table

Now we can update our flow to use this costruct using Row ID:

cr3e4_customers([ROW_ID])

Or @odata.id directly:

 @odata.id

To get row id, we need get correct items to refer. To do that, we should get logical name of field, before:

Get logical name field.

So our flow become:

Correct flow

In Customer field i wrote:

first(body('List_rows')?['value'])?['@odata.id']

To get first row form “List row actions” (filtered by customer name) and use @data.id value.

Considerations

I hope these information can help you!

Contact me for questions! Have a nice day!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

My Agile Privacy
This website uses technical and profiling cookies. Clicking on "Accept" authorizes all profiling cookies. Clicking on "Refuse" or the "X" will refuse all profiling cookies. By clicking on "Customize" you can select which profiling cookies to activate.
Warning: some page functionalities could not work due to your privacy choices: