Email notifications sent for additional comments updates to users have [code] tags

Community Alums
Not applicable

Email notifications sent for additional comments updates to users have [code] tags. This happens only when comments are added to the incident from service portal, comments added from native UI works fine. Could I get some help here please

 

Email template Script:

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

template.print(current.comments.getJournalEntry(1));

})(current, template, email, email_action, event);

 

1 ACCEPTED SOLUTION

Ok, so the portal comment field probably adds the code tag automatically so that it can show correctly any formatting on the messages.
You could either modify the notification to use a email script and remove the code tags or create a before insert BR that checks the body for [code] and [/code] and replaces those with "" for example. Something like:

current.body = current.body.replace("[code]", "").replace("[/code]", "");

Give that a try and see if it works.

View solution in original post

7 REPLIES 7

Ok, so the portal comment field probably adds the code tag automatically so that it can show correctly any formatting on the messages.
You could either modify the notification to use a email script and remove the code tags or create a before insert BR that checks the body for [code] and [/code] and replaces those with "" for example. Something like:

current.body = current.body.replace("[code]", "").replace("[/code]", "");

Give that a try and see if it works.

This doen't work

What kind of script are you using? What does your message HTML look like?
For template print you might just as well add the replace in the email script as well if you have one.