Inbound email notifications - retrieve mailer name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi everyone,
Currently I have an inbound action created which I want to use to retrieve the name of the sender.
For example, when you receive an email it displays as 'Example user <example.user@gmail.com>.
How can I retrieve the 'Example user' in my inbound to populate the field 'people_name' for example?
Appreciate the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @rafas_10 I assume that every incoming email is associated with a user in the instance. You can use the email ID to search in the User table and retrieve the corresponding user name
if (email.origemail == '[email_address]') {
var arrSubject = email.subject.split(' : '); //need to include the
var gr = new GlideRecord('sys_user');
gr.addQuery('user_name', arrSubject[1]);
gr.query();
if (gr.next()) {
current.caller_id = gr.sys_id
}
} else {
current.caller_id = gs.getUserID();
}
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @Dr Atul G- LNG ,
Actually this emails come from users that are not within our system. So they send an email to a specific mailbox and that mailbox redirects the email to us and creates an HR Case.
I can retrieve the email.from but not the original sender name.
Any ideia?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Have a look here:
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
You can get the string in front of the '@' by using regex, but that doesn't tell you anything. Emails coming in from users that aren't in your system, can be literally anything. What if the email is from a user with a business and uses the info@mybusiness.com address? You get 'Info'. People have weird email addresses for personal use. Do you want 'iamacatperson' in your HR case?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
