Urjent!!!! html tags are displayed in the notification preview

Tejaswini9
Tera Expert

Hello,

I am facing an issue in email preview, the html tags are displayed in email notification when the content type is "html/plain text" as well

find_real_file.png

and this is the code i have written in "Message Text" 

<b><font color='Red'>*Note - Please do not reply to this email. Click on the approved or deny icon below to choose the appropriate action. Once selected an email will be generated. Select send to complete the process.</font></b>

<b>Requested Item Number:</b> ${sysapproval}
<b>Item Requested:</b> ${sysapproval.short_description}
<b>Request date:</b> ${sysapproval.sys_created_on}
<mail_script>
template.print("Summary of Requested items:\n");
var item = new GlideRecord("sc_req_item");
item.addQuery("sys_id", current.sysapproval);
item.query();
while(item.next())
{
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '') {
template.space(4);
template.print(' ' + vs.get(i).getLabel() + " : " + vs.get(i).getDisplayValue() + "\n");
}
}
}
</mail_script>
</mail_script>
</mail_script>
<hr/>

${mailto:mailto.approval}
<hr/>
${mailto:mailto.rejection}
<hr/>
<b>Click here to view Approval Request:</b> ${URI}

Regards,

I really dont know what is the error and can anyone help me with this please, This is bit urjent for me.

Many thanks in advance.

1 ACCEPTED SOLUTION

you have to use message html.

you don't need to use the html tags ,it creates them automatically.

You can use the source code in the html editor and paste your html code.

 

Difference between Message text and message html.

 

 

Message HTML

Enter the content of the email notification message. The message can include variables from the Select variables column.

Variables map to column names available from the notification table, its parent tables, and reference tables. Use variables to include values from a record in the table such as an incident short description or comments and work notes.

The Message HTML field is visible only if you set the content type to HTML and plain text or HTML only.

If empty, the system uses the Message HTML value from the Email template. If you enter a value in this field, it overrides the template value.

To prevent adding extra <p> and <div> elements to your email notifications, see the blog post Extra line spacing with paragraph tags in email client by a ServiceNow employee in the ServiceNow Now Community.

Message Text

Enter the notification message to send in plain text. This field is visible only if you set the content type to HTML and plain text or Plain text only.

If empty, the system uses the Message Text value from the Email template. If you enter a value in this field it overrides the template value.

View solution in original post

9 REPLIES 9

Community Alums
Not applicable

Assuming that you have added this HTML content to the Message text field on the Notification (sysevent_email_action) table, you should remove that and use the Message HTML field instead. If this is not of the form for the Notification table (it should be by default), you may need to add it or even check the "Sys version" field is set to "V2" on your notification record?

Let me know if this helps, can provide more info if required. 

I have used Message text

find_real_file.png

Do you mean i should write the code in mail script and use the mail script in Message Html section.

 

you have to use message html.

you don't need to use the html tags ,it creates them automatically.

You can use the source code in the html editor and paste your html code.

 

Difference between Message text and message html.

 

 

Message HTML

Enter the content of the email notification message. The message can include variables from the Select variables column.

Variables map to column names available from the notification table, its parent tables, and reference tables. Use variables to include values from a record in the table such as an incident short description or comments and work notes.

The Message HTML field is visible only if you set the content type to HTML and plain text or HTML only.

If empty, the system uses the Message HTML value from the Email template. If you enter a value in this field, it overrides the template value.

To prevent adding extra <p> and <div> elements to your email notifications, see the blog post Extra line spacing with paragraph tags in email client by a ServiceNow employee in the ServiceNow Now Community.

Message Text

Enter the notification message to send in plain text. This field is visible only if you set the content type to HTML and plain text or Plain text only.

If empty, the system uses the Message Text value from the Email template. If you enter a value in this field it overrides the template value.

Hi,

Thank you for your help, i have written an email script and called it in the Message HTML and it works fine.

DirkRedeker
Mega Sage

Hi

If you write "<b>" in Message Text, it will be shown like that.

Obviously, you wanted it to show up.

Try to capture your text with desired formatting in the HTML field.

BR

Dirk