So I have had this blog post on my "to do list" for some time now and the list is now beginning to get scroll bars so I have to tackle it! I have seen a lot of questions posted on the community (and asked in my workplace) about workflows incurring an error without much detail as to why this has happened. The thing that I would always offer to anyone with these problems is to use the inbuilt error handing within Nintex workflow actions wherever possible. Why? Well a number of reasons actually:
- If a workflow errors it notifies the initiator (unless those settings are changed). Normally the initiator is a user in the business unaware of the design of the workflow, and sometimes unaware of the workflow altogether. The last thing these users want is a ghastly email that says a workflow, that they may not be aware, has errored with some hideous details that they don't understand:
- The details given when a Nintex workflow errors are sometimes completely non-descript and offer no help or direction in where you, as the workflow developer, should look to find the issue and resolve it. An example of this helpful error is here:
- OK sometimes errors in the workflow are the end of the world(!!) and will mean that the workflow will need to be terminated and started again. However, sometimes, an error in an action wouldn't mean the end of the world and you might be happy to just catch and log the error without having to visit the workflow on the item, terminate it and restart it.
Actions with Error Handling
My understanding of the Nintex workflow actions is that the following all have error handling in their configuration (please correct me if I have missed any):
- Call web service
- Execute SQL
- Find users by status
- Get user status
- Query BCS
- Query Excel Services
- Query LDAP
- Query XML
- Update XML
- Web request
- Convert document
- Copy to file share
- Copy to SharePoint
- Create item in another site
- Create list
- Delete multiple items
- Submit record
- Update multiple items
- Convert value
- Add user to AD group
- Create AD group
- Create AD user
- Create site
- Create site collection
- Decommission AD user
- Decommission site collection
- Delete AD group
- Delete site
- Enable Lync / OCS
- Provision user in Exchange
- Remove user from AD group
- Update AD user
- Create appointment
- Create task
Configuring error handling
All of the above actions have in-built error handling available in the configuration of the workflow actions. Error handling looks like this in the workflow action:
By default it will be set to capture errors = No. You have three choices here if you want to catch errors:
- catch if an error occurred: "Store error occurrence in" a simple Boolean value that will indicate if an error occurred in the execution of the action.
- catch the details of the error: "Store error text in" a text value for the error returned in the execution of the action
- catch both (my general approach)
So to use these options you need to create some variables to store this information. I normally create a Boolean (yes/no) variable and a single line of text variable and configure my error handling as follows:
Note be sure to change "Capture errors" to Yes.
Dealing with errors
Well this is a very personal thing and entirely depends upon the design of your solution as to whether the error is a deal breaker or just something to be made aware of. Generally if it's not a big deal I have a piece of my workflow directly after the action as follows:
This way the workflow will continue but I will be notified of the error returned.
If it is a deal breaker error, I would normally add an "End workflow" in that "Run if" after the email.
Workflow error notifications
By default the initiator will be notified if the workflow errors and has a status of "Error Occurred". If this is not acceptable to you (which it never is to me), you can change these setting by navigating to Site Settings > Nintex Workflow > Workflow error notifications
Here I would change "Send notifications to the workflow initiator" to "No" and specify alternative email addresses to be notified instead.
How do you deal with errors?
I am interested to hear from you guys... how do you deal with errors? Do you use this built in error handling functionality? What do you do when an error occurs?