...
Table of Contents |
---|
Attachments
...
...
readAttachment
Info | |
---|---|
false |
Code Block |
---|
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 }); |
Note | |
---|---|
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. Panel | |
queryAttachment
Info | |
---|---|
false |
Code Block |
---|
var request = {
"type" : "queryAttachment",
"data" : {
"filter" : "ParentId = '001234567891234'"
}
};
bridge.sendRequest(request, function (responseData) { alert('The first Attachment is located here: ' + responseData.data[0].FileURL }); |
Note | ||
---|---|---|
The Panel | | title |
createAttachment
Info | icon | false
---|
The |
Code Block | |
---|---|
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
}
}); panel | title |
createAttachmentFromFilePath
Info | |
---|---|
false |
Code Block | |
---|---|
var request = {
"type" : "createAttachmentFromFilePath",
"data" : {
"ParentId" : "001234567891234", // Required
"Name" : "AttachmentName.jpg", // Optional
"ContentType" : "image/jpeg", // Optional -- manual entry of content type
"FilePath" : "/Valid/Path/To/File.Jpg" // Required
}
};
bridge.sendRequest(request, function (responseData) {
if (responseData.type == "createAttachmentResponse") {
alert('Created Attachment Id: ' + responseData.data);
}
else {
// error code
}
}); panel | title |
createAttachmentFromCamera
Info | icon | false
---|
The |
Code Block |
---|
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 } }); |