Applies to: Dynamics 365
For the Fall 2016 release of Dynamics 365, we made big changes to the business process flow infrastructure. A business process flow definition is now represented as an entity and an instance of a process is stored as a record within that entity. Each record is associated with a data record (like an Account, Contact, Lead, Opportunity etc.) and, in the case of cross-entity processes, with one data record for each participating entity.
This new architecture provides fine-grained control of access permissions per operation and per security role, and exposure of process data to the charting and reporting infrastructure. Another big benefit is that processes can be manipulated internally by workflows and externally by other services through the OData interface. This blog explored the process automation scenarios available from the workflow infrastructure.
Process composition – Calling workflows on demand
You can now call on-demand workflows from inside a business process flow. You 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:
- On-demand stage processes can be triggered on entry or on exit of the stage. The workflow must have the same primary entity as the stage.
- On-demand global processes can be triggered either on process activation or process archival (status transition to Finished or Abandoned). The workflow must have the same primary entity as the process.
You can create a workflow whose primary entity is a process entity. Workflows can be triggered by a number events, such as record Create, Update, and Delete, which are configurable from the Workflow editor. In the case of process entities, the events correspond to the following:
- Applying a process to a data record is a Create action.
- Stage transition (navigating from stage A to B) is an Update action to the Active Stage
- Status transition (Active to Abandoned or Finished, Abandoned to Active and Finished to Active) is an Update action to the Status Reason
Other events are also fired by the system, but they are not very common for process entities, such as process instance delete. Instead of deleting a process instance, users would typically archive (abandon or finish) the process. Administrators or users with elevated permissions can choose to delete process instances to clean up the system, but since processes are not yet available on grids for access from the sitemap, that would have to be a workflow or web-service-driven action. But workflows can be associated with the event.
One new very powerful feature introduced in the Fall 2016 release is the ability to monitor changes to the attributes of the second level related records in addition to those of the primary record’s entity. In this release, this feature is only available for business process entities, but is particularly useful because you may want to automate a process stage transition when an attribute of one of the participating data entities changes—for example, when an Opportunity is marked as Lost, automatically abandon the process. Because this can become an expensive operation depending on how many relationships a record has, this feature can only be used with background (asynchronous) workflows.
To select the attributes to monitor, first select the entity in the dropdown, and them mark the attribute of interest.
Process manipulation and condition checking
As the workflow executes, all the actions available to regular data entities are also available to process entities. This means you can create a workflow that creates new records, updates the participating records, deletes records, sends emails, executes any of the out-of-box* or registered workflow actions, or updates the process itself.
- To apply a process, create a new process record. Using the SetProcess workflow action is an equivalent operation.
- To check the current stage or to transition to a new stage, read or update the Active Stage
- To check the current status (Active, Abandoned, or Finished) or to transition to a different status, read or update the Status Reason
- To check the date/time the process was applied or the date/time the process entered the current stage, read the Created On (createdon) and Active Stage Started On (activestagestartedon) fields, respectively.
* For the Fall 2016 release, we made new out-of-box workflow actions available. They each have a corresponding web service message that was already available previously on Dynamics 365:
For more information on business process automation, see:
- Help & Training: Create a business process flow
- TechNet: Model business process flows
- TechNet: Write scripts for business process flows
Carlos Mendonça | LinkedIn
Dynamics 365 team