---
sourceDocument: Australia ServiceNow AI Platform Capabilities
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/de-DE/servicenow-platform

 Release :

    - australia

ft:locale :

    - de-DE

ft:publication_title :

    - Australia ServiceNow AI Platform Capabilities

ft:clusterId :

    - platcap

bundleId :

    - platcap

workflow :

    - Platform


---

# Create an SFTP activity

# Create an SFTP activity {#ariaid-title1}

* Freigeben Version: Australia
* 
* Aktualisiert 12. März 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 14 Minuten Lesedauer

Create an activity that executes basic SFTP commands on a remote server.

## Vorbereitungen

Roles required: activity_creator or workflow_admin

## Warum und wann dieser Vorgang ausgeführt wird

You can create a custom activity that manages files and directories on a target host or copies a file from one SFTP server to another. The file content is streamed through a MID Server, which avoids having to store the data on the hard drive of the MID Server host machine.  
Hinweis:  
This activity requires the credentials of a user who can execute SFTP commands on the source host. The [Copy File](https://servicenow-prod.fluidtopics.net/TXR_i9XQ_e4B3l1fCWdANQ "The Copy File activity copies a file from an SFTP server (source host) to another SFTP server (target host).") activity, provided in the activity pack, requires separate credentials to access the target host.

## Prozedur

1. Create a [custom
   activity](https://www.servicenow.com/docs/access?context=create-custom-activities&version=australia&pubname=australia-integrate-applications&ft:locale=en-US).  
   This action creates a custom activity using a template.
2. After setting up [general properties](https://servicenow-prod.fluidtopics.net/0Sm9zu2rRND~nSxb9VUhVw "The following General Property fields are common to all activity designer templates.") and [creating input
   variables](https://servicenow-prod.fluidtopics.net/9cajF_Pe381UXOE8RYlECw#CreateInputVariables "Create the variables to pass into the activity in the Inputs form of the activity designer."), configure the SFTP Execution Command.

   | Option | Bezeichnung |
   | Command | Type of activity to create. The choices are: * Copy file * Create directory * Get file list * Remove file or directory * Rename file or directory * Set file attributes {#t_CreateAnSFTPActivity__ul_anw_zbr_vz} Hinweis: The fields that display on the form depend on the command you select. |
   | Source host | Name or IP address of the server containing the files targeted by the activity. |
   | Source port | Port number to use to communicate with the source server. The default port number is 22. |
   | Source file path | Full path to a file (/temp/test_data_file.txt) or directory (/temp/test_dir) on a source host depending on the selected command. Field available on following commands: * Copy file * Remove file or directory * Set file attributes {#t_CreateAnSFTPActivity__ul_bnw_zbr_vz} |
   | Source directory | Path to the directory where the source files are located. Field available on following commands: * Create directory * Get file list {#t_CreateAnSFTPActivity__ul_cnw_zbr_vz} |
   | Source files | Names of specific source files to include in the file transfer. Separate the file names with semi-colons. This field supports a semi-colon separated list of wild-card patterns. For example: \*.txt; a?cd.pdf. If this field is blank, all files are included. Field available on following command: Get file list Hinweis: For information about how the values in this field affect options in other fields, see the logic explanation which follows. |
   | Is a directory | If checked, specifies the file path is a directory. Field available on following command: Remove file or directory |
   | Credential tag for source | Specific credential tag this activity must use to run SFTP commands on the source host. |
   | Credential tag for target | Specific credential tag this activity must use to run SFTP commands on the target host. Field available on following command: Copy file |
   | Excluded files | Names of specific source files to exclude from the file transfer. The activity acts on all other files found in the source directory or subfolders. Separate the file names with commas. This field supports comma-separated list of wild-card patterns. For example: \*.txt, a?cd.pdf.. Field available on following command: Get file list Hinweis: For information about how the values in this field affect options in other fields, see the logic explanation which follows. |
   | Include subfolders | If checked, includes the files from subfolders in the source directory. Field available on following command: Get file list Hinweis: For information about how your selection affects other fields in the form, see the logic explanation which follows. |
   | Target host | Name or IP address of the server to which the files are being transferred. Field available on following command: Copy file |
   | Target port | Port number to use to communicate with the target host. The default port number is 22. Field available on following command: Copy file |
   | Target file path | Full path to a file on a target host. Field available on following commands: * Copy file * Rename file or directory {#t_CreateAnSFTPActivity__ul_knw_zbr_vz} |
   | Suffix for temporary file | If a file exists on a target host, this command enables a temporary suffix to use for a file name. If this field contains a value, the activity first copies the source file to a temporary file on the target host using targetFilePath + tempFileSuffix as the name. Upon completion, the activity renames the file to the actual target file name. If this field is blank, the activity copies the source file directly to the target file and overwrites it, if it exists. Field available on following command: Copy file |
   | UID | User ID attribute to apply to a file or directory. The UID and GID values must be set together as a pair or they are ignored. The UID and GID numbers are internal values returned by the Get File List activity. Typically, you first use the Get File List activity to return a list of files and their attributes. Then you can move a file from a source host to a target host and set the source file attributes on the target file. This flow is demonstrated in the [SFTP File Transfer workflow](https://servicenow-prod.fluidtopics.net/dYY_MvwjYid4lomUBUo18w "The SFTP File Transfer activity pack includes a scoped workflow that uses multiple activities to manage files on SFTP servers."). Field available on following command: Set file attributes |
   | GID | Group ID attribute to apply to a file or directory. The UID and GID values must be set together as a pair or they are ignored. The UID and GID numbers are internal values returned by the Get File List activity. Typically, you first use the Get File List activity to return a list of files and their attributes. Then you can move a file from a source host to a target host and set the source file attributes on the target file. This flow is demonstrated in the [SFTP File Transfer workflow](https://servicenow-prod.fluidtopics.net/dYY_MvwjYid4lomUBUo18w "The SFTP File Transfer activity pack includes a scoped workflow that uses multiple activities to manage files on SFTP servers."). Field available on following command: Set file attributes |
   | Permissions | File or directory permissions to set for the user and group specified. This value must be expressed as an integer, such as 16877, which defines these permissions: rwxr-xr-x. The permissions numbers are internal values returned by the Get File List activity. Typically, you first use the Get File List activity to return a list of files and their attributes. Then you can move a file from a source host to a target host and set the source file attributes on the target file. This flow is demonstrated in the [SFTP File Transfer workflow](https://servicenow-prod.fluidtopics.net/dYY_MvwjYid4lomUBUo18w "The SFTP File Transfer activity pack includes a scoped workflow that uses multiple activities to manage files on SFTP servers."). Field available on following command: Set file attributes |
   | Access timestamp | Override the timestamp when the file or directory was last accessed. The access and modification timestamps must be set together as a pair. Field available on following command: Set file attributes |
   | Modification timestamp | Override the timestamp when the file or directory was last modified. The access and modification timestamps must be set together as a pair. Field available on following command: Set file attributes |
   | Size in bytes | Size of a file, expressed in bytes. Field available on following command: Set file attributes |
   | Required MID Server capabilities | MID Server with the appropriate [MID Server capabilities](https://servicenow-prod.fluidtopics.net/Ixqp8gLvT6tnD2ksANEvaQ "MID Server capabilities define the specific functions of a MID Server within an IP address range.") for connecting to the source and target servers. |
   |-|-|

   {#t_CreateAnSFTPActivity__choicetable_zmw_zbr_vz}  
   The system uses this logic to determine which files to move from the source host:
   * If the Source files field is empty, the system selects all the files in the source directory. Otherwise, it only selects those files whose names match one of the file name patterns given in the field.
   * If the Excluded files field is empty, the system excludes nothing. Otherwise, it excludes those files whose names match one of the file name patterns given in the field.
   * The exclude rule has a higher preference than the include rule. If a file name matches one of the file name patterns in the Excluded files field, it does not get into the selection regardless of the include rule.
   * When the Include subfolders check box is cleared, the system looks only in the source directory for files to include or exclude. Otherwise, it looks in the source directory and any of its subfolders for files to include or exclude.

   {#t_CreateAnSFTPActivity__ul_jdg_rcr_vz}  
   Hinweis:  
   You can map parameter values in a test payload to variables in the Outputs tab automatically. See [automap output
   variables](https://servicenow-prod.fluidtopics.net/zQra3zyXD57jq4LB0fHzRQ "You can map parameter values in a test payload to variables in the Outputs tab automatically.").

## Nächste Maßnahme

* Use [auto-mapping](https://servicenow-prod.fluidtopics.net/zQra3zyXD57jq4LB0fHzRQ "You can map parameter values in a test payload to variables in the Outputs tab automatically.") to generate outputs and parsing rules (recommended for JDBC)
* If you do not use auto-mapping, you can manually [create output
  variables](https://servicenow-prod.fluidtopics.net/4NlOweZ9wgBtc9OOpy0QJg#t_CreateAnOutputVariable "The Outputs form in the designer contains a variable builder for creating data structures of objects and arrays.") and [create parsing
  rules](https://servicenow-prod.fluidtopics.net/jecuRsCuzIyfFDyPkB_Ehw#t_CreateAParsingRule "Populate output variables defined in a custom activity with payload data returned from an inputs test on an external host or endpoint.")
{#t_CreateAnSFTPActivity__ul_u45_vbq_xz}

## SFTP template execution parameters {#ariaid-title2}

You use execution parameters to create the input process script in the
Preprocessing form.
For descriptions of the command fields, see [Configure the SFTP execution command](https://servicenow-prod.fluidtopics.net/AUhObfohXUpBmwy_rmbBMg#t_MapSFTPVariablesToExecutionCmd "Use the input variables you created to configure the command that Orchestration executes on the SFTP target.").  
Hinweis:  
You must use the `executionParam.` prefix with all variables in this table.  
{#r_SFTPTemplateExecutionParameters__table_wl1_yxc_dr__entry__4}

| Name | Variable | Type | Usage |
|-|-|-|-|
| Command | command | String | Identifies the function of this activity. The possible commands are: * Copy file * Create directory * Get file list * Remove file or directory * Rename file or directory * Set file attributes {#r_SFTPTemplateExecutionParameters__ul_xpb_gyc_nt} |
| Source | source | String | Identifies the source host. |
| Source port | source_port | Integer | Identifies the port used to communicate with the source host. |
| Source directory | source_directory | String | Path to the source directory of the files to be moved. |
| Source files | source_files | String | Names of the files on the source to be moved. |
| Excluded files | excluded_files | String | Lists the files excluded from the operation. |
| Source file path | source_file_path | String | Path to the source files to be moved. |
| Target host | target_host | String | Identifies the target host. |
| Target port | target_port | Integer | Identifies the port used to communicate with the target host. |
| Target directory | target_directory | String | Full path to the target directory on the target host. |
| Target file path | target_file_path | String | Full path to a file or directory on the source host or on the target host. For example, this value is used in the [Rename File or Directory](https://servicenow-prod.fluidtopics.net/DII2KLhPn0PrnxL3XY6cQw "The Rename File or Directory activity renames a file or directory to a new name on an SFTP server.") activity in the activity pack. |
| Temp file postfix | temp_file_postfix | String | Temporary file name extension used by the Copy File activity when moving a file. If this field contains an extension, the source file is copied to a temporary file using target file name + temp_file_postfix, before being renamed to the actual target file. If this field is blank, the source file is copied directly to the target file. |
| Is directory | is_directory | Boolean | Indicates whether the given file path is a directory. |
| Include subfolders | include_subfolders | Boolean | Indicates whether the system looks into subfolders of the source directory for files to include and exclude. |
| File attribute uid | file_attribute_uid | Integer | User ID associated with a file or directory. |
| File attribute gid | file_attribute_gid | Integer | Group ID associated with a file or directory. |
| File attribute permissions | file_attribute_permissions | Integer | File or directory permissions for the user and group specified. |
| File attribute atime | file_attribute_atime | Integer | Access time stamp from the file attributes. |
| File attribute mtime | file_attribute_mtime | Integer | Modification time stamp from the file attributes. |
| File attribute size | file_attribute_size | Integer | Size of the file, in bytes. |
| Source credential tag | source_credential_tag | String | [Credential aliases for Orchestration activities](https://www.servicenow.com/docs/access?context=c_AssignCredsOrchActivities&version=australia&pubname=australia-platform-security&ft:locale=en-US) used to run the command on the source host. |
| Target credential tag | target_credential_tag | String | Credential tag used to run the command on the target host. |
| MidCapabilities | midCapabilities | String (comma separated) | List of required MID Server capabilities. |
[Tabelle : 1. SFTP execution parameters]

{#r_SFTPTemplateExecutionParameters__table_wl1_yxc_dr}

## SFTP post-processing parameters and payload parsing {#ariaid-title3}

Use these parameters to create a post-processing script, payload parsing, and
tagging.
{#sftp-payload-parsing-tags__table_xlq_3n5_cr__entry__4}

| Name | Variable | Type | Usage |
|-|-|-|-|
| Output | output | String | Contains output data returned by the query. |
| EccSysId | eccSysId | String | Contains the Reference ID associated with the ECC Queue input message. |
| ErrorMessages | errorMessages | String | Contains the error messages returned from the query. If no error messages are returned, this value is null. |
| Tags | tags | Hashmap of tag values returned from the SSH command | Contains the tags used to extract output using the SSH commands. The tag output is delimited by double percentage signs, as in `%%tagname%% ... %%`. Set up the command using the following format: %%tagname1%% output1 line 1 output1 line 2 ... %% %%tagname2%% output2 line 1 output2 line 2 ... %% The tags returned are JavaScript hashmap objects in which each key is prefixed with `tag` appended with the tagname. {"__text__": "", "tagtagname1":"output1 line1\noutput1 line2\n", "tagtagname2":"output2 line1\noutput2 line2\n"} |
[Tabelle : 2. SFTP post-processing parameters]

{#sftp-payload-parsing-tags__table_xlq_3n5_cr}

## Configure the SFTP execution command {#ariaid-title4}

Use the input variables you created to configure the command that Orchestration
executes on the SFTP target.

### Vorbereitungen

Create the input variables you need in the Inputs form before you can advance to the Execution Command stage.

Role required:
activity_creator, admin  
Hinweis:  
You can test the JDBC connection between the MID Server and the target without having to run the activity in a workflow context. For details, see [test
template outputs](https://servicenow-prod.fluidtopics.net/9cajF_Pe381UXOE8RYlECw#test-template-inputs "You can test the input parameters of a custom activity during its development without having to run the activity in a workflow context.").

### Prozedur

1. Drag variables from the list of inputs and drop them into command fields.  
   The system formats the variable in the proper syntax for the command.  
   Abbildung : 1. SFTP execution command
2. Complete the fields shown in the table.  
   {#t_MapSFTPVariablesToExecutionCmd__table_zmv_v25_cr__entry__3}

   | Field | Description | Command |
   |-|-|-|
   | Command | Type of activity to create. The choices are: * Copy file * Create directory * Get file list * Remove file or directory * Rename file or directory * Set file attributes {#t_MapSFTPVariablesToExecutionCmd__ul_xpb_gyc_nt} Hinweis: The fields displayed on the form depend on the command selected. | All |
   | Source host | Name or IP address of the server containing the files targeted by the activity. | All |
   | Source port | Port number to use to communicate with the source server. The default port number is 22. | All |
   | Source file path | Full path to a file on a source host. | * Copy file * Remove file or directory * Set file attributes {#t_MapSFTPVariablesToExecutionCmd__ul_ryf_hsd_nt} |
   | Source directory | Path to the directory where the source files are located. | * Create directory * Get file list {#t_MapSFTPVariablesToExecutionCmd__ul_qqt_xsd_nt} |
   | Source files | Names of specific source files to include in the management action. Separate the file names in this list with semi-colons. This field supports the use of wild cards. If this field is blank, all files are included. For information about how the values in this field are affected by options in other fields, see the section below the table. | Get file list |
   | Is a directory | Check box that determines if the specified file path is a directory. | Remove file or directory |
   | Credential tag for source | Specific [Credential aliases for Orchestration activities](https://www.servicenow.com/docs/access?context=c_AssignCredsOrchActivities&version=australia&pubname=australia-platform-security&ft:locale=en-US) this activity must use to run SFTP commands on the source host. | All |
   | Credential tag for target | Specific credential tag this activity must use to run SFTP commands on the target host. | Copy file |
   | Excluded files | Names of specific source files to exclude from the management action. The activity acts on all other files found in the source directory or subfolders. Separate the file names in this list with semi-colons. This field supports the use of wild cards. For information about how the values in this field are affected by options in other fields, see the section below the table. | Get file list |
   | Include subfolders | Check box to manage the files from subfolders in the source directory. For information about how your selection affects other fields in the form, see the section below the table. | Get file list |
   | Target host | Name or IP address of the server to which the files are being transferred. | Copy file |
   | Target port | Port number to use to communicate with the target host. The default port number is 22. | Copy file |
   | Target file path | Full path to a file on a target host. | * Copy file * Rename file or directory {#t_MapSFTPVariablesToExecutionCmd__ul_axs_jsd_nt} |
   | Suffix for temporary file | Temporary suffix to use for a file name if the file already exists on a target host. If this field contains a value, the activity deletes the duplicate target file if it exists, and then copies the source file to a temporary file using targetFilePath + tempFileSuffix as the name. Upon completion, the activity renames the file to the actual target file name. If this field is blank, the activity copies the source file directly to the target file and overwrites it, if it already exists. | Copy file |
   | UID | User ID attribute to apply to a file or directory. The UID and GID values must be set together as a pair or they are ignored. | Set file attributes |
   | GID | Group ID attribute to apply to a file or directory. The UID and GID values must be set together as a pair or they are ignored. | Set file attributes |
   | Permissions | File or directory permissions to set for the user and group specified. This value must be expressed as an integer, such as 16877, which defines these permissions: rwxr-xr-x. The permissions number is an internal value returned by the Get File List activity. Typically, you first use the Get File List activity to return a list of files and their attributes. Then you can move a file from a source host to a target host and set the source file attributes on the target file. This is demonstrated in the [SFTP File Transfer workflow](https://servicenow-prod.fluidtopics.net/dYY_MvwjYid4lomUBUo18w "The SFTP File Transfer activity pack includes a scoped workflow that uses multiple activities to manage files on SFTP servers."). | Set file attributes |
   | Access timestamp | Override the timestamp when the file or directory was last accessed. The access and modification timestamps must be set together as a pair. | Set file attributes |
   | Modification timestamp | Override the timestamp when the file or directory was last modified. The access and modification timestamps must be set together as a pair. | Set file attributes |
   | Size in bytes | Size of a file, expressed in bytes. | Set file attributes |
   | Required MID Server capabilities | MID Server with the appropriate [MID Server capabilities](https://servicenow-prod.fluidtopics.net/Ixqp8gLvT6tnD2ksANEvaQ "MID Server capabilities define the specific functions of a MID Server within an IP address range.") for connecting to the source and target servers. By default, the system selects an SSH MID Server. | All |
   [Tabelle : 3. SFTP command fields]

   {#t_MapSFTPVariablesToExecutionCmd__table_zmv_v25_cr}  
   The system uses this logic to determine which files to move from the source host:
   * If the Source files field is empty, the system select all the files in the source directory. Otherwise, it only selects those files whose names match one of the file name patterns given in the field.
   * If the Excluded files field is empty, the system excludes nothing. Otherwise, it excludes those files whose names match one of the file name patterns given in the field.
   * The exclude rule has a higher preference than the include rule. A file whose name matches one of the file name patterns in the Excluded files field does not get into the selection, even though it would be selected by the include rule.
   * When the Include subfolders check box is cleared, the system looks only in the source directory for files to include or exclude. Otherwise, it looks in the source directory and any of its subfolders for files to include or exclude.
   {#t_MapSFTPVariablesToExecutionCmd__ul_pqm_mfq_yr}
3. Click Save.
4. Click Continue to advance to the Outputs stage.
{#t_MapSFTPVariablesToExecutionCmd__steps_lqh_pmg_s5}

