SF_LoadBlobIds


SF_LoadBlobIds


Usage 

The RestAPI of Salesforce allows you to push binary blobs larger than 20 MB. The SF_LoadBlobIds stored procedures allows you to specify blob Ids in an input table to push to Salesforce. You can use SF_LoadBlobIds with only

  • Update and Insert operations

  • ContentVersion, Attachment, and Document objects

SF_LoadBlobIds inspects the Id column of the input table and tries to match each Id value with a binary blob file in the Blob directory. You specify the Blob directory on the Settings page of the DBAmp Configuration program on the server. The binary blob files that exist in the Blob Directory are downloaded by the SF_DownloadBlobs stored procedure.

Follow these steps to follow to push binary blobs to Salesforce:

  1. Use SF_DownloadBlobs to download the binary blob files you want to push to Salesforce into the Blob directory.

  2. Create the input table that will contain the records to push to Salesforce.

  3. Populate the input table with the records to push to Salesforce. The Id values need to be the Salesforce Id of the record to push. NOTE: This Id needs to match the Id prefix of a binary blob file in the Blob directory. If there are no files that match an Id specified in the input table, SF_LoadBlobIds throws an error in the Result table.

Use SF_LoadBlobIds to push the binary blobs to Salesforce. For example:

 Exec SF_LoadBlobIds 'Insert', 'SALESFORCE', 'ContentVersion_Insert' 

Check the Result table for any errors that may have occurred. The Result table name is the input table name with _Result appended, for example, ContentVersion_Load_Result.

Syntax 

 EXEC SF_LoadBlobIds  operation, 𝘭𝘪𝘯𝘬𝘦𝘥_𝘴𝘦𝘳𝘷𝘦𝘳, load_SQL_Table, options  

where 

  • operation—must be Insert or Update 

  • linked_server—the linked server name

  • load_SQL_Table—must be ContentVersion, Attachment, or Document input table

  • options—valid options for SF_LoadBlobIds

Basic Example

To create an input table to supply to SF_DownloadBlobs:

  1. Create Table ContentVersion_Blobs

    (Id nvarchar(18))

  2. Insert ContentVersion record Id of binary blob to insert into Salesforce:

    Insert Into ContentVersion_Blobs (Id)

    Values (‘0683A000006HINuQAO’)

  3. Run SF_DownloadBlobs to download the binary blob file into the Blob directory for the ContentVersion record Id supplied in the input table:

    exec SF_DownloadBlobs ‘SALESFORCE’, ‘ContentVersion_Blobs’

  4. Create input table to supply to SF_LoadBlobIds:

    Create Table ContentVersion_Load

    (Id nchar(18),

    ContentDocumentId nchar(18),

    Title nvarchar(255),

    PathOnClient nvarchar(500))

  5. Populate input table with blob record you want to insert into Salesforce:

    Insert Into ContentVersion_Load (Id, ContentDocumentId, Title, PathOnClient)

    Values (‘0683A000006HINuQAO’, ‘0694S000001dfmiQAA’, ‘Test’, ‘attachexample.txt’)

  6. Run SF_LoadBlobIds to insert the blob record into Salesforce:

    exec SF_LoadBlobIds ‘Insert’, ‘SALESFORCE’, ‘ContentVersion_Load’

  7. Check the ContentVersion_Load_Result table for the Salesforce Id of the newly inserted record and any errors that may have occurred:

    Select Id, Error from ContentVersion_Load_Result