Pulsar Attachment API

Attachments

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 });

createAttachment

var request = { "type" : "createAttachment", "data" : { "ParentId" : "001234567891234", // Required "Name" : "AttachmentName.jpg", // Required "Body" : "AABBCCDDEEFF...", // Base64 data -- Required "ContentType" : "image/jpeg" // Optional -- manual entry of content type } }; bridge.sendRequest(request, function (responseData) { if (responseData.type == "createAttachmentResponse") { alert('Created Attachment Id: ' + responseData.data); } else { // error code } });

createAttachmentFromFilePath

createAttachmentFromCamera