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

Inbound email integration

Brijmohan
Tera Contributor

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

1 ACCEPTED SOLUTION

@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 

View solution in original post

6 REPLIES 6

Sonam Tiwari
Tera Guru

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.

Hemanth M1
Giga Sage
Giga Sage

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");
}

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi @Hemanth M1 , Users are not exist in user table. We are doing it through mailboxes.

@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