- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 07:41 AM
Hi,
I have a requirement to allow users to add attachments from the existing incident record when using the email function.
I have come across articles, which leverage before BR and attaches all the attachments to the email.
I do not want that, In the email when i click on the attachment icon, I should see all the attachments from the incident there.
Also I have seen BR scripts which duplicate the attachment when sent.
Please help.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2020 10:11 PM
can you try with below code.
After "Insert" business rule on "sys_email" table .
script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
GlideSysAttachment.copy(current.target_table, current.instance ,'sys_email', current.sys_id);
})(current, previous);
See if its not creating duplicate attachment on email client.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 07:45 AM
Hi,
If you wish to send files added as attachment via email notification then you need to use Include Attachment checkbox on notificataion
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 08:37 AM
Hi Ankur, I dont want notifications always attached, when sending emails, only when the attachment icon in the email window is clicked, then they should be able to be selected from there.
Hope that makes sense.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 08:58 AM
Hi,
So are you saying when user clicks the Email client icon the attachments from the existing record should be seen there automatically?
Are you saying you want attachments to be copied to that form?
refer this article for help
Copy attachments to Email Client Template (...)
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 09:04 AM
Hi Ankur, yes that's what I want.
I have already followed the article you have mentioned but that attaches the attachment to the email, rather than me clicking on the attachment icon and selecting.
It also duplicates the attachments if i have 2 or more attachments.
So this is not a viable solution.
Can you advise a revised BR of that which I can use to meet my requirements please?
Before insert/update BR being used from the article is:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var lookforatt=new GlideRecord('sys_attachment');
lookforatt.addQuery('table_sys_id',current.instance);
lookforatt.query();
while(lookforatt.next())
{
GlideSysAttachment.copy('incident', current.instance, 'sys_email', current.sys_id);
}
})(current, previous);