[Last updated July 25, 2019] In this article, we will discuss how to use the Trigger Error Event Type to capture errors and respond to them. In the example we are going to walk through, we will be using the Trigger Error Event Type to capture the error from a failed trigger action of another trigger and send an email to the administrator.
Capturing & Responding to Trigger Errors
Let's say I am the administrator and I have a Trigger set up to send Twitter updates via a Twitter Update trigger action whenever a file is uploaded, and I want to know if and when that Twitter Update action fails. Now, aside from the Twitter Update action, I may have several other actions set up on that same Trigger but I want to know exactly which of those actions failed. This can be accomplished by utilizing the optional "Trigger Error Message" field that is available on most actions in conjunction with the proper expression that we will discuss shortly.
First we want to make sure that the Trigger Action that we are watching for errors (in this case, the Twitter Update action) has the "Trigger Error Message" field populated. Here, we've populated it with the message "Twitter update failed".
Now, we create a new Trigger by clicking "Add" on the Triggers tab on the Triggers node. We will give our new Trigger an appropriate name. We will select the "Trigger Error" Event Type from the drop down and give our new Trigger a Description, then Click "Next".
Now we are going to write an Expression that will identify 1) the Trigger that contains the Action we want to monitor and 2) the Action itself within the Trigger. For this Example the Expression will look like this:
ErrorTriggerName = "File Upload Trigger" AND TriggerErrorMessage = "Twitter Update Failed"
Wherein the "ErrorTriggerName" identifies the name of the Trigger containing the failed action and the "TriggerErrorMessage" identifies the failed action itself by virtue of the Trigger Error Message we wrote for it earlier (i.e. "Twitter update failed"). Make sure that the error message is typed exactly the same in both places. Now click "Next".
Note: In older versions of JSCAPE MFT Server, the variable that used to represent the name of the trigger of the failed action was the TriggerName variable. In the latest version, the right variable for that property is now the ErrorTriggerName variable, while the TriggerName variable now represents the trigger that is listening to the Trigger Error event type. In this example, that would be the trigger named 'File Upload Trigger Error Response'.
Click "Add" in the succeeding screen and select the "Send Email" Action from the drop-down list. There are quite a few fields to fill out for this action and not all are mandatory.
Once you fill out all of the necessary email information go ahead and click "OK", then "OK" again and your new Trigger is now complete. For this example, this Trigger will now watch for and send an email when the Twitter Update Action fails from another Trigger.
In situations where further action is necessary upon the failure of a certain Trigger Action, this can be very useful to that end. By using the Send Email Action we can notify the proper personnel when this Action fails so it can be investigated immediately. Triggers can be used in many ways and the more you know how to use them, the more powerful a tool they become.
Try this out yourself. Download the free, fully-functional evaluation edition of JSCAPE MFT Server.
Want to be updated on posts like this? Connect with us...