Skip to main content

addAttachment()

Last updated 5/02/2024

Example

The following code adds attachments to a mail merge when attached to the Do Merge Record event on the mail merge form.

Add attachments to a mail merge
function DoAddSubmissionAttachments(five: Five, context: any, result: FiveError): FiveError {
if (context.Attachments && context.Attachments.length > 0) {

for (let i = 0; i < context.Attachments.length; i++) {
const attachment = context.Attachments[i];
five.addAttachment(five.toDataURL('application/pdf', attachment.file), attachment.name);
}
}

return five.success(result);
}