|Top Previous Next|
A trigger is a method of listening for events and responding with actions based on whether conditions are met. To view a list of triggers click on the Triggers node for the desired domain.
To add a trigger click on the Add button in the lower right corner. The first thing you'll see is the Trigger Template dialog. (See Using trigger templates) If you wish to proceed with the trigger creation process without using a template, just click OK without selecting any template from the Template drop-down list. On the other hand, if you wish to use a template, expand the Template drop-down list and select your desired template before clicking OK. If a template is selected, you'll be able to proceed with the trigger creation process but with the trigger already pre-populated with the values found in the template. You may change any setting as you see fit.
Next, the Add Trigger wizard will be displayed.
Name - A unique name identifying this trigger.
Event Type - The type of event you want to listen for.
Description - Description of this trigger.
Tags - If used, this trigger will only be visible to administrators with a system administrator flag or who have been assigned a role with specified tag.
Enabled - Enables/disables trigger.
Ignore trigger events while domain is - If checked, events will not be processed when domain is in specified state.
Run trigger in single instance mode - Specifies that only one instance of this trigger should be run at a time. If an instance of this trigger is already running, a second instance can be either queued or skipped. The exact behavior can be specified by choosing between queue and skip in the drop-down list.
Run trigger asynchronous - If checked, trigger will be processed asynchronously.
Run actions asynchronous - If checked, trigger actions will be processed asynchronously.
Fire Trigger Error event if error occurs - If an error occurs while executing any of the actions associated with this trigger, a Trigger Error event will be raised. You may capture this event using a trigger that listens for the Trigger Error event and respond appropriately.
Click the Next button to proceed to the next screen and to specify trigger conditions, if any.
Trigger conditions can be entered either manually or by using the GUI-based Expression Builder. If you develop an expression using the Expression Builder, the expression will be automatically written to the Expression box. This box will be read-only if the Override checkbox is unticked (unchecked). Should you wish to write the expression manually yourself, tick the Override button. Once the Override button is ticked, the Expression Builder will be disabled.
Expression - Enter a trigger condition (if any) in this text field. (See Writing conditions)
Override - Tick this checkbox if you wish to enter the trigger condition directly into the Expression box.
Test Expression - Click this button to test your trigger condition. (See Testing conditions)
Note: The following buttons will only be enabled if the Override checkbox is ticked.
Variables - Click this button to display a list of supported variables. This list will vary depending on the Event type used in the previous screen.
Functions - Click this button to display a list of functions. (See Function types)
Operators - Click this button for a list of supported Operators (e.g. =, !=, <, >, etc.). Hover your mouse over an operator to see a context-sensitive help.
Constants - Click this button for a list of supported constants.
AND - Click this button to insert the AND logical operator
OR - Click this button to insert the OR logical operator
Time Expression - Click this button for a more convenient way of specifying time expression parameters. (See Using time based triggers).
Click the Next button to proceed to the next screen and to add one or more trigger actions.
Trigger actions are added as nodes in a flowchart. When the Trigger Actions screen first appears, you'll see a canvas with a single node named Workflow. This Workflow node has four outputs, Start, Finish, Success and Failure.
Start - used to define what trigger action to execute when the trigger execution begins.
Finish - used to define what trigger action to execute when the trigger execution ends.
Success - used to define what trigger action to execute if all actions complete successfully in the Start or Finish workflows.
Failure - used to define what trigger action to execute if any action fails execution in the Start or Finish workflows.
Add - Click this button to add a trigger action.
Edit - Click this button to make changes to an existing trigger action.
Delete - Select an existing trigger action and then click this button to delete it.
Copy - Select an existing trigger action and then click this button to copy it.
To add a trigger action, click the Add button. Expand the Action drop-down list to view all available trigger actions. To see a context help for a particular trigger action, select the action from the drop-down list and click the adjacent question mark icon (See Figure 281). Select the action you want to use.
Click the OK button to proceed to the action parameters screen.
The contents of this screen will vary depending on the selected trigger action. Enter pertinent details for the action in question and then click OK.
A new trigger action node bearing the action type chosen (e.g. Sftp File Upload) will then be added to the canvas. Each trigger action has one input, Execute, and two outputs, Success and Failure. You may link this action to either the Start or Finish outputs of the Workflow node. If you link this action to the Start output, this action will be executed as soon as the trigger begins execution. If you link it to the Finish output, it will execute once the trigger execution completes.
To link the action node to the Workflow's Start output, click Start on the Workflow and then click Execute on the action node. You'll know the link is successful if you see a green arrow pointing from Start on Workflow to Execute on the action node.
Adding more action nodes
Should you wish to execute another trigger action after an existing action, just add another action node and link it to the previous node by clicking on 1) either the Success or Failure outputs of the first node and then 2) on the Execute input of the second node. You may add more nodes as you wish and then link them in a daisy-chain fashion. To change the order of execution of existing action nodes, just delete all affected links (by selecting and clicking Delete) and then reattach new links that reflect the desired order of execution. You may also rearrange the nodes if you wish.
In most cases, you would link a succeeding action node to the Success output of a previous action node. However, action nodes can also be linked via the Failure output. Normally, this is done for error handling purposes. For example, if an action fails, you might want JSCAPE MFT Server to send an email to a designated server admin (e.g. via the Send Email action) or log the failure to a file (e.g. via the Append File action).
Finishing a trigger
You may link an action node the Workflow's Finish output. This action will be executed regardless whether or not all actions linked to Start are able to execute successfully.
Trigger Success and Failure
The Success and Failure outputs of the Workflow node allow you to specify global success/failure workflows for the entire trigger. For example, if any trigger action fails, action(s) in the Workflow node's Failure output will execute. On the other hand, if all actions execute successfully, action(s) in the Workflow node's Success output will execute.
If an action in the Workflow node's Failure or Success output fails execution, then the Trigger Error event will be raised as normal. If this happens, the action(s) in the Workflow node's Failure output will not be executed again. This is to prevent an infinite loop.
When rerunning a trigger via the Rerun button in the Triggers > History tab, it's possible for there to be multiple points of failure; e.g. a failure in one of the Workflow > Start actions + a failure in one of the Workflow > Finish actions. When rerunning a trigger using the 'Rerun from point of failure' option, make sure that you always run from the first point of failure.