
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2019 08:48 AM
Hi everyone.
Ran into a perplexing thing today, which I would like your two cents on:
When receiving an email, it's pretty easy to get certain information from that email: Senders email address, subject, body etc.
But - what if I just want to get the display name of the email sender?
I see that it's in the From: in the header. So it says:
From: Jacob Saaby Nielsen <jacob@blabla.com>
How do I get the "Jacob Saaby Nielsen" part from the email headers?
Can't seem to find anything on that.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2019 08:54 AM
Hi there,
I've searched recently though didn't find anything for this. I was expecting something like "email.user_id".
Ended up with a GlideRecord query on sys_user unfortunately.
See below. Note: this is only part of the whole code!
(function() {
var emailParsed = email.body.caller;
emailParsed = emailParsed.split(' ');
var grUser = new GlideRecord('sys_user');
grUser.addQuery('email', emailParsed[0]); // Though, what if this email is not unique?!
grUser._query();
if(grUser._next()) {
var requested_by = grUser.getValue('caller');
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2019 09:06 AM
let me preface this by saying i am new to emails>>> correct anything below that is incorrect >>>
an incoming email creates an incident and populates Caller with the Sender.
you can get display name using caller_id and sys_user as per Mark.
is your requirement to get the display name before the incident is created?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2019 08:53 AM
Hi there,
Did this solve your question? Or do we need to follow up on this?
Please mark this answer as correct if it solves your problem. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2019 08:15 AM
Hi there,
Did this solve your question? Or do we need to follow up on this?
Please mark this answer as correct if it solves your problem. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2019 03:02 AM
Hi there,
Did this solve your question? Or do we need to follow up on this?
Please mark this answer as correct if it solves your problem. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field