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 !!