Configure the workflow
The upload of the files can be done in a fully automatic process, or in a 2-step process. The map/reduce script (Create Generic SFTP Record) will create automatically for each found file in the saved search an “SFTP - Generic File Record” record. This record will contain the actual file to upload and will hold the upload status. Both options will be explained in this section. Full Automatic Upload.
Paste in the global search from NetSuite the value “SFTP - Generic File Record” and select the option “Page: New SFTP - Generic File Record”. On this page click on the field level help for the field labeled “Upload Configuration”. The pop-up that opens shows the current internal ID of this field. This ID is needed during the script deployment.
Before the workflow can be created a workflow action must be deployed if this isn’t yet present. The workflow action script defines from where the workflow must take the upload configuration that must be used to upload the related data file. To deploy the script navigate to Customization > Scripting > Scripts. Set the “Type” filter to Workflow Action and filter “From Bundle” to 297112. Open the script with the name “SFTP Connector Uploader”.
On the page that opens press the button “Deploy script”. On the deployment page set the following fields:
- Applies To: Select here your record, in this example, we use the “SFTP - Generic File Record”
- Status: Set this to “Released”
- Tab Audience: Select here all, or limit as you would like.
- Tab Parameters: Paste the field ID from the field ID retrieved in the step above
- Press Save
To enable a full automatic upload a workflow is needed that triggers on record submit when the “SFTP - Generic File Record” is created by the script. To create this workflow navigate to Customization > Workflow > Workflows > New. Enter the following information:
- Name: Enter a name that explains the workflow
- Record type: select here the record “SFTP - Generic File Record”
- Release status: select here releases
- On created: must be checked
- On view or update: must be checked
- Trigger type: select here “After record submit”
Press the blue button “Save” to proceed with the configuration of the workflow. After the workflow is saved press the grey button “New State”. Double click on the newly added state and enter as name the value “Move File” and press save. Also, double click on the original state and rename this to “Upload File”. Now drag the “End” from the state “Upload File” to the state “Move File”. The screen should now look as follow.
Click now on the state “Upload File” and on the right-hand side at the bottom of the screen press on the button “+ New Action” to add a new action and select the option “SFTP Connector Uploader (Custom)” and press directly the blue button “Save” without changing any settings.
Now click on the state “Move Files” and add an action to it and select here the option “SFTP Connector Move File (Custom)” and press directly the blue button “Save” without changing any settings.
Select again the state “Move Files” and add another action. In the options list choose the option “Set Field Value”. In the popup that opens set only the following values:
- Field: select here the field “Processed”
- Static value: enable the radio button
- Select the checkbox “Checked”.
Press the blue button labeled “Save”. Now select again the state “Move Files” and add the last action. Select in the options list “Add button”. Provide a name in the field “Label” for the button. We recommend naming the button “Re-upload file”. Press the blue button labeled “Save”.
Now drag the end from the state “Move File” to the state “Upload File”. Press double on the arrow and select in the field “Execute on button” the name of the button added in the previous step.
Save the record to make it active.