In this blog, we’ll see how we can retrieve N:N records using Microsoft Flow. Below are the steps:
Go to https://flow.microsoft.com and login. After successful login select CDS connector.
For demo purpose, let’s select “When record is updated” as the trigger point.
Select Organisation, Entity Name and Scope as shown and click New Step.
Search for list record and select List Records from the result
Select required Organisation. For entity name click on the down arrow and scroll down to the end to select “Enter custom value” as shown.
To get the entity name for N:N relationship, go to the following URL and search for the N:N relationship schema name: https:// [OrganisationName] .api.crm [Version] .dynamics.com/api/data/v9.0/.
We can see that, the entity name is in the format <N:N relationship name>set. If we use only relationship name as the entity name then we’ll get the error “Table with name ‘relationship name’ does not exist” while executing the flow.
After putting the entity name that we got from the above URL, apply any additional filter if required. In this case, we are trying to get the related records of a particular revenue schedule line record.
Once done, execute the flow to get the result in JSON format as shown below. In our case we got only 1 record based on the filter criteria we had provided.
NOTE: There might be some more action that you need to perform based on the requirement after retrieving the records e.g. updating a field in the related records. In our case, we wanted to update each related record that we got in the result which will be covered in the next blog.
Hope it helps !!
5 thoughts on “Microsoft Flow: Retrieve N:N records in D365”
That’s really helpful, any idea how to associate records to another records ? for example , Account has two records associated with N:N , when we create it’s child record these records must also be associated with the child contact.
Thanks in advance
Thanks Deepak. For associating records, you can use “Relate Records” action under CDS(current environment) connector.
I got som problems when im trying to filter the relation when Im listing record like you did above (Dxc_revenuescheduelineid eq )
Is it the primary key for the entity that you are using?
When im trying to filter my list records i got this message (Could not find a property named “serviceid” )
Hi Richard, can you please try using csv_serviceid eq “guid”? Yes it’s the primary key of the entity.