How to copy RITM attachment to the Approval notification

chrish5
Giga Guru

Hi Community,

I’m using the below Inbound Action script to create a request item and copy the attachment from the email that triggered it to the RITM.  The problem I am having is the approval email (sysapproval_approver table) that is generated from the request does not include this attachment from the RITM even though the “Include Attachment” is checked on the approval notification that is sent.  Can someone tell me how I get the attachment on the RITM on the approval notification?    Thanks!

 

createRequest();

function createRequest() {

var cart = new Cart();

// Add in cart, sys_id for MDF Monthly Door Access Audit Report catalot item

var item = cart.addItem('d9a69b671b1b611092beea40604bcbda');

// add cart message to commments

var cartmsg = "received from: " + email.origemail + "\n\n" + email.body_text;

// Set date_needed variable to 5 days ahead of current date

var gdt = new GlideDateTime();

cart.setVariable(item,'short_description', "MDF door access audit");

// Places order and creates request

var rc = cart.placeOrder();

var ritm= new GlideRecord('sc_req_item');

ritm.addQuery('request',rc.sys_id);

ritm.query();

while(ritm.next()){

GlideSysAttachment.copy('sys_email', sys_email.sys_id, 'sc_req_item', ritm.sys_id);

  }

}

6 REPLIES 6

Hi Amit,

Thanks you for your reply.  I tried your version of code but unfortunately the attachment was not copied to the approval emails.  Any other thoughts on this?

Thank you for your reply.  I could not get this to work and I ended up putting an async before business rule in place with the below script to copy the attachments from the RITM to the approval notifications.  

 

GlideSysAttachment.copy('sc_req_item', current.sysapproval.sys_id, 'sysapproval_approver', current.sys_id);