SF_DownloadBlobs downloads the binary content of a salesforce object (Attachment, Knowledge Article etc.) into a directory on the SQL Server machine. SF_DownloadBlobs uses the salesforce Bulk API and consumes 1API call per file downloaded. Make sure you have enough daily API calls in your salesforce org prior to running SF_DownloadBlobs.
SF_DownloadBlobs takes as input a local SQL Server table that is designated as the “input” table:
Input Table
• Holds the records Ids of a Salesforce object that contains binary content on salesforce.
• Input table name prefix must be the name of a valid Salesforce object. (Ex.- Attachment and Attachment_Test are valid, AttachmentTest is not valid)
• Input table must contain the Id field of the Salesforce object, all other fields are ignored.
• Input table must contain at least one record
• The input table can be the table created by SF_Replicate or a table you create manually.
SF_DownloadBlobs is a stored procedure that creates files in a local directory with the contents of the binary field(s) of a Salesforce object.
File Name
The file name is based on the following template:
Id_fieldName.File
For example, consisder the following file name: 00P6000000BR8e1EAD_body.File
This file belongs to the attachment with id 00P6000000BR8e1EAD and is the binary contents of the body field.
Syntax
exec SF_DownloadBlobs ‘table_server‘,’input_table’
where table_server is the name of your linked server and input_table is the name of a valid input table.
The following example downloads the binary files(s) of the Attachment table into in a local directory on the server called the “Blob Directory“. This example uses SF_Replicate to create the input table.
Instructions
- Create the input table using SF_Replicate. Normally, the Body column of the local Attachment table is null because the SF_Replicate does not download the binary content.
- exec SF_Replicate ‘SALESFORCE’, ‘Attachment’
- Create the Blob Directory:
- Run the DBAmp Configuration Program
- Navigate to Configuration/Options Dialog
- Create a Blob Directory using the browse button
- Run the SF_DownloadBlobs stored procedure to create files containing the binary field(s) of the Attachment object in the Blob Directory: exec SF_DownloadBlobs ‘SALESFORCE’, ‘Attachment’
- After execution, the Blob directory contains the individual Attachment files.
Note
The Base64 Maximum Field Size registry setting in the Registry Settings dialog on the DBAmp Configuration Program must be set to 0.