Rename File
This Action renames a file.
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.
The values in the Name and Notes fields are displayed in a tooltip when you mouse over an Action node.
TARGET
File — Identifies the name of the source file.
Destination File — Identifies the name of the destination file.
In the above example, the target file OrigName.txt is renamed NewName.txt
Click the following link to view an example of renaming the
Destination File
using the ReplaceFirst function - ReplaceFirst function example This allows for the dynamic renaming of files.
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.
The Trigger Error Message is displayed in the
Trigger Error
column of the Action history (Triggers > History > View)
.
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 theTrigger > 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.
%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.
TheGetActionResult
function also supports using the ActionName
as an input parameter. This is an enhancement added in a more current version of MFT Server.Using Link Action
Select a field in the Trigger Action that you want to populate using the results of a previous Action.
Click Add Function. A list of functions displays.
Select GetActionResult(actionId). The field displays %GetActionResult(actionId)%.
Highlight the word
actionId
in the field.
Click Link Action. A list of Actions displays.
Select an Action. The actionId text is replaced with the Action ID.
The GetActionResult function looks similar to this: %GetActionResult("bee7cd8b-8021-4e19-8f76-1ae382e60c9d")%
In the example shown below, the Rename File Action is configured in a Trigger that is monitoring for a File Upload event (i.e. Parameters > Event type > File Upload
).
The target File
name is obtained from a variable (%File%
) that is system-generated and available for use with this Event type. It returns the file name that resulted (caused) the Trigger to execute (it is the file that was uploaded).
The Rename File Action is using the ReplaceFirst
function (see Function types) to rename the Destination File
- %ReplaceFirst(File,"PSB(.*?)_FTP_GI000110_DS4X_D([0-9]{6})_T.*?\.TXT","INKOPSRADER_$1_$2.TXT")%.
In this example:
-
The original file name is: PSBAV_FTP_GI000110_DS4X_D240924_T0309.TXT
-
The renamed file name is: INKOPSRADER_AV_240924.TXT
As another example, assume the Rename File Destination File
field consists of this: %ReplaceFirst(File,"A01D_PSBAJ_FTP_EUTFKKRE_DSSR_D([0-9]{6})_T([0-9]{4})\.csv","CL_Västerås_90.Krediteringsrapport_D$1_T$2.csv")%
-
The original file name is: A01D_PSBAJ_FTP_EUTFKKRE_DSSR_D240915_T0027.csv
-
The renamed file name is: CL_Västerås_90.Krediteringsrapport_D240915_T0027.csv
The syntax for this function is ReplaceFirst(string,regex,replacement). The above examples depict a more advanced use of this function. MFT Server directly invokes universally accessible Java functions when using one of its many supported Function types.
Regular Expressions are also supported in a Trigger Condition, as shown below.