Copy Email Template to work note

Siddhi5
Tera Contributor

Hi,
I have following requirement:
When an email is sent from a new client template then the email content should be copied into work note of that incident record.

1 ACCEPTED SOLUTION

Sonu Parab
Mega Sage
Mega Sage

Hi,  Create After insert Business rule on sys_email table.

 

--> Add following condition - Target table is incident
--> Use below script to copy the content in the work note.


var rec = new GlideRecord(current.target_table);
rec.addQuery('sys_id', current.instance.toString());
rec.query();

if (rec.next()) {

rec.comments = '[code]'+current.body+'[/code]';
rec.update();
}

View solution in original post

1 REPLY 1

Sonu Parab
Mega Sage
Mega Sage

Hi,  Create After insert Business rule on sys_email table.

 

--> Add following condition - Target table is incident
--> Use below script to copy the content in the work note.


var rec = new GlideRecord(current.target_table);
rec.addQuery('sys_id', current.instance.toString());
rec.query();

if (rec.next()) {

rec.comments = '[code]'+current.body+'[/code]';
rec.update();
}