Skip to content

Copying Attachments from Custom Forms to Data Tables ​

Overview ​

This article demonstrates how to copy attachments from custom forms in automation to attachment fields in data tables.

Scenario ​

In the automation process, when opening a custom form step that contains an attachment field named attachment, we want to copy the attachment data uploaded by users in the custom form to a specific record in a data table.

Implementation Plan ​

Add a Code Snippet step after the Open Custom Form step

javascript
var record = automatic.getVar("record"); // This record is the return value from the `Open Custom Form` step
var att = informat.table.createAttachmentStorage("attachmentTable", "attachment", record.attachment.path); //
informat.table.update("attachment", {
  attachment: att,
  id: "i7ewhbiyke22p",
});
//attachmentTable: Identifier of the target data table
//attachment: Identifier of the target data table's attachment field
//i7ewhbiyke22p: ID of a specific record in the target data table