Associate/Dissociate Record using Power Automate
Note: For latest dynamic CRM interview question please click Here.
Scenario: I have entity A and entity B. entity A and B is having 1: N relationship and entity B is the sub grid of entity A . Once you open Entity B record then unique id field of Entity A as the lookup of entity B is present in Entity A (Means if 1:N relationship between A and B then lookup will be in entity B). Now there is another entity called entity C. There is relationship between C and B is N:N means one of the record of B entity may be related to the multiple record of C entity. Once you open the C record in C from you will find the subgrid of B entity and once you open B entity record you will find subgrid of C entity.
Screenshot For you reference:
Once i open any B record see the screenshot :Now each record of B Entity might contain multiple record of C entity if you remove one B record if it is associate with multiple of C record it will also remove from multiple of C record.Now we have question on which we are going to create power automate :
If we remove B record from A entity then it will also be deleted from associate c record so for this we have written one power automate.
Observation : While remove the B record from Entity A then lookup is present in B get null.
Step 1: So on change of filed "refrenceofA".
Step 2: Now we will check the condition on field "refreceofA" is null or not if it is null we do operation.we pass null as a function expression.Step 3: Fetch the list of entity A and we pass table name as a relationship name and add the suffix as "set" and select the require column with filter with Entity B id which is passed as a dynamic.
Now each record of entity B may contain multiple record of entity C. so now we will perform for each operation on each record of inspection entity. We are performing foreach loop on inspection value. and table name given as B and Row ID pass as entity C id.
Now if record of B is related to the record of C the we will perform unrelated operation see the below image. Table name as entity B and row id is entity B id and relationship name is in between Entity B and Entity C and unrelated with is taken from the get a row by ID.
Now record is dissociate after that whatever you want you can do based on your requirement.
Comments
Post a Comment