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