In previous versions of Microsoft Dynamics, creating a synchronous workflow was not possible. The only option was to queue the workflow for execution at a later date/time. With CRM 2013 came synchronous workflows, which allow you to run a workflow within the current transaction.
Before, you had to either create a technical process using custom OData calls and java script, or trigger a workflow then close the record and reopen or refresh it. But now with real-time workflows, you can very easily build processes that trigger actions in “real-time,” all within the familiar workflow builder for Dynamics CRM.
Creating a Synchronous Workflow
- Go to Settings > Processes
- While creating your Process, uncheck the box for Run this workflow in the background (recommended)
- Click OK
- Or while in the workflow editor, click Convert to a background workflow on the ribbon
- You’ll notice there are some new options to configure. Depending on when and how you want the workflow to trigger, you can set the scope and the start preferences.
Let’s take a look at what/how a synchronous workflow works.
- The real-time workflow can execute before, after, or during the core operation
- Synchronous workflows can be ranked just like you can do with plug-ins
- Runs immediately
- Can run in the security context of the current user or owner of the workflow
- Executes in the current transaction. All activities in the workflow and any child workflows, including asynchronous workflows, are part of a single transaction
Exporting/Importing Synchronous Workflows
You can package and deploy these real-time/synchronous workflows via solution files similar to the way you packaged CRM 2011 workflows.
Security and Synchronous Workflow
There is a new security role privilege called “Activate Real-time Processes” which is required to activate synchronous workflows. The original “Execute Workflow Job” is still used for both asynchronous and synchronous workflows.
Converting Existing Processes
It’s easy to convert an existing workflow that runs as a background process to a synchronous process. Just use the Convert button on the top of the workflow editor.
Using Synchronous Workflows to Display a Message to Users
- Follow the steps above for creating a synchronous workflow
- In your Stop Workflow step, click Set Properties
- In the Value field, enter the text/message you would like to display to Users
- This is how the message will appear to Users when the conditions are met. Users cannot continue the process in CRM until they make the change.