getLastAttachmentByRecordId
Retrieves the most recent attachment for a given record ID as a blob.
try {
// Retrieve the last attachment for a record with ID 123 in the 'Orders' table, ignoring document type filter
const blob = app.getLastAttachmentByRecordId('Orders', 123, 0);
if (blob) {
app.printBlob(blob);
} else {
console.log('No attachment found for the given record ID.');
}
} catch (error) {
console.error('Error retrieving attachment:', error);
}Last updated