How to preserve field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 11:56 PM - edited 11-09-2023 02:18 AM
Hello!
I am updating an email notification which contains the value of the Description field. When the Description values is in paragraph form, it is displayed as one long string without the new lines in the email.
For example:
In the Catalog Task, the Description is:
The notification email script for this is:
(function runMailScript(current, template, email, email_action, event) {
template.print('<span style="font-size: 10pt; font-family: arial;"><strong>' + 'Description: ' + '</strong>' + '<p>' + current.description + '</p></span>');
})(current, template, email, email_action, event);
It is displayed in the email as:
Description:
Hello Procurement Team. Please kindly order ThinkVision P44w-10 43.4 Inch 32:10 Ultrawide Curved HDR Monitor . Best regards, SN Guy
Is there a way to preserve the formatting of the Description field value in the email notification?
Please help.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 12:00 AM
you might have to detect the new lines and replace them with <br> tags
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader