Extracting Attachments
Last updated
Last updated
Attachments can be extracted from payloads and saved before the payload is saved. This is highly recommended as it saves from storing the attachment itself in the payload on the HTTP Request record.
Attachment data should be extracted, saved as an attachment, and replaced with the attachment sys_id in the format <x-attachment-data sys_id="...">
. Unifi will automatically collect the attachment ids, create Bonded Attachments for each of them, and finally move the attachments to the target record.
We strongly recommend streaming attachments when possible. Attachments can be streamed into Unifi which bypasses the need for extraction, supports binary file sharing, and also allows for sizes up to 50MB (providing your instance and integration configuration supports this).
This is available for all new integrations from Unifi 3.0.
For more information on configuring inbound streaming, please see our How to Handle Attachments guide.
Variable | Type | Description |
---|---|---|
payload
String,Stream
The raw inbound payload object to process. Attachment data should be removed and replaced with the attachment sys_id in the format "<x-attachment-data sys_id=>
headers
Object
An object containing the request headers.
params
Object
A key-value pair object of URL parameters.
request
GlideRecord
The record of the HTTP Request [x_snd_eb_http_request]
being used.
options
Object
An object containing specific properties for processing.
options.is_stream
Boolean
True if the inbound payload is a stream.
log
,console
Object
Object containing several functions that can be used for logging. info
, warn
, error
and debug
.
error
String
The error message to return from the script. Alternatively you can simply throw a string
or Error
and the system will take care of it.