I was asked to participate in the CRMUG 4×4 webinar series. These are quick webinars with multiple speakers sharing tips and answering questions. I also wanted to document my tips here for future reference.
Workflows are a great way to quickly and easily provide automation to help your users and your business process. It is very important to understand how they work so you can use them effectively. Here are my tips for working with workflows.
Map Out the Process
With any type of process it is important to map out exactly what you want to happen. Start with your requirements and then use a visual tool like Visio (or a white board) to draw out the steps. This is important so you can find logic errors or any pieces that may need additional thought. Ask yourself questions like:
- What conditions do I need to check before processing?
- Are there any exceptions?
- Does this IF need a default condition?
This is also a good time to look for pieces that can or should be broken out into child workflows. Child workflows are a great way to divide up the process into logical groups but it cannot pass it’s status back to the main workflow so you have to account for that. Child workflows can also be called by other workflows. So if you notice many of your workflows are doing the same few steps, consider seeing if this can be made into a child.
Finally, drawing your process gives you something visual to share with your stakeholders. Especially in complex workflows, it is good to walk through this with your stakeholders to make sure they have thought through all the possible branches and the logic associated with them.
Test in Test
I always recommend creating your workflows in a development or test environment and using a solution to move it to the production environment. This ensures that you have an opportunity to fully test without the danger of harming any production records. It also allows you to see the outcome of the workflow and demonstrate to the stakeholders to ensure it is what is needed.
If you want to test the workflow on a larger volume of records try importing records that meet the criteria (even exporting from a production system if it is a workflow update instead of full rewrite) or using the bulk edit feature. This will allow you to quickly fire off a large number of the workflows so you can monitor the system jobs and look for any errors.
I also find that including workflows as part of a release raises the visibility. We never import solutions to production unless it is our designated release. For releases, we review all of the items going and determine which groups need to be aware of the change. So the system team has an opportunity to ask questions early and user are aware so they can provide input as well.
CRM Horror Story: My CRM horror story is from back in the days of CRM 4.0. This was before solutions so most workflows were created in live. I was a part of the CRM Team focused mainly on development, training and troubleshooting. There was another group of power users focused on reporting who had access to create workflows.
One of these reporting users created a workflow to fill in some data on certain records. He had it start when fields were edited including the Modified On field. The workflow then updated 3 fields in 3 separate steps. He turned this on and then imported 3000 records. So each of these records triggered a workflow and as that workflow ran it updated the record 3 times and triggered 3 more workflows.
This brought the CRM system to a halt! The problem was not obvious at first because we were unaware of this workflow until we evaluated the system jobs. To resolve we have to deactivate that workflow and give the reporting user a stern talking to (twice actually because he tried to do it again).
Moral of the story – limit access to create workflows, educate people on their impacts, ensure people are aware of workflow effects and TEST before releasing to production!
Review System Jobs
It is very important to know what is happening in your system. Get familiar with how the System Job view looks – how many workflows are running in a given time period, what kind of workflows, what other things do you see here. This is helpful so if there is an issue you can look and know what you are expecting to see.
Keep an eye on your suspended jobs (waiting) as well as failed jobs. If you have workflows that wait, these will appear in your suspended jobs. Edit this view to pull in additional details of the workflow (stage, regarding record details, etc.) so that you can look for items that should not be waiting.
The capabilities of Advanced Find are amazing so you can narrow down your results based on records related to the workflow to specifically see items that may need more work.
Also look at System jobs with an Error Message. This means that as it was processing it ran into an error and could not continue. These workflows are still in a waiting or suspended status. These should be manually reviewed. If you can resolve the issue, you can resume the workflow so it moves forward. If you cannot resolve it or the necessary processing was already done, then you should cancel the system job. At the end of your review you do not want any error workflows still in a waiting status.
As part of your review of System Jobs with errors, you should evaluate if the Workflow needs to be changed. For example, if the error was trying to update a task that had been closed, you can add a check condition to the workflow to check that the task is open before editing it.
Use Case: Maintenance Work
A great use case for Workflows and Dialogs is maintenance. By this I mean record edits or changes that power users may need to make that you do not want the average user to be able to make.
For example, say there is a date field that is automatically populated based on when another field is changed. If you need to set this to a date in the past you can use a dialog which asks what date it should be set to and then makes the change. (An alternative tip provided by Mitch Milam I believe is to create an “Administrator” form where all fields are editable. Make this only available to System Administrators.)
Recently we have also used this for test records. Instead of trusting that a user will handle all the steps to ensure the record is properly marked as a test – create a workflow that can be run. This workflow can append test to the name, add comments, and even reassign to a test owner.
Here are the tips from other panels:
- If you can’t document it in a document flow then you shouldn’t do it in a workflow
- Keep them clean – do not over-nest if statements. Try to break into child processes. More flexibility for future changes as well. Just don’t forget to close all the doors by including stop workflow statements
- Clean them up – turn on automatic deletion and use bulk delete jobs for others
- Review system jobs to look at failed and waiting jobs, review the associated message to see if there was an error
- “When pigs fly” conditions – talk to the manager and also the person doing the work and get them involved in the planning. Still prepare for other situations. Consider a default condition that will send an email (or queue item) for awareness.
- Don’t underestimate the power of workflows
- Be careful what you trigger it off of – don’t want it to be called over and over again. Look at the workflow possibilities before building custom code.
- Be aware of the user security and impact on the workflow. On-Demand runs as the user. Automatically triggered runs as the workflow owner.
- Gus G tip for creating dummy records then remove with bulk delete to trigger workflow on a linked record – http://community.dynamics.com/crm/b/adopt2win/archive/2013/04/15/scheduling-recurring-workflows-in-microsoft-dynamics-crm-2011-online-and-on-premise
- Required fields do not apply to workflow, only on the form. Users will need to populate if they are assigned the record.
- Wait conditions – make sure to include a timeout and a way for users to cancel
- Trigger custom error messages with real-time workflows: http://survivingcrm.com/2013/11/using-real-time-workflows-to-show-error-messages/
- Remember you cannot trigger workflows off of updated to calculated fields
You can also view the recording here: https://www.crmug.com/viewdocument/?DocumentKey=eb610407-13c0-4f38-968a-035bb433337d
There are so many great uses for workflows! I try to never do anything twice – if I have to do it more than once I should find another solution such as a workflow, bulk edit, export, etc. So, what do you use workflows for? What are your tips for learning and creating workflows?