- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2025 05:12 AM
Hi
Is there any option to send the last attachment from multiple attachments in the email notification?
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2025 08:53 AM
you can use email script but it will only include link to the latest attachment and not the actual file.
if you want to include file in outbound email then link I shared should work
If you want to include link to the latest attachment added to record then use email script
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
template.print('Latest attachment link <br/>');
var gr = new GlideRecord("sys_attachment");
gr.orderByDesc('sys_created_on');
gr.addQuery("table_sys_id", current.sys_id);
gr.setLimit(1);
gr.query();
if (gr.next()) {
var instance_name = gs.getProperty('glide.servlet.uri');
template.print('Click <a href="' + instance_name + 'sys_attachment' + '.do?sys_id="' + gr.sys_id + '">' + gr.file_name + '</a> to view the Attachment.');
}
})(current, template, email, email_action, event);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2025 05:35 AM
there is no direct OOTB way for this
But I have shared solution on how to include latest attachment from record in outbound email
see this link and enhance your script
Adding latest attachment from sys_attachment table to sys_email record
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2025 08:10 AM
@Ankur Bawiskar
can we use email scripts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2025 08:53 AM
you can use email script but it will only include link to the latest attachment and not the actual file.
if you want to include file in outbound email then link I shared should work
If you want to include link to the latest attachment added to record then use email script
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
template.print('Latest attachment link <br/>');
var gr = new GlideRecord("sys_attachment");
gr.orderByDesc('sys_created_on');
gr.addQuery("table_sys_id", current.sys_id);
gr.setLimit(1);
gr.query();
if (gr.next()) {
var instance_name = gs.getProperty('glide.servlet.uri');
template.print('Click <a href="' + instance_name + 'sys_attachment' + '.do?sys_id="' + gr.sys_id + '">' + gr.file_name + '</a> to view the Attachment.');
}
})(current, template, email, email_action, event);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2025 08:20 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader