Did you know you can easily start workflows on child records of your current entity without any custom development in Dynamics CRM?
A typical scenario in which you would want this functionality is updating the address of your child contacts when the address of your account is updated. The image above shows this functionality.
Very often a CRM Consultant implements this sort of desired functionality by creating a plugin that retrieves and updates the related child contacts.
However there a few disadvantages to that approach:
- Plugins require the intervention of a developer.
- Mapping is hard-coded in plugins and cannot be modified.
- Can have an impact on performance if the plugin is registered synchronously.
Luckily there is an alternative solution that does not require you to write any custom code or hire a developer to perform the task.
At codeplex there is a solution called ‘CRM 2011 Distribute WF‘ that allows you to run workflows on child records.
Don’t let the name fool you, the solution supports all versions from Dynamic CRM 2011 up to the latest version of Dynamics CRM 365.
So how do I start workflows on child records?
It’s easy, I’ll guide you through the process for the example described above.
First download the (managed) solution that targets your version of Dynamics CRM and import it in your system.
Next fire up you’re CRM. You’ll have to create two workflows.
Click on any image below to view the image in full size.
- Workflow on the parent entity. In our example it is a workflow on account that will trigger the workflow on the child entity.
- Workflow on the child entity. In our case it’s a workflow on the contact entity.
The child workflow: contact
The child workflow is actually a ‘simple’ workflow that operates directly on the child records and contains the business logic you wish to implement. In our case the workflow looks as follows:
The parent workflow: account
The parent workflow contains the actual magic. Create the workflow on account and set it to trigger on field change of the address fields.
After creating the workflow add a new step AG Utilities > Distribute One to Many.
Now click Properties and fill out the following two fields:
- Distributed workflow: specify the child workflow to trigger.
- Relationship name: specify the name of the relationship between the two records. You can find this in the Customizations section of CRM.
You nailed it! Finish by saving and activating the workflow and watch the magic happen!
Question, can we generate multiple documents base on a subgrid of an entity ? Thank you!
[…] tons of examples out there. I even blogged about a No-Code solution in Dynamics CRM back in 2017. For this mini-tutorial I will be using Flow to copy the website field from an account […]
Hi Nathan, The child work flow image isn't opening, so i am not able to see the settings done there. i have this requirement and would like to know if your logic will work good here. I have two entities, first one is out of box contact entity and the next one is a custom entity called as "contact transactions". contact has a 1 to many relationship with contact transactions. My requirement is whenever a contact is activated or deactivated, its related transactional records should automatically get activated/deactivated. PS: I am typing in lower case but it shows up in upper case Thanks, Shyam
Hi Shyam, Of course, this would be the perfect scenario for the DistributeWF solution. You would trigger the primary workflow on the state change of contact and use the Distribute WF to deactivate / activate the child records.
hI nATHAN, THE CHILD WORK FLOW IMAGE ISN'T OPENING, SO I AM NOT ABLE TO SEE THE SETTINGS DONE THERE. i HAVE THIS REQUIREMENT AND WOULD LIKE TO KNOW IF YOUR LOGIC WILL WORK GOOD HERE. I HAVE TWO ENTITIES, FIRST ONE IS OUT OF BOX CONTACT ENTITY AND THE NEXT ONE IS A CUSTOM ENTITY CALLED AS "CONTACT TRANSACTIONS". CONTACT HAS A 1 TO MANY RELATIONSHIP WITH CONTACT TRANSACTIONS. MY REQUIREMENT IS WHENEVER A CONTACT IS ACTIVATED OR DEACTIVATED, ITS RELATED TRANSACTIONAL RECORDS SHOULD AUTOMATICALLY GET ACTIVATED/DEACTIVATED. THANKS, SHYAM