getAttachmentsForRecord
Returns a list of all the attachments of a record. The list is ordered by id desc. so the newest documents will be the first you will find while iterating over the array.
Parameters
Example Usages
Example 1
console.log(app.getAttachmentsForRecord("customerOrder", 123));Example 2 Filtering
let allAttachmentsForRecord = app.getAttachmentsForRecord("customerOrder", 123);
let invoices = allAttachmentsForRecord.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
Last updated