In last month’s post, we examined how one global company needed to transmit FTP files securely from the East Coast of the United States to Dublin, Ireland.
Now, let’s look at a detailed outline of the task, actions, steps and configuration components utilized to create the automation solution.
If you recall, the company’s requirements were as follows:
- Prepare the files by adding a high level of security encryption.
- Add the current date and time to the encrypted files.
- Upload the files to an FTP site in Dublin based on three characters in the naming convention.
- Send an email notification upon successful completion of the task process with the names of the files uploaded.
The task consists of the AutoMate and BPA Server cryptography encryption; FTP login, upload and logoff; Loop Files; Flow control, If Text Contains logic; and Send email actions.
In the screenshot below, we have a modified version of the AutoMate task (the same task can be used in BPA), that is comprised of 27 steps with 6 regions. The regions are expanded for evaluation and review.
For readers new to AutoMate and BPA, a region is a component used within a task for categorizing specific steps based on common functionality. You can use regions to better organize your task by expanding the steps that you need to focus on, while the rest may be collapsed and hidden from view.
Region 1: Variables
In steps 2-5, we need to define and format a few variables.
Step 2: a variable called “VAR_DateStamp” is created to use in conjunction with the Format Current Date and Time action created in Step 3.
- Step 3: formats the date and timestamp to the current year, month and day, e.g. 20120418.
- Step 4: another variable is created called “VAR_FilenameOnly” to use in the encryption portion of the task.
- Step 5: the last variable created is called VAR_FilesUploaded (used for creating a list of the files uploaded to send in the email notification action).
In Step 6, we use the “FTP login" action to simply login onto the FTP site and establish an FTP session for the purpose of uploading files later in Steps 14, 18 and 22.
Note that in the FTP action shown, the FTP host and login credentials are entered and the FTP, SFTP Connection Type, Port and SFTP Version are configured in order to start the logon transaction.
In Step 7, the “Loop Files” action is used to loop through the files in the folder specified that contains the list of files to be uploaded . In this action, a dataset is used to get the file-name value for encryption. The dataset is named “DS_File”. The option to only retrieve the filename is selected to exclude the file path.
NOTE: Two folders are used throughout the entire task. I removed the folder names and renamed the Contract folder for customer confidentiality.
Folder 1 \\foldername\subfolder\Contract\export
Folder 2 \\foldername\subfolder\Contract\export \Encrypted
Regions 2: GetFilenameOnly
In Step 8, a GetFilenameOnly region is defined to use in conjunction with Step 9. This is where a “Set Variable” action sets the VAR_FilenameOnly variable to the value retrieved from the dataset created in Step 7. After running the step within the task, the DS_File dataset assigns the dataset value DS_File.Name to the file name.
Region 3: Encrypt File
Step 10 begins the encryption process with another defined region to separate the encryption step.
Although only one “Cryptography” action is used within the region, it is a powerful action handling multiple configuration components for security.
Here we select the “Encrypt” activity, specifying the file source using the path\filename and the destination path\filename. The dataset DS_File.Name value, VAR_FilenameOnly and the VAR_DateStamp variables are used to create and move the new encrypted file names to the folder\subfolder\contract\export\encrypted folder. The encryption type is set to OpenPGP public key utilizing a CAST5 Symmetric Algorithm. In addition to the public and private key rings, specifications with the email recipients’ identifier are associated with the keys. For even more security, the compression algorithm is zipped using a WinZip format along with the new features available in PGP version 6.5 and higher.
The files in the folder use the following naming convention before encryption:
Here are the same files after the encryption process:
Regions 4-6: Upload File
There are three regions comprised of steps 12-23 that start a repetitive file upload process based on the actual file naming conventions using flow control logic and FTP actions.
- Step 13 starts to parse through the files within the loop, taking files containing “ABC” in the filename.
- Step 17 is designed for “DEF” files.
- Step 21 is designed for “XYZ” files.
In each of these steps, the Flow Control “If Text Contains” action, utilizes the VAR_FilenameOnly variable to look for the named ABC text for file upload identification. Once the file is identified, it is uploaded to the FTP site. (Note: all “If” actions end with an “End If” within the task to stop the process.)
In Steps 14, 18 and 22, the “FTP upload” transfers the files to the FTP site. In the “FTP” action, the encrypted folder in the local file area is used, and the remote file designates the folder corresponding with the file-naming convention identifier used in the “If Text Contains” action e.g. ABC.
In Step 24, the “Set Variable” action is used to set the VAR_FilesUploaded variable to create a list of all the files uploaded. The VAR_FileUploaded list is sent via email at the end of the task.
In the final steps of the task, an “End Loop” associated with the Loop Files action (set up in Step 7), closes the loop processing in Step 25. An “FTP Log Off” action logs off the FTP site and closes the FTP session for Step 26.
The last step is a “Send Email” action containing the list of files uploaded that were generated from the VAR_FilesUploaded variable set in Step 24.
Now that you have a thorough description of automating cryptography and FTP, go and co-create an amazing task in AutoMate or BPA.