As Dynamics 365 CRM’s native feature, we can call on-demand workflows from inside a business process flow. We can configure this from the new business process flow designer, by dragging a workflow component to a process stage, or to the Global Workflows section.
As you know, we have written a blog on global workflow where we can find its basic information. In this blog, we are continuing this by exploring global workflow with detailed steps.
An on-demand workflow from inside a business process flow executes as usual on Stage Exit of a stage but it does not work, if we call on-demand workflow from on stage exit of a last stage of business process flow.
When we include a workflow that we want to trigger on Stage Exit of a stage in business process flow, and that stage is the last stage in the flow, the designer gives the impression that the workflow will be triggered when that stage is completed. However, the workflow will not be triggered because a stage transition does not take place when BPF is finishing from last stage and not moving to previous stage. We will not receive a warning or error preventing us from including the workflow on that stage. When a user interacts with the business process flow, finishing or abandoning the process does not result in a stage transition, and therefore, the workflow is not triggered.
Consider the following examples:
- We create a business process flow with two stages, “Identify” connects to “Research,” with a workflow on stage “Research,” and set the trigger to Stage Exit.
- We create a business process flow with three stages, “Identify” connects to “Research,” then “Research” branches to “Resolve.” We include a workflow on “Research” and set the trigger to Stage Exit. When condition does not match, then stage does not move to “Resolve.”
The workflow will not trigger in either case.
As shown in below screen shot, on demand workflow on stage “Research,” does not trigger on stage exit, when we click Finish button. My on demand workflow sets the value of Remark field on stage exit of “Research” stage.
To work around this issue, we have added a Global Workflow, and added the workflow which we want to trigger to it so that the workflow is triggered for the business process rather than a stage of the process.
After updating the BPF, as shown in above image, reload the form and click “Finish” button on BPF, and last stage is “Research.” Now workflow triggered as expected.
Also, we can set the trigger for a Global workflow to Process Abandoned or Process Completed to cause the workflow to trigger when a user abandons or completes the business process.
An on-demand workflow from inside a business process flow executes as usual on Stage Exit of a stage. However, it does not work if we call on-demand workflow from stage exit of a last stage of business process flow and finish the business process. For this we need to set the trigger for the Global workflow to Process Completed to cause the workflow to trigger when a user completes the business process.
Cut short 90% of your manual work and repetitive data entry!
Get 1 Click apps and say goodbye to all repetitive data entry in CRM –
Click2Clone – Clone/Copy Dynamics 365 CRM records in 1 Click
Click2Export – Export Dynamics 365 CRM Report/CRM Views/Word/Excel template in 1 Click
Click2Undo – Undo & Restore Dynamics 365 CRM data in 1 Click
Not sure if I missed something but how do you trigger the workflow in the second example? Surely you can’t use the same steps and use the “process completed” route in order to trigger it?
Good article !!
I have a BPF with a Global Workflow that is supposed to fire upon completion of the process. However, when a user clicks “finish” the workflow doesn’t fire.
My BPF is on a custom activity entity, and the ending workflow is supposed to complete the activity. But it never runs.
Are there limitations on the workflow that would cause mine not to fire?
There is no such limitation on call of BPF global workflow. We are not sure about what you missed but make sure to check the below things:
1. Set the correct workflow in BPF global workflow that you want to trigger.
2. In BPF, Set Workflow Trigger as ‘Process Completed’, as you want to trigger the workflow on click of ‘Finish’ button.
3. If you are trying to trigger real-time workflow on finish button, then convert this workflow into Background workflow and see if there are any errors occurring on its trigger in the workflow process session.
Hope this helps.
I am having the exact same issue, as are a number of users. I have tried both background and real time workflows but the workflow is never started.
There is no such limitation/issue on call of BPF global workflow for a number of users.
At our end, we are able to call a workflow on state exit with no issue. Make sure to check the below points:
1. Activate the workflow that you want to trigger.
2. Set the correct workflow in BPF global workflow that you want to trigger.
3. In BPF, Set workflow trigger as ‘Process Completed’, as you want to trigger the workflow on click of ‘Finish’ button.
4. Check the scope of the workflow whether it is applicable to run for all users in crm.
Hope this helps!
Exact problem I had. Thanks for the solution