Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get the name of the sender from inbound action

shaik_irfan
Tera Guru

Hi,

When i receive the email to servicenow i want to get the name of the sender.

 

1 ACCEPTED SOLUTION

In such case, you get guest.

var name = gs.getUser().getUserByID(email.from_sys_id).getDisplayName();

if(name="guest") {

  name = email.from;

}

View solution in original post

11 REPLIES 11

asifnoor
Kilo Patron

you can get it like this

gs.getUser().getUserByID(email.from_sys_id).getDisplayName();

@asifnoor 

 

I get emails whose user record is not available in servicenow

 

In such case how can i get the name ?

In such case, you get guest.

var name = gs.getUser().getUserByID(email.from_sys_id).getDisplayName();

if(name="guest") {

  name = email.from;

}

Then the name will give the actual from email address (if the user is not registered in SN). If he is registered user, you will get the actual name.