Sending Multipart Attachments
Overview
Sending Multipart Attachments
Stage to Request Script
// ------------------------------------------------------------------
// Build and stream a multipart/form-data request containing attachments
// ------------------------------------------------------------------
var mp = new UnifiMultipartHelper();
// Use the current transaction as the host record for temporary
// attachments - these will be cleaned up later by an Event Action
mp.setHostRecord(transaction);
// Add each bonded attachment to the multipart body
var sender = new x_snd_eb.AttachmentSender(transaction, bond);
while (sender.next()) {
mp.addAttachment('file', sender.attachment_id);
}
// Call the service to create the multipart body as a temporary attachment
var data_attachment_id = mp.createBody();
// Prepare request to stream the temporary attachment
headers['Content-Type'] = mp.getContentType();
payload = 'sys_attachment:' + data_attachment_id;Cleaning Up Temporary Attachments
Event Action: Remove Temporary Attachments
Last updated
Was this helpful?
