Attach Files to Salesforce Records
This article explains how to attach files to Salesforce records.
In Salesforce, the Attachment data object stores files attached to records. Refer to Object Attachments for more information.
You can upload attachments to Salesforce using Semarchy xDI by inserting rows into the Attachment object using a mapping. When performing this operation, you must at least map the following fields:
ParentId: ID of the parent object of the attachment. It is the ID of the object the attachment is attached to.
Body: base64 binary content of the attachment file.
Name: Name of the attachment file.
In this example, we upload a PDF file as an attachment.
First, a File metadata is created and references the PDF file.
This File metadata exposes two properties used in the mapping:
The file_name property returns the name of the file.
The binary_content property returns the content of the file in base64. That content is uploaded into a binary field in a stage.
In this stage, the Enable datatype option is selected with the datatype set to VARBINARY.
The stage field is then mapped to the Body element of the Salesforce Attachment object. The fields representing the parent record ID, the file name are also mapped.
Running this mapping uploads the PDF file and attaches it to the record identified by the Parent ID.