Adding triggers

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 AUTOMATION > Triggers > Triggers tab for the desired domain.

 

clip0034

 

Adding a Trigger

 

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.

 

clip0359

 

Next, the Add Trigger dialog will be displayed. The Parameters tab will be enabled by default.

 

 

Note: You can populate fields in the three tabs (Parameters, Conditions, and Actions) in any order you desire. However, if a tab fails a data validation check, you will see a warning icon to the left of the tab name, as outlined in red in the image below.

 

 

Parameters Tab

 

General

Name - A unique name identifying this trigger.

 

Event Type - The type of event you want to listen for. When the event occurs, the trigger actions will execute, providing conditions (if any are configured) have been met. See Event types.

 

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.

 

Advanced

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.

 

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.

 

Conditions Tab:

 

The Conditions tab lets you optionally specify condition(s) that must be met for the actions to execute. Trigger conditions can be entered either manually (enable "Override") 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 unchecked. Should you wish to write the expression manually yourself, check the Override checkbox. Once the Override button is checked, the Expression Builder will be disabled.

 

Note: If no conditions are specified, the trigger will occur every time the configured event takes place.

 

 

 

Expression - Enter a trigger condition (if any) in this text field. (See Writing conditions)

 

Override - Enable the 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 checked.

 

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).

 

Actions Tab

 

A trigger action is what executes when the trigger event occurs. One or more trigger actions are supported. Trigger actions are added as nodes in a flowchart. When the Trigger Actions window first appears, you will see a canvas area with a single node named Workflow, as depicted in the image below.

 

 

The Workflow node has four outputs, Start,Finish, Success and Failure. Each of the four Workflow outputs support the creation of multiple trigger actions, meaning you can have one or more actions linked to the Start output and one or more actions linked to the Finish output, etc. You can then have one or more actions linked to the output of a prior action's Success and one or more actions linked to a prior action's Failure. When there is more than one action linked to the same output (e.g. two actions linked to the Start of the Workflow, or three actions linked to the Success of a prior action), the multiple actions are executed asynchronously (concurrently). Please note that for most trigger actions the input name is Execute, and the output names are Success and Failure. There are some actions where the input and output names are different.  For example, the If action input name depends on the Condition field entered by the user. The output names are Then and Else.  For all actions, the input name is on the left-hand side of the node, and the output names are on the right-hand side.

 

Workflow outputs

 

Start - Used to define what trigger action(s) to execute when the trigger execution begins.

 

Finish - Used to define what trigger action(s) to execute when the trigger execution ends.

 

Success - Used to define what trigger action(s) to execute if all actions complete successfully in the Start or Finish workflows.

 

Failure - Used to define what trigger action(s) to execute if any action fails execution in the Start or Finish workflows.

 

Add, Edit, Delete, Copy, Copy ID to clipboard, Reset Zoom Level

 

Add - This button allows you to add a trigger action. When selecting this option, an Add Action window will pop up. Another way to add an action is to right-click on a Workflow node, action node, or in the white space of the canvas area. The Add option will appear in a pop-up menu, where you can then expand the Add sub-menu to see the options, then select Add action. Note: In the Add sub-menu options you will also be able to select Add condition and Add cycle. Add condition allows you to quickly add an If action without having to select it from the drop-down list of actions. Similarly, the Add cycle menu options allows you to quickly add a ForEach trigger action without having to select it from the drop-down list of actions.

 

Edit - Select an existing trigger action, then click on this button to edit it. You can also right-click on a trigger action, then select Edit from the pop-up menu. As a final way to edit an action, you can double-click on the desired action node, which will pull the action up in the Edit <name> Action window.

 

Delete - Select an existing trigger action and then click this button to delete it. You can also mouse over an action node you wish to delete, which will result in a red "x" appearing in the node's right-hand corner. Click the x to delete the trigger action. A final way to delete an existing trigger action is to right-click on the action, then select Delete from the pop-up menu. Using either method, you will be prompted to confirm the deletion.

 

Copy - Select an existing trigger action, then click this button to copy it. You can also mouse over an action you wish to copy, which will result in a copy icon appearing to the right of the trigger action's name. Click the copy icon to copy the trigger action. A final way to copy an existing trigger action is to right-click on the action, then select Copy from the pop-up menu.

 

Copy ID to clipboard - This menu option is available when you right-click on any node in the canvas area. When selected, the system-assigned Action ID is copied to the clipboard. The Action ID can be used in the GetActionResult function as its input parameter.  In more recent versions of MFT Server, you can also use the Action's Name field as the input parameter. The Name field allows you to enter a value that is more user-friendly than the system assigned Action ID.

 

Reset Zoom Level - This is a menu option that you will see when you right-click in the white space of the canvas area, or you right-click on any node or link.  If you have increased or decreased the zoom level, selecting this option will display the nodes and links in the canvas area at 100%.

 

To add a trigger action, click the Add button, or use any other method previously described. 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 information icon (see the image below). Select the action you want to use.

 

 

Click the OK button to proceed to the action parameters screen.

 

The Action window will vary depending on the selected trigger action. Common to all trigger actions are the Name and Notes fields, depicted in the image below. The Name field initially consists of a default, system-generated value which includes the name of the action followed by a series of letters and numbers. You can change the Name's default value to something easy to remember, which is helpful when using it as the input parameter for the GetActionResult function. The Name field value must be unique within the trigger you are defining. Note: The system-assigned Action ID can also be used as the input parameter for the Trigger function GetActionResult. Use the right-click Copy ID to Clipboard menu option to obtain the Action ID. The Action ID has always been supported as the GetActionResult's input parameter; support for the Name field to be used as the input parameter was introduced in a later version of MFT Server.

 

Next, the Notes field allows you to describe what the action is doing. Both the Name and Notes fields are displayed as a tooltip in the Trigger canvas area when you mouse over an action node.

 

After entering the remaining action details, click OK.

 

 

A new trigger action node bearing the action type chosen (e.g. Trading Partner File Upload) will then be added to the canvas. Most trigger actions have one input, Execute, and two outputs, Success and Failure (as mentioned earlier, there are a couple of actions where the input/output names are different). You may link the Trading Partner File Upload 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.

 

As you create new action nodes, they will be placed in a default location on the canvas area. You can move the Workflow node or any action node around by clicking on the title bar of the node, then moving (dragging) it to your desired location. There is a feature that when enabled (it is disabled by default) will organize your actions by snapping them to the canvas area grid. This means that the action nodes will be placed at the closest intersection on the grid (grid lines are not visible on the canvas area and cannot be made visible). If you wish to use this feature, right-click anywhere in the canvas area (including on the nodes and links) which will pull up a pop-up menu where the Align actions to grid menu option can be selected. When selected:

 

  • The existing nodes and any future nodes you create in the current session will automatically align in the canvas area.

  • A green check will appear to the left of the Align actions to grid menu option (it serves as a visual aid for you to know this feature is enabled).

 

When Align actions to grid is enabled, existing and new nodes will be snapped to the grid which means you do not have granular control of where the nodes are placed on the canvas area. The system will align them in the grid for you. You can still manually move the nodes around as previously described, however, they will be snapped into the nearest grid location as determined by the system. Check the Align actions to grid menu option to disable this feature (the green check is removed from the menu option when disabled). Once disabled, you can manually move the nodes in a precise desired location, and they will remain where you place them.

 

When you save the trigger, the system saves the node layout, therefore when you edit the trigger in the future, the nodes will be in the position they were in when you last saved it. This is true regardless of whether Align actions to grid is enabled or disabled when you save the trigger.

 

 

To link an action node to the Workflow's Start output, you can use the original method, or the new method.

 

Original method

 

  1. Click on the Workflow's Start label or click on the output connector symbol (a "half diamond") to the right of the Start label.

  2. Release your mouse (do not hold down any mouse button).

  3. Move the mouse to the desired action's input that you wish to link up to. As you move your mouse, a dashed line will appear. The action's input is always on the left-hand side of the action node, and is most frequently named Execute, but there are a few exceptions (e.g. If action).

  4. Click the mouse when you see the target action node's input connector symbol (a "half diamond") turn a different shade of color, indicating it is active. A link will be generated. You will know the link is successful when you see a green arrow pointing from Start on the Workflow to the input connector symbol on the target action node. This is depicted in the image below.

     

New method

 

  1. Click on the Workflow's Start label or click on the output connector symbol (a "half diamond") to the right of the Start label. Do not release the mouse.

  2. Drag the mouse to the desired action's input that you wish to link up to. As you move your mouse, a dashed line will appear. The action's input is always on the left-hand side of the action node, and is most frequently named Execute, but there are a few exceptions (e.g. If action).

  3. Release the mouse when you see the target action node's input connector symbol (a "half diamond") turn a different shade of color, indicating it is active. A link will be generated. You will know the link is successful when you see a green arrow pointing from Start on the Workflow to the input connector symbol on the target action node. This is depicted in the image below.

 

Note: All trigger actions must be linked to an output. If you do not add links and attempt to navigate away from the Actions tab (by selecting the Conditions or Parameters tab), or click the OK button to save the trigger, you will be warned about missing links. A message box will state: "Orphan actions detected will not be saved. Are you sure you wish to continue?". Make sure to include a link before saving the trigger or the action will not be saved.

 

 

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 the link and clicking the Delete button, or by right-clicking and selecting Delete from the pop-up menu) and then reattach new links that reflect the desired order of execution. You may also rearrange the nodes if you wish, as previously described. In the image depicted below, when the trigger event occurs, the workflow will start by running the Trading Partner File Upload action. If that action is successful, the Move File action will execute.

 

 

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 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), or perhaps do both. Performing both Failure actions, Append File and Send Email, is what is depicted in the image below. Whenever you have two or more actions linked to an output (in this case Failure), the actions (should a failure occur) will run asynchronously. As discussed in the Trigger lifecycle section, you can assign more than one action to any single output, which also includes the Workflow outputs.

 

 

Finishing a trigger

 

You may link one or more action nodes the Workflow node'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 AUTOMATION > 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.

 

See also

 

Event types

Action types
Function types

Defining custom action types