// Process the response returned by the request script
// The 'answer' variable from the request script is passed in here as the 'response' parameter
(function (poll_request, poller, response, params) {
// Establish the environment
var poll_helper = new x_snd_eb.PollHelper(poll_request);
'Incident : ' + params.int_ref,
'- Attachment file name: ' + params.attachment.file_name,
'- Attachment id: ' + response
// The response should be the sys_id of the created attachment
params.attachment.data = '<x-attachment-data sys_id="' + response + '" />';
// Build the payload for Unifi
correlation_id : params.int_ref,
attachment : params.attachment
// Submit the message into Unifi
poll_helper.processInbound({
message_name : 'AddAttachmentInbound',
payload : JSON.stringify(payload)
poll_request.response_status = info.join('\n');
})(poll_request, poller, response, params);