- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 01:40 AM
Hello ServiceNow Gurus,
I am creating an inbound action that processes incoming emails which always contain a table. One of the rows is similar to the screenshot below.
is it possible to retrieve this value and match the email address to a record in the User table? The User name will then populate the caller field in the Incident table.
Please help.
Thank you very much.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 06:33 AM
here we go
sample code:
var abc = email.body_text;
var op=abc.split('Email');
var res= op[1];
var em= res.split('Sender');
var fr = em[0].trim();
gs.log('Result is'+fr);
give a try and let me know if you need any further help here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 01:53 AM
yes you can do that.
you can write gliderecord query to fetch the details .
var em ='your email which is comiing from email body ';
var gr = new GlideRecord('sys_user');
gr.addQuery('email',em);
gr.query();
if(gr.next()){
gs.log('Email Exist'+ gr.sys_id);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 03:25 AM
Thank you! This works.
However, I also need to extract the email address from the table. How can I do that?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 03:29 AM
you mean , you want to extract from the email body ?
is yes then below line will help you.
var abc = email.body.email;
or if you want to get from glide record query then use gr.email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 03:38 AM
Our ServiceNow mailbox receives email, where in the email body contains a table similar to below.
The requirement is to retrieve the email address, check the User record who owns this email address, then set the owner as the Caller.
The first part is what I cannot figure out, which is to get the email value.