In Power Automate cloud flow, we can associate/disassociate records using actions “Relate rows” and “Unrelate rows”. However, we can only associate records of two entities if they have a 1: N or N: N relationship between them.
Here we have two entities Lead and Documents but there are no relationships between them, and we have a text field named ‘Document Required’ on the Lead entity which contains the name of Document.
The need is to show the document record on Lead.
To implement this, we have created custom N: N relationships and then associated document records on Lead.
Associate records
There are the following steps to associate two records in Microsoft Dataverse using cloud flow:
Step 1: Firstly, we need to create an automated cloud flow that will trigger on creation of a Lead.
Step 2: Now we will retrieve the document name from the Lead entity and then the document record.
Step 3: Now to associate the document that we retrieved in the previous step, we will add action Relate rows.
Step 4: Select the entity to which records will be associated and enter its row ID. In my case it is Lead.
Step 5: Select the relationship between the entities. Here I’m using a custom N: N relationship.
Step 6: Then we have to give the OData ID or the full URL of the record that we want to associate.
Here I’m giving the OData ID of the Document record, which we retrieved in the previous step.
Now each time when lead is created the document record will be associated with the Lead.
Disassociate records
Similarly, we can also disassociate the already associated records.
Step 1: To disassociate records we will use the action “Unrelate rows”.
Step 2: First we will retrieve the record that is associated with the lead using the Relationship entity name.
Step 3: Now we will disassociate the retrieved record using the action “Unrelate rows”.
So that’s how we can associate and disassociate records using Power Automate.