UploadAttachment
Uploads an attachment and associates it with a specific Salesforce record.
Note: This procedure makes use of indexed parameters. Indexed parameters facilitate providing multiple instances a single parameter as inputs for the procedure.
Suppose there is an input parameter named Param#. To input multiple instances of an indexed parameter like this, execute:
EXEC ProcedureName Param#1 = "value1", Param#2 = "value2", Param#3 = "value3"
In the Input table below, indexed parameters are denoted with a '#' character at the end of their names.
Input
| Name | Type | Accepts Input Streams | Description |
| ObjectId | String | False | The ID of the Salesforce object (such as an Account or Opportunity) to associate the uploaded file with. This field is required. |
| FullPath | String | False | The full file path of the document to upload from your local system. Required if Base64Data is not provided. Only one of FullPath or FolderPath should be specified per upload. |
| Base64Data | String | False | The full contents of the file, Base64-encoded. Required if FullPath is not provided. Useful for programmatic uploads without file system access. |
| FileName | String | False | The name to assign to the uploaded attachment. Required if using Base64Data. If using FullPath, the file name will be derived automatically if this is left blank. |
| FolderPath | String | False | Path to a folder containing multiple files to be batch uploaded. Either specify FolderPath or FullPath, not both. |
| Attachments | String | False | Accepts a temporary table name or an aggregate (JSON) containing multiple attachment records for batch uploading. Each row must include upload details such as ObjectId and FullPath or Base64Data. |
| Content | String | True | The content of the file as an InputStream. Used when FullPath is not specified. Typically for programmatic uploads. |
Result Set Columns
| Name | Type | Description |
| Id | String | The unique ID of the newly uploaded attachment in Salesforce. |
| Success | Boolean | Indicates whether the file upload succeeded (true) or failed (false). |
| FileIdentifier | String | Identifies the file for this result row. Contains the full file path when FullPath or FolderPath was used, or the file name when Base64Data or Content stream was used. |
| Errors | String | Error messages returned by Salesforce if the upload failed, including error codes and descriptions. |