The CreatorCon Call for Content is officially open! Get started here.

Unable to populate tabular email body in incident

ack
Tera Contributor

Hi Folks,

 

I have required to convert emails into tickets, I have created flow to convert and it working as expected, only description is not populating correctly.

Here, Email body need to populate in incident description. Mail body  coming as table form ,same format need to populate in INC. 

 

PFA example of email body.

 

Please help me to populate , Thanks in advance.

2 REPLIES 2

Ravi Gaurav
Giga Sage
Giga Sage

Hi @ack 

When you fetch the email body from the inbound email action, ServiceNow usually strips HTML and stores only plain text.
To retain the table and its format, use the email.body_html property instead of email.body_text.

 

Inbound Email Action Script (Example)

(function process(inboundEmail, action, event) {
try {
var inc = new GlideRecord('incident');
inc.initialize();

inc.short_description = inboundEmail.subject || "No Subject";
inc.caller_id = gs.getUserID();


inc.description = inboundEmail.body_html || inboundEmail.body_text;


inc.comments = "Email received from: " + inboundEmail.origemail;


inc.insert();

gs.info('Incident created successfully with HTML description.');
} catch (ex) {
gs.error('Error while creating incident from email: ' + ex.message);
}
})(email, action, event);

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

ack
Tera Contributor

HI @Ravi Gaurav ,

 

Thank you for the quick response.

 

I am using flow designer, I need to map ENTIRE  email body to Description.