How to copy RITM attachment to the Approval notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 01:41 PM
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);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 06:51 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2023 09:39 AM
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.