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.
I created three record for customer:
Table CustomerContracts is empty:
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:
Let’s see our Flow.
NB: We use “Microsoft Dataverse” actions for both Dataverse and Dataverse for Teams.
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:
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:
So our flow become:
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!