getAttachmentById
Gets and attachment by its unique id.
Parameters
id - id of the attachment
Example Usages
app.getAttachmentById(1234);
let allAttachmentsForThisRecord = app.getAttachmentsForCurrentRecord();
let invoices = allAttachmentsForThisRecord.filter((singleAttachment) => {
return singleAttachment.documentTypeId == 2;
}); //We assume, that there is just one invoice
let attachmentBlob = app.getAttachmentById(invoices[0].id);
app.printBlob(attachmentBlob);
Return Values
The function returns a Promise that will eventually resolve to either a Blob (if the fetch is successful) or null (if there is an error or the status is not 200).
Last updated
Was this helpful?