Skip to main content

SLAM_load_blob

Files can be loaded to ContentVersion, ContentNote, Attachment and Document in a similar fashion to loading record data. To upload files, set @api='blob'. Provide the path to the file in the binary field and ensure all other required fields are supplied. Specifically, this means:

  • ContentNote: put the path to the file in field Content
  • ContentVersion: put the path to the file in field VersionData and PathoOnClient. Salesforce requires PathOnClient for its own FileType determination
  • Attachment: put the path to the file in field Body
  • Document: put the path to the file in field Body

Example ContentVersion table:

IdTitleDescriptionPathOnClientVersionData
NULLTest Document 1Test Document 1 DescriptionC:\Speediful_SLAM_blob\demo document 1.txtC:\Speediful_SLAM_blob\demo document 1.txt
NULLTest Document 2Test Document 2 DescriptionC:\Speediful_SLAM_blob\demo document 2.txtC:\Speediful_SLAM_blob\demo document 2.txt
NULLLarge ImageLarge Image DescriptionC:\Speediful_SLAM_blob\large image.bmpC:\Speediful_SLAM_blob\large image.bmp

Example ContentNote table:

IdTitleContent
NULLdemo document 2.txtC:\Speediful_SLAM_blob\demo document 2.txt

Inserting Files

To insert files, set @api = 'blob'. Speediful will automatically manage the API selection and file upload process to ensure files of any size (up to the 2GB limit of Salesforce) are uploaded. This means the @batch_size parameter is ignored

Usage Example:

Inserting files:

CREATE TABLE ContentVersion_insert (
Id NVARCHAR(18),
Title NVARCHAR(255),
Description NVARCHAR(255),
PathOnClient NVARCHAR(255),
VersionData NVARCHAR(255)
)

INSERT INTO ContentVersion_insert(
Title,
Description,
PathOnClient,
VersionData
)
VALUES (
'Test Document 1',
'Test Document 1 Description',
'C:\Speediful_SLAM_blob\demo document 1.txt',
'C:\Speediful_SLAM_blob\demo document 1.txt'
)

EXEC dbo.SLAM_load
@sObject = 'ContentVersion',
@table = 'ContentVersion_insert',
@api = 'blob',
@operation = 'insert'

Updating files

Speediful can either update just the attributes of uploaded files (e.g. Description, Name or Title) or where permitted, update the attributes and replace the file itself.

tip

To update attributes only, use @api of 'soap', 'bulk', or 'bulkv2'. The binary field will be ignored

To replace the file, use @api = 'blob'. This instructs Speediful to upload the file along with the attributes.

Salesforce only permits Attachment and Document objects to replace the file. This type of operation is not permitted for the versioned objects ContentVersion and ContentNote - instead you must upload a new version via insert. Therefore you cannot combine @operation = 'update' with @api = 'blob' for ContentVersion or ContentNote.

Usage Examples:

Updating file attributes only:

CREATE TABLE Document_update (
Id NVARCHAR(18),
Name NVARCHAR(255),
Description NVARCHAR(255)
)

INSERT INTO Document_update (Id, Name, Description)
VALUES
('015As000007omqDIAQ', 'Updated Name', 'Updated Description')

EXEC dbo.SLAM_load
@sObject = 'Document',
@table = 'Document_update',
@api = 'bulk',
@operation = 'update'

Updating file attributes and replacing the file:

CREATE TABLE Document_update (
Id NVARCHAR(18),
Name NVARCHAR(255),
Description NVARCHAR(255),
Body NVARCHAR(255)
)

INSERT INTO Document_update (Id, Name, Description, Body)
VALUES
('015As000007omqDIAQ', 'Updated Name', 'Updated Description', 'C:\Speediful_SLAM_Blob\replacement file.txt')

EXEC dbo.SLAM_load
@sObject = 'Document',
@table = 'Document_update',
@api = 'blob',
@operation = 'update'