Executing Workflows on Complex Relationships 1 to Many and Many to Many

Dynamics CRM Workflow can be executed and Triggered from a Primary Entity, and can include conditions and update records with N:1 relationship lookup fields on the Primary Entity. However one of the Limitations of OOTB Workflows is executing logic on complex relationship such as 1:N or N:N relationships.

This Workflow limitation can be overcome to allow workflows to execute on records with 1 to many and many to many Relationships by calling a Workflow Activity that allows you to identify the records relationships entity name.

1)     You will need to find the ‘Relationship Entity name’ for the 1 to Many or Many to Many Relationship from the Entity Customisations, in the example below I have shown how to retrieve it for the N:N relationship between Contacts and Opportunities;

2)      Now you will need to download and install the following Complex Workflow Activity Plugin Managed Solution for CRM 2016.

3)      You will need to create 2 Workflows, firstly on the Primary Entity where the Workflow will be executed based on your triggers and conditions, then Add a Step calling the MSCRM.ComplexWFActivity as show below. You will also need a child workflow on the second entity in the complex relationship that you are looking to update.

4)      Select the Relationship you want to execute the workflow and provide the Parameters as shown below;

5)      Update the Workflow Activity Parameters by adding the Reference for the Child Workflow that will be executed on the related entity in the complex relationship

6)      Provide the Entity Relationship Name String Value that you acquired in the first step.

Once you have Saved and Activated you now can run workflows on complex relationships, allowing you to update records using complex relationships. One of the main limitations of this solution is that you cannot pass actual field values from one record to another.

This Solution is based on the distributed workflow activity via https://crm2011distributewf.codeplex.com/

Download “Complex Workflow Activity for Dynamics CRM 2016” ComplexWorkflowActivity_8_1_managed.zip – Downloaded 8177 times – 8 kB


Your Name (required)

Your Email (required)

Organisation Name / Website

Dynamics Version



mm
Author: Raz Dynamics
Razwan is a Microsoft MVP and Dynamics 365 Community Moderator responsible for developing Microsoft Dynamics 365 and CRM integrated solutions for over a decade. Razwan is responsible for delivering Dynamics 365 User Groups & CRM Saturday Conferences. Raz has developed many free community utilities for Dynamics 365 and CRM which you can download from this blog.

1 Comment

Comments are closed.