Email Notification is going out with 'Code' text

Alon Grod
Tera Expert

Hi, 

Im having a problem that my notification is going out with the word 'Code' at the top and at the bottom. it happens only when I add comments or work_notes in the service operation workspace (I think its because the comments and workontes in the workspace are HTML).

This is my script: 

function runMailScript( /* GlideRecord */ current, / TemplatePrinter */ template, /Optional Emailoutbound */

email, / Optional GlideRecord / email_action,

- /* Optional GlideRecord */

 event) {

var commentorName event.parm2;

var userGr= new GlideRecord('sys_user 8 userGr.addQuery('sys_id, commentorName);

');

userGr.query();

if (userGr.next()) {

commentorName= userGr.name;

var user_name = userGr.user_name.toString();

 }




var gr new GlideRecord('sys_journal_field");

gr.addEncodedQuery("sys_created_by=+ user_name); gr.orderByDesc("sys_created on) ;

gr.query();

if (gr.next()) { var comment gr.value.toString();

template.print(commentorName+":"+comment + "\"");

(current, template, email, email action, event);

 

The email output (ttt is the comment message):

 

WhatsApp Image 2023-08-14 at 11.44.44.jpeg

7 REPLIES 7

@Ajay_Chavan this script will not remove the tags. How can I remove the tags of the 'Code'

In your mail script comment out the below line and replace it with what's below.

 

//var comment = current.comments.getJournalEntry(1);
    var comment = current.comments.getJournalEntry(1).split('\n')[1].replace(/\[code\]|\[\/code\]/g,"");