Include attachment from Request in OOTB Approval Email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2024 02:47 PM
I have a catalog item with attachments enabled, and I want to be able to include those attachments in the OOTB Approval Email. I want to do this without using the 'Include attachments' checkbox in the 'What it will contain' tab on the Notification. Since I only want to do this for a few catalog items and not all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2024 11:13 PM
Hi @David2001
You can find the solution here.
Does this needs to be sent only for specific approval records or for all scenarios of approval record?
If there is a need for all approval notifications then you can simply use the Include Attachments checkbox available at each notification level. You can find that in the What it will contains tab of the notification
If this needs to be specific then you can create a mail script as below from System Notificaiton >> Email >> Notification Email script named: getattachments
(function runMailScript(current, template, email, email_action, event) { var gr = new GlideRecord('sys_attachment'); gr.addQuery('table_sys_id', current.sysapproval); //gr.addQuery(''); //apply additional query here to restrict it to specific approval records gr.query(); while (gr.next()) { template.print('Attachments: <a href="http://' + gs.getProperty("instance_name") + '.service-now.com/sys_attachment.do?sys_id=' + gr.sys_id + '">' + gr.file_name + '</a>\n'); } })(current, template, email, email_action, event);
Then call the mail script in the notification body in format
${mail_script:getattachments}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2024 10:59 AM
I enabled the Include Attachments checkbox but it still doesn't include the attachments in the emails sent.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2024 11:33 AM
Hi @David2001 ,
If this needs to be specific then you can create a mail script as below from System Notificaiton >> Email >> Notification Email script named: getattachments
(function runMailScript(current, template, email, email_action, event) { var gr = new GlideRecord('sys_attachment'); gr.addQuery('table_sys_id', current.sysapproval); //gr.addQuery(''); //apply additional query here to restrict it to specific approval records gr.query(); while (gr.next()) { template.print('Attachments: <a href="http://' + gs.getProperty("instance_name") + '.service-now.com/sys_attachment.do?sys_id=' + gr.sys_id + '">' + gr.file_name + '</a>\n'); } })(current, template, email, email_action, event);
Then call the mail script in the notification body in format
${mail_script:getattachments}
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda