Pulsar Attachment API

Single Attachment Actions

readAttachment

This API call returns an array containing a dictionary with the Attachment object matching the Id specified.

Important returned fields:

  • Body – base64 encoded attachment data (if ReturnBase64Data is not false)

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

  • FileURL – local URL to the attachment file

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

Related Pulsar Settings:

var request = { "type" : "readAttachment", "data" : { "Id" : "001234567891234", // Required attachment Id "ReturnBase64Data" : false // Optional, default true. If false you will still have access to URL of attachment } }; bridge.sendRequest(request, function (responseData) { alert('The Attachment is located here: ' + responseData.data[0].FileURL });

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

queryAttachment

This API call returns an array of dictionaries representing Attachment objects matching the specified filter. The filter is specified in sqlite where clause format, and is applied to objects in the Attachment table only. For example "(ParentId = '001234567891234')" will return all Attachments where the ParentId field is set to 001234567891234. This method will return URLs to a cached version of the Attachment file, but will not return the file data directly as in readAttachment.

Important returned fields:

  • FileURL – local URL to the attachment file

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

Related Pulsar Settings:

var request = { "type" : "queryAttachment", "data" : { "filter" : "ParentId = '001234567891234'" } }; bridge.sendRequest(request, function (responseData) { alert('The first Attachment is located here: ' + responseData.data[0].FileURL });

createAttachmentFromCamera

var request = { "type" : "createAttachmentFromCamera", "data" : { "ParentId" : "001234567891234", // Required "Name" : "AttachmentName.jpg" // Optional } }; bridge.sendRequest(request, function (responseData) { if (responseData.type == "createAttachmentResponse") { alert('Created Attachment Id: ' + responseData.data); } else { // error code } });

Create Actions on Multiple Attachments (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

createAttachmentBatch

createAttachmentFromFilePathBatch

 

Create Actions on Single Attachments

createAttachment

createAttachmentFromFilePath