UploadDocument
Uploads a document to Salesforce, making it available in the document repository.
Stored Procedure-Specific Information
This stored procedure uploads a Document to a Salesforce folder.Examples
Upload document to folder:
EXEC UploadDocument FolderId = '00l5Y000004PPvnQAG', Name = 'testfile.txt'
Upload document with file path:
EXEC UploadDocument FolderId = '00l5Y000004PPvnQAG', FullPath = 'C:\Documents\testfile.txt'
Parameters:
- FolderId - The ID of the Salesforce folder to upload the document to (required)
- Name - The name for the uploaded document
- FullPath - The full path to the file to upload
Output columns include:
- Id - The ID of the created document
Uploading Single Files or Single Folders
To upload a single document, specify the FullPath:EXEC UploadDocument FolderId = '0018Z00002nz4TkMAR', FullPath = 'C:\csv samples\mycsvfile.csv'To upload all documents in a single folder, use FolderPath:
EXEC UploadDocument FolderId = '0018Z00002nz4TkMAR', FolderPath = 'C:\\csv samples'For Base64 data, you need to specify Base64Data, Title, and FileExtension:
EXEC UploadDocument FolderId = '0018Z00002nz4TkMAR', Base64Data = 'byBib2Jl', Title = 't', FileExtension = 'txt'
Uploading Multi-Valued Inputs
There are several ways to upload multiple files or folders.Using a temporary table, #TEMP:
- First insert values into temporary tables. For example:
INSERT INTO Document#TEMP (FolderId, FolderPath) VALUES ( '0018Z00002nz4TkMAR', 'C:\\TestImages' ) INSERT INTO Document#TEMP (FolderId, FolderPath) VALUES ('0018Z00002nz4TkMAR', 'C:\\csv samples' )This inserts the values into a table in memory. - Then reference that same table when executing the stored procedure:
EXEC UploadDocument DocumentTempTable = 'Document#TEMP'
This approach has the advantage of avoiding arbitrary parameters as inputs to the stored procedure.
Input
| Name | Type | Description |
| FullPath# | String | The full local path to the document to upload. Required if Base64Data is not provided. Only one of FullPath or FolderPath should be specified per upload operation. |
| Base64Data# | String | Base64-encoded string representing the contents of the document. Required if FullPath is not provided. Enables uploading without relying on a local file path. |
| Name# | String | The name to assign to the document in Salesforce. If not specified, the file name from FullPath is used. Required when uploading via Base64Data. |
| FolderId# | String | The ID of the folder where the document will be stored. This field is required for all uploads. |
| FolderPath# | String | Path to a local folder containing documents to be uploaded in batch. Only one of FolderPath or FullPath should be specified for a single operation. |
| Description# | String | Optional description of the document. Limited to a maximum of 255 characters. |
| DocumentTempTable | String | Temporary table used for uploading multiple Document records in batch. Each row should include inputs such as FullPath, Base64Data, or Name. |
Result Set Columns
| Name | Type | Description |
| Id | String | The ID of the document that was successfully uploaded to Salesforce. |