- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 07-27-2022 09:48 AM
To add all the attachments in the Email Client Template please follow the below procedure:
Create a Business Rule on the sys_email table with conditions before insert.
Script :
var att = new GlideRecord('sys_attachment');
att.addQuery('table_sys_id', current.instance);
att.query();
if (att.next()) {
GlideSysAttachment.copy('<Record Table Name>', current.instance, 'sys_email', current.sys_id);
}
/*Record Table Name- Source Table name. eg:- Suppose Email template is on the Incident table then we have to mention incident as the source table*/
Please the attached screenshot to know the output.
Please mark this article helpful if it helps you.
- 3,972 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks for the info.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Rahul Raja Sami Have you written onBefore Insert BR !
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Pradyumma,
I'm using your suggest on a scoped application but I'm finding the email client is attaching each attachment from the parent record twice. Any suggestion as to why?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Cinda Craig Could you please show me your code and also please check whether you have any other script running which will be copying any attachment or not?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi!
If you'd rather it work for any table, replace '<Record Table Name>' with current.target_table, instead of putting the table directly, like this:
GlideSysAttachment.copy(current.target_table, current.instance, 'sys_email', current.sys_id);
I suggest testing whether it works as expected in the workspace.