Salesforce Files API

In order to use the below APIs, you must enable Salesforce Files support within Pulsar. Please see "Enable Salesforce Files" for instructions for doing this. 

Single File Actions

readSFFile

This API call returns an array containing a dictionary with the ContentVersion object for the ContentDocument or ContentVersion matching the Id specified.

Important returned fields:

  • VersionData – base64 encoded file data (if ReturnBase64Data is not false)

  • ThumbBody – base64 encoded file thumbnail data (if ReturnBase64Data is not false and the file is an image)

  • FileURL – local URL to the file

  • ThumbURL – local URL to the file thumbnail (empty string if file is not an image)

Related Pulsar Settings:

var request = { "type" : "readSFFile", "data" : { "Id" : "069234567891234", // Required ContentDocument or ContentVersion Id "ReturnBase64Data" : false, // Optional, default false. If false you will still have access to URL of file "DownloadVersionData" : true, // Optional, default true. If true and online, Pulsar will attempt to download the file from the server to ensure it has the latest version. If false, it will skip this step and use the data is available locally, if it exists. } }; bridge.sendRequest(request, function (responseData) { alert('The File is located here: ' + responseData.data[0].FileURL });

Normal data reads through 'select' API will not contain Base64 file data in the VersionData field unless that field has previously been queried from Salesforce or otherwise populated with Base64 data.

queryContent

var request = { "type" : "queryContent", "data" : { /* give us all synced files attached to account with Id 001abc012345678ABC */ "filter" : "ContentDocumentId in (SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '001abc012345678ABC')", "DownloadVersionData" : true, // Optional, default true. If true and online, Pulsar will attempt to download the files from the server to ensure it has the latest version. If false, it will skip this step and use the data is available locally, if it exists. } }; bridge.sendRequest(request, function (responseData) { alert('The first File is located here: ' + responseData.data[0].FileURL });

createSFFileFromCamera

var request = { "type" : "createSFFileFromCamera", "data" : { "ParentId" : "001234567891234", // Required "Name" : "FileName.jpg", // Optional "NetworkId" : "0DB123456789123" // Optional, the NetworkId of the current Experience Cloud site- NOTE: this would be required only for your Salesforce Community Users } }; bridge.sendRequest(request, function (responseData) { if (responseData.type == "createSFFileResponse") { alert('Created ContentDocumentId: ' + responseData.data); } else { // error code } });

deleteSFFile

 

Create Actions on Multiple Files (recommended v14+)

createBatchResponse returned from batch endpoints

All of the following endpoints return a response in the format below. The response below is simplified for brevity.

Full Success – all files saved

Partial Success – some files saved

createSFFileBatch

createSFFileFromFilePathBatch

 

Create Actions on Single Files

createSFFile

createSFFileFromFilePath