Tip #169: Update related records with a workflow

Ever wish you could use a workflow to update related/child records? For example, when I update the address on an account, update the address on all of the related contacts.

You can, with the help of the very helpful CRM 2011 Distribute Workflow Activity assembly written by Alberto Gemin on Codeplex.

While this says “CRM 2011” in the name, it works fine on CRM 2013 and CRM 2013 SP1.

  1. Import the solution from Codeplex
  2. Create your child entity workflow(s). In this example, create a workflow for the contact entity, check the box to run as a child workflow, uncheck the box to run on create of a record, and add your desired step.
  3. Create the master workflow that will trigger the child workflow. In this example it would be a workflow that runs on update of the address fields.
  4. Add a step. If you have successfully deployed the solution, you should see a new step called “DWF AG Utilities:Distribute One to Many.”
  5. In the step properties you need to specify two values: the database name of the 1:N relationship and the child workflow you created in step 2.
  6. Publish the workflow.

Now, every time the master workflow is executed, it will run the child workflow on each related record. This works with both background (asynchronous) and real-time (synchronous) workflow processes.

 

13 thoughts on “Tip #169: Update related records with a workflow

  1. David says:

    I came across this post searching for this capability, but I also found another blog that actually gives the code for similar functionality:

    http://markuserlandsson.wordpress.com/2013/09/05/start-mulitple-workflows-on-related/

    I’d still recommend that people go to the above Codeplex site and download the step-by-step instructions, as it pertains to the use of this code as well.

  2. Tim Beljavskis says:

    Will this work with all 1:N relationships or only parental like Contact/Acct?

  3. Brooke says:

    I was pointed to this to solve one of my problems of sending emails via workflow to contacts in a sub-grid. I have Dynamics 365. Does anyone know if this plugin will work for my version?

  4. Hi!

    Since the codeplex is shutdown, does anyone has a solution file?

  5. Nona says:

    i can’t understand what the child workflow do?

    • The child workflow runs on the related records, e.g. you can run a specified child workflow on all the contacts of a specific account. The child workflow instances will run one-by-one. What does the child workflow do is totally up to you. You can send email, modify the records, etc, etc.

  6. Bernard says:

    Hi, I have heard this functionality might be unstable when the number of related records is large (i.e. workflows might fail for a few related records). Is this also your experience?

Leave a Reply

Your email address will not be published. Required fields are marked *