Work Notes & Additional comments , email notification does not show comments in sequence

Naresh_5120
Tera Contributor

I have configured a watch list notification so that when a Work Notes or Additional Comments are added by anyone in tickets, watch list members should be receiving email notification. This is working as expected , however i am facing a problem with sequence of comments , Example - Work Notes & Additional notes comments shows separate in email notification, refer attached screenshot for more details.

Can anyone help me to understand , how can I receive email notification in sequence for example when work notes are added it should show at top and same should work for additional notes are added.

find_real_file.png

4 REPLIES 4

Dubz
Mega Sage

You could use a mail script to glide into the sys_journal_field table and return work notes and comments in order, don't think there's any other way to do it.

var gr = new GlideRecord('sys_journal_field');
gr.addEncodedQuery('element=comments^ORelement=work_notes^element_id=' + current.sys_id);
gr.orderByDesc('sys_created_on');
gr.setLimit(6);
gr.query();
while (gr.next()){
template.print(gr.value);
}

Naresh_5120
Tera Contributor

Thanks David,

I have tried this but seems still i am doing some mistake, can you please help me with navigation steps to use a mail script to glide into the sys_journal_field table

write that script in a mail script, call the mail script something like combined_journal_entries then add it to the message body with syntax ${mail_script:combined_journal_entries}

If you still have issues please elaborate on what they are and what debugging you've done.

Naresh_5120
Tera Contributor

Hi David,

Sorry for responding late, what i have tried is, as per your suggestion, i have used your script and created email script called  "combined_journal_entries" and added in message body of Watchlist notification.

 

find_real_file.png