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

Weird
Mega Sage

Perhaps your portal widget has customization in it that always ads [code][/code] around the comment to allow some tags to be used in portal comments? I'd check that first.

Community Alums
Not applicable

I'm not sure about that, we are using 'Standard Ticket' configurations and the comments are added into 'Activity' tab. I do not see anything specific in there

RJ8_0-1682518586071.png

 

Well, the comments are written in a HTML editor, so that definitely could add the [code] tags automatically. Do you have the html editor also on the native UI?

Community Alums
Not applicable

@Weird No, it's the 'additional comments' journal field in the native UI.