Trading Partner Directory Listing

This action returns a directory listing of files that match the wildcard or regular expression specified.

 

 

Note: An example where the directory listing results are passed to a For Each action can be accessed at the bottom of the page by clicking on this link: Example - Using a For Each action to access the Trading Partner Directory Listing results

 

Parameters

 

This section describes the fields on the Parameters tab.

 

ACTION

Name — Identifies the name of the Action. The system-generated default name, depicted in the image above, can be changed to a different name to suit your preferences. The Name must be unique within the current Trigger workflow.

 

Notes — Describes the action.

 

Tip: The values in the Name and Notes fields are displayed in a tooltip when you mouse over an Action node.

 

CONNECTION

Partner - This is the trading partner that will be used in the trigger action. The drop down list will display all the trading partners created in AUTOMATION > Trading Partners that are compatible with this action. Select the desired trading partner from the list. The connection information that will be used is configured in the selected trading partner (for example, hostname, port, etc.).

 

TARGET

Remote Directory - This field is the directory you wish to obtain a file listing for.

 

Regular Expression - This field is the expression that will identify what files to including in the listing.

 

Expression Type - This field is the expression type, which is either a wildcard or regular expression.

 

Exclude Directories - This field, if checked, will exclude directory names from the list.

 

Recursive - This field, if checked, will list all files and subdirectories in the specified Remote Directory.

 

Advanced

 

This section describes the fields on the Advanced tab.

 

EXECUTION

Priority — Identifies the Action’s priority. An Action can be interrupted by an Action with a higher priority. The highest priority is 1. The maximum priority value is 1000. Priority comes into play when certain scenarios occur, like when Triggers or transfers are exceeded (see Settings for more information).

 

LOG

Trigger Error Message — Used when a Trigger Action fails. The two uses are described below.

 

  1. The Trigger Error Message is displayed in the Trigger Error column of the Action history (Triggers > History > View).

     

  2. If you create an error-handling Trigger, the Trigger Error Message is passed to the error-handling Trigger.

  • An error-handling Trigger is a distinct Trigger that uses the Trigger Error Event type, as selected in the Trigger > Parameters dialog.

  • If a Trigger Error event occurs, the Trigger Error Trigger runs.

  • The Trigger Error Message is accessible in the Trigger Error Trigger as a variable named TriggerErrorMessage.

The image below depicts the Trigger Error Message displayed in the history of a failed Trigger Action.

 

 

The image below depicts selecting the Trigger Error Event type used to handle Trigger errors.

 

 

The image below depicts a Trigger Action (part of the Trigger Error Trigger workflow) accessing a Trigger Error Message. This is accomplished using the TriggerErrorMessage variable. To reference built-in variables, enclose the variable name in percent signs (%).

 

 

As a practical use case example, you can reference the Trigger Error Message in the body of an Email Action that is part of the Trigger Error workflow. The email alerts interested parties that a Trigger Action failed.

Log Action — When selected, Trigger Action records are added to the Domain > AUDIT > Logging module. The state of the Action is included, such as action started, action completed, and action failed. When unselected, Action records are not added to the Logging module. However, the Trigger itself is still logged.

 

Buttons

Add Variable — Displays a list of built-in event variables. Each Trigger has several event variables you can use in one or more of the Trigger Action fields. When a variable is selected from the list, it is added to the Action field that is currently active. Built-in event variables are enclosed using the percent sign (e.g., %DomainName%).

 

In addition to using built-in variables, you can also specify a user-defined global variable, created in AUTOMATION > Triggers > Settings. To reference a global variable (Defining global variables), use the %GetGlobalVariable% function.

 

Example: %GetGlobalVariable("DirName")% retrieves the global variable named DirName. When using global variables, specify the variable name enclosed in quotes, as depicted in this example.

 

Add Function — Displays a list of built-in functions. Functions are useful for formatting or parsing a Trigger event variable. When a function is selected from the list, it is added to the Action field that is currently active. For more details about functions and their usage, see Function types.

 

Link Action — Displays a list of Actions. When an Action is selected, the Action ID is returned.

 

An Action ID (a string of alphanumeric characters) is an input parameter used in the GetActionResult function. This function returns the results of a previously executed Action in the current Trigger workflow. This means that Action results can be passed to a linked (following) Action.

 

Note: The GetActionResult function also supports using the Action Name as an input parameter. This is an enhancement added in a more current version of MFT Server.

Using Link Action

  1. Select a field in the Trigger Action that you want to populate using the results of a previous Action.

     

  2. Click Add Function. A list of functions displays.

     

  3. Select GetActionResult(actionId). The field displays %GetActionResult(actionId)%.

     

  4. Highlight the word actionId in the field.

     

  5. Click Link Action. A list of Actions displays.

     

  6. Select an Action. The actionId text is replaced with the Action ID.

Example: The GetActionResult function looks similar to this: %GetActionResult("bee7cd8b-8021-4e19-8f76-1ae382e60c9d")%

Example - Using a For Each action to access the Trading Partner Directory Listing results

This example shows you how to access the results of the Trading Partner Directory Listing action using the For Each action.  The For Each action passes each directory listing file name, one at a time, to the Append File action. The Append FIle action is used for ease of demonstration purposes. It writes each file name to the specified text file. How to access each item in the For Each action can be applied to many other actions (e.g. Move File, Copy File, etc.).

 

First, the image below depicts the complete workflow.

 

 

Next, the image below depicts the Trading Partner Directory Listing field settings. Observe the Name of the Action: TP_Dir_Listing. This will be used later on to retrieve the results of the directory listing. All the files with a .csv extension, located in the target trading partner system's c:\test1 directory, will be returned using this action.

 

 

Next, the results of the Trading Partner Directory Listing action are accessed in the For Each action as depicted in the Items field below. The GetActionResult function is used with TP_Dir_Listing as its argument. This is the Action Name of the Trading Partner Directory Listing action. As a note, the system also auto-assigns each action an Action ID, and that ID can also be used (instead of the Action Name) as the GetActionResult argument. The Link Action button provides a list of the Action ID's for each action in the workflow. When using the Action ID, the GetActionResult function would look something like this:

%GetActionResult("b6f2d66c-8108-46f0-870e-ac3942a91ddc")%. Using the Action Name makes it easier to see what action is being referenced in the function, at a glance.

 

 

Next, the Append File action executes for each item (i.e. file name) in the directory listing. In this example, there are two files that matched the .csv file extension in the target directory. Therefore, the Append File action will execute two times. The Message field is getting the results from the For Each action. The GetActionResult function is using the For Each Action Name - For_Each_File - as its argument.

 

 

After this workflow runs, a detailed Trigger history can be accessed, as depicted in the image below. Notice there are two Append File actions in the Action History. This is because there were two files in the directory listing. If there were five files, you would see five Append File actions in the list.

 

 

On a final note, the image below is taken from the file created by the Append File action.