HTML email body into the RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 01:06 AM - edited 02-27-2025 01:09 AM
I created an inbound action to create RITM
var createRITM = true; // Condition to create a RITM (assuming no duplicate check logic is required)
var curr_record;
// Check if the subject is valid to create a RITM
if (createRITM) {
// Create the cart and add the item (assuming the item ID is the same as in the sample code)
var cart = new Cart();
var item = cart.addItem('c05b5b904704e2102fa8cfba516d43b3'); // Item ID for ATK Shift Change
// Set the variables based on the email content
cart.setVariable(item, 'email_body', email.body_text); // Set email body content
cart.setVariable(item, 'desc', email.subject); // Set email subject as description
cart.setVariable(item, 'email_sender', email.from); // Set email sender
// Place the order and capture the RITM number
var rc = cart.placeOrder();
var ritm = current.number; // Get current RITM number
ritm = ritm.split('M');
ritm = Number(ritm[1]) + 1; // Increment the RITM number for tracking purposes
} else {
var grr = new GlideRecord("sc_req_item");
grr.addQuery("number", ritm); // RITM number query
grr.query();
if (grr.next()) {
curr_record = grr;
}
}
And created Business rule to populate the email body to the RITM activity log
But the email body in the RITM is like this:
How can I make email body to be like this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 02:17 AM
Hello @Merza Lyn ,
Based on my understanding, the HTML in the email body won't render correctly when stored as plain text in the work notes. You may need to create a custom HTML field to store the data properly.
If you found my response helpful, please mark it as correct and close the thread to benefit others.
Regards,
Kaustubh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 02:38 AM
no need of business rule, you can set it in your inbound action
If you want to use business rule then update as this so that it keeps html formatting
current.work_notes = '[code]' + current.variables.email_body + '[/code]';
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
02-27-2025 03:34 PM
I tried that, but it looks like this.
I checked the email preview and it is in table format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 06:53 PM
ensure email_body variable is of type Rich text so that it supports HTML
let me know what's the variable type
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