During workflow execution, if an action fails, the workflow execution is stopped immediately. However, there are times when you want the workflow to continue execution or follow a specific path despite the error. In such a case, you can use the Global Error Handler.
The working of Global Error Handler is much similar to the ‘Error Handler’ which can be attached to an individual action in order to skip the failed action and continue workflow execution. The major difference between the two is that the Global Error Handler lets you define a set of actions to be performed in case an error occurs. Let’s understand how the Global Error Handler works with the help of an example.
How it works
Let’s say, you have a workflow that creates a folder in Box and sends you the folder details via Gmail.
If a folder with the same name as the folder you are trying to create already exists in your Box account, the action fails and workflow execution is stopped. Suppose, in case of an error, instead of the workflow execution being stopped abruptly, you want to create a Zendesk ticket for the failed action and send the ticket details to the support team space. In such a case, you can use the Global Error Handler, as shown below:
Step 1: Create the required workflow as you would normally do. Next, from the ‘Actions’ panel, drag and drop ‘Global Error Handler’ action on to the canvas.
Step 2: Since you want to create a Zendesk ticket for the failed action and send the ticket details on the Support team space on Cisco Webex teams, drag-and-drop the ‘Zendesk - Create Ticket’ and ‘Cisco Webex Teams-Post New Message’ action inside the Global Error Handler and connect them as shown below:
Step 3: Configure the actions inside the Global Error Handler, as you would normally do for a workflow. Since we want to create a Zendesk ticket for the failed action, add the output of the ‘Global Error Handler’ action in the ‘Description’ section of the ‘Zendesk- Create Ticket’ action.
Step 4: Once this is done, you will be taken back to the canvas.
With this, you have successfully set up the Global Error Handler for your workflow. Now whenever you execute your workflow and any of the workflow action fails due to an error, a ticket will be created in Zendesk and a notification about ticket will be posted on the specified space on Cisco Webex Teams.
Note: The Global Error Handler does not work for ‘Resumed’ workflows. For example, let’s say you have enabled the ‘Checkpoint’ feature for a workflow which contains the Global Error Handler. When an action fails, the status of the previously successful actions will be saved as per the ‘Checkpoint’ feature. At the same time, the Global Error Handler will also execute the actions added inside it. Now if the user resumes the workflow execution from the failed action, and one of the next actions fail, the Global Error Handler will not be executed.