You may face issue while deactivating workflows with error “Should be exactly 1 MessageProcessingStep registered for workflow”. This issue comes when you have multiple active copies of workflow/process (type = “Activation”). To better understand this issue and how to solve this, you need to understand how Dynamics 365 store information when you create, activate or deactivate a workflow.
When we create workflow, a record gets created for Process entity with category = Workflow and type = Definition. There are 2 other Process types: Template, Activation.
- Template type refers to simple workflow template.
- Activation type refers to active version of workflow you created
By default when you select Process entity in Advanced find, Dynamics 365 automatically add filters to display only actual workflows you have created but behind the scenes more Process records gets created as you activate/deactivate workflow.
Let’s see what exactly happens when you create, activate or deactivate a workflow:
- When you create new workflow and its in draft mode. You will see one Process record gets created in Advanced find with Status as Draft (remove all filters and apply filter on Process Name, add all columns in view)
- Once activated, record status will be changed to Activated and one more Process record will be created with Business Process Type as “Business Flow” and type as “Activation” in Activated state. This new Process record is used by Dynamics 365 to trigger events defined in workflow.
- When deactivated, both Process records (definition and activation) will be deactivated and once you activate workflow again, new Process record with type as “Activation” will be created but only the most recent one will be activated. Note – Dynamics 365 creates multiple copies to keep track of changes.
This behavior repeats whenever you activate/deactivate workflows and sometimes due to environment issues or bug you end up with multiple copies of “Activation” type records in Activated state. In this case when you try to deactivate workflow, you will receive an error saying “Should be exactly 1 MessageProcessingStep registered for workflow”.
To solve this problem, you need to delete/remove extra (old) records keeping only one active record with type = “Activation”. However, you cannot manually do this through UI or Advanced Find (Dynamics 365 throws error), you have to contact Microsoft support to do the needful.