Extract data from HTML tables from incoming emails?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2017 06:39 PM
Hi Everyone,
I have requirement to parse out the HTML tables and get that information put into separate fields. When the incoming emails are coming to our system, inbound actions will take the data in the incoming emails body and kept that data in the proper fields. In this picture this is the incoming email coming to Servicenow so i need to get the information of "street" kept that one in the field called "street" in the incident table. samething for other fields. I also read the couple of other articles but i couldn't figure it out.
@How can we extract data from tables in inbound email actions? @Inbound Email Action: - Extract data from an html table @Inbound email action to read data from HTML email
@chuck
Thanks in Advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2017 02:26 AM
Hi Ram,
we have this same issue - did you find a solution for this?
Thanks,
Keiron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 10:40 AM
Try this.
var street,state,city;
var body = email.body_text;
body = body.replace('\t');
body = body.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"");
var lines = body.split('\n');
for (i = 0; i < lines.length; i++)
{
if(lines[i].indexOf('Street')!=-1)
{
state = lines[i];
}
if(lines[i].indexOf('City')!=-1)
{
city = lines[i]
}
//continue for all other fields.
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2019 11:20 PM
I have tried executing this and it works 100%
var a = email.body_text;
var start = a.indexOf("Street:");
var end = a.indexOf("City:");
var streetsubstr = a.substring(start +7, end); //number of Char in "Street:" = 7//
var streetsubstr = streetsubstr..replace(/\s+/g, "");
current.u_street = streetsubstr;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2019 11:22 PM
.replace(/\s+/g, "");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2019 04:01 AM
Hi Please checkout my article on this: