Email client template for send/receive email

Hafsa1
Mega Sage

I want to add all email received on case to email client while composing it. As of now if user send email to case it gets attached in activities "email received" in work notes

Hafsa1_0-1734344773786.png

When we use email client(...) to send email from that particular case then , all emails from case should get attached to this email. What can be done for it?

Hafsa1_1-1734344883408.png

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Hafsa1 

are you saying currently email sent using email client template are not shown in activity logs?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hafsa1
Mega Sage

they are shown in activity log. But the requirement is when someone use email client to send email, all emails sent/received should get added to email client as email chain before sending.

Jason Williams
Kilo Sage

Hi @Hafsa1 did you solve this issue?
I am looking into a similar requirement?

@Jason Williams 

create notification email script like below:

(function runMailScript(current, template, email, email_action, event) {

        // This code is for only received email
        var gr = new GlideRecord('sys_email');
        gr.addQuery('target_table', <your table name>);
        gr.addQuery('type', 'received');
        gr.addQuery('instance', current.sys_id);
        gr.orderByDesc('sys_created_on');
            gr.query();
            while (gr.next()) {
                template.print(gr.body_text);
            }

        })(current, template, email, email_action, event);
 
then use this script in "email client template" for that particular table.