What are the Advantages of Using Child Workflows in Dynamics 365

Dominic Jarvis, 12 September 2017

What are Child Workflows?

Child workflows are workflows that can be started by another workflow or dialog. They are useful for a number of reasons, but are particularly useful for abstracting logic so that it can be used in different areas, or to isolate a particular process.

To provide an example, take a workflow that manages cases by escalating them after a certain period of time. One child workflow of this may take the responsibility for reassigning the case and notifying the manager of the original owner, while another might create a list of tasks that the new owner should complete and add change the priority of the case.

Why Use a Child Workflow?

Child workflows are a good way of splitting a workflow into more modular pieces. These pieces can be used in multiple locations, but also hold the advantage of ease of modification. Taking the above example, this means that if the required logic for a particular step changes, let’s say the reassignment and notification step, a user may deactivate the child workflow and make changes to it. While the child workflow is deactivated, the master workflow will continue to run, and will wait for the child workflow to be reactivated before calling it. This means that any time the master workflow is triggered and needs to run, it will still run even if the required logic is undergoing maintenance. This is important to note, as if all logic had been contained within the master workflow, any cases that reached the requirement to be escalated within the time that the master workflow was deactivated would never be escalated by that workflow. Child workflows are, in that sense, a safeguard against any scenarios where deactivating the workflow could lead to undesired effects (automatically triggered master workflows etc.).

How to Allow a Workflow to be Run as a Child Workflow

When creating a workflow, in the process editing screen, there is a checkbox which when selected allows the workflow to be run as a child of another process.

image


Note that if additional triggers are left activated (Start when: Record is created etc.) the workflow will continue to be activated by these triggers.

How to Call a Child Workflow From Another Workflow

A child workflow can be added to another workflow like any other step. Click ‘Add Step’, then ‘Start Child Workflow.

image


This adds an editable step to your workflow which allows you to select the entity that you want the Child Workflow to run on - this may be a related record, or the record that the primary workflow is running on – and of course, specify the workflow that you want to run on this record.

image


This step acts like any other step in that it can be placed inside conditions, and other steps can be performed before or after it.

Take care when adding child workflows though, as no error message or prompt is presented if you try and add an inactive workflow. Activating the parent also does not active the child workflow. If you are intending on using the parent workflow, make sure that you activate the child workflow, or the logic will hang as described above.