Inbound email not being converted to plain text in description for HR case for some emails
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 05:22 AM
Hi Team,
As you can see in the above screenshot, the description of this forward email which creates a new HR case in SNOW has <p> tags, which means it was not converted to plain text as expected. This is happening in rare scenarios. Could someone please help with identifying what might be causing this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 05:25 AM
Hi @Arka Banerjee ,
Please follow these links :
HTML Tags are included in email body - Support and Troubleshooting
Solved: HTML Tags Description field - ServiceNow Community
Sandeep Dutta
Please mark the answer correct & Helpful, if i could help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 05:33 AM
you can identify the inbound email action and in the script strip the tags
check this link
Handling inbound emails with HTML in RITM Description field
something like this in inbound email action script
function stripHTML(html) {
return html.replace(/<[^>]+>/g, '').replace(/ /g, ' ').replace(/&/g, '&');
}
// Usage
var body = email.body_text || stripHTML(email.body_html) || '';
current.description = body;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 06:54 AM
Thanks Ankur,
Please note that this has happened for a very miniscule no of HR cases. PFB the snippet of code which sets the description in our inbound action:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 07:04 AM
seems it's entering the IF for few of those cases and hence picking the HTML
better to strip the tags when it enters IF
var bodyText = email.body_text;
if (!bodyText) {
bodyText = email.body_html;
bodyText = bodyText.replace(/<[^>]+>/g, '').replace(/ /g, ' ').replace(/&/g, '&');
}
current.description = bodyText;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader