- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 12:34 AM
Hi All,
In inbound email integration user email id stored in user field in sys_email table that is the one from where we received mail but I am looking the way to get user name also. Is it possible to do that?
Thanks and regards,
Brijmohan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 02:40 AM
@Brijmohan
How about extracting name from email id that you are storing in user field:
var email = "test.bcdsn13243@example.com";
var pattern = /^(.*?)@/;
var match = pattern.exec(email);
var name = match[1];
var user_nameis = name.replace(/[\.\d]+/g, ' ');
gs.info("User's name: " + user_nameis); // Output - User's name: test bcdsn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 01:02 AM
Hi @Brijmohan ,
Did you check the User ID(user_id) field which is reference to user table. You should be able to dot walk to name from there.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 01:09 AM
Hi @Brijmohan ,
why don't to use email objects like below:
var fromEmail = email.from //this gives sender email address
//glide user table and get the name
var UserName = new GlideRecord("sys_user");
UserName.addQuery("email", "abel.tuter@example.com");
UserName.addEncodedQuery("active=true");
UserName.query();
while(UserName.next()){
var name =UserName.getValue("name");
}
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 02:26 AM
Hi @Hemanth M1 , Users are not exist in user table. We are doing it through mailboxes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 02:40 AM
@Brijmohan
How about extracting name from email id that you are storing in user field:
var email = "test.bcdsn13243@example.com";
var pattern = /^(.*?)@/;
var match = pattern.exec(email);
var name = match[1];
var user_nameis = name.replace(/[\.\d]+/g, ' ');
gs.info("User's name: " + user_nameis); // Output - User's name: test bcdsn