A few weeks ago I saw this discussion on CRMUG regarding the necessity of the “Stop Workflow” step in D365 Workflows. It was such an interesting discussion that I wanted to share a few thoughts of my own on the topic.
When I am building or editing a workflow, I usually have two main concerns : (1) That I won’t mess it up when I edit it later and (2) that other people won’t mess it up when they edit it later. While these seem like simple concerns, I try to keep these principles in mind each time I design my logic as it can reduce a large amount of work and headaches in the future.
Adding the “Stop Workflow” can sometimes make the workflow easier to read especially for less experienced customizers or administrators. This shows that the workflow has fully completed its task. It can also be used if you have multiple IF statements and you do not want the remainder of the workflow to fire (e.g., IF Business Line = Marketing, Stop Workflow). Alternatively, this could be built as IF Business Line = Sales, do logic. This is not always the case as it depends on your structure or what logic was already in place when this change was needed.
If you have a case where there is an issue with the record and you need to cancel the workflow, you can use the Stop Workflow step. This allows you to single out system jobs that you need to review. Keep in mind that Cancelled as a status should be used infrequently (e.g., if you check for inactive status and then stop workflow, this if not a cancel). In this case, the workflow did what it was supposed to but there was nothing for the workflow to do for that record. However, if you checked for a particular field to have data and it was blank, you may want this to be canceled so you can review and update.
The main reason you may want to use a Stop Workflow step is in a Real-Time workflow. In this case, you have the option to prevent the action of the workflow and return an error to the user. So you can have a Real-Time Workflow running before a delete, if the record meets particular condition (e.g., an opportunity over a certain value), then you can stop the workflow as canceled and tell the user to work harder to land the sale or to close.
In summary, I like the Stop Workflow step to add some clarity and finality to my workflows. I feel they are the foundation of any good workflow to ensure they can weather any future storms of mistakes, as even the best and the brightest of us are prone to make from time to time.
What do you think of Stop Workflow?