- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2021 10:05 PM
I am receiving an inbound action that contains a user email address, How do i then query the user table for the Users Full name and User ID based on just the email address?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2021 10:28 PM
Hi,
sample script below
var userRecord = new GlideRecord('sys_user');
userRecord.addQuery('email', email.from.toString());
userRecord.query();
if(userRecord.next()){
var userName = userRecord.user_name;
var fullName = userRecord.name;
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2021 10:11 PM
You can use GlideRecord query to get user record based on email.
var userGR = new GlideRecord('sys_user');
userGR.addQuery('email','email address from inbound email'); //email.origemail
userGR.query();
if(userGR.next()){
var user_id = userGR.user_name;
var user_f_name = userGR.name;
}
Please mark helpful/correct answer if this resolves your issue.
Thanks,
Anil
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2021 10:28 PM
Hi,
sample script below
var userRecord = new GlideRecord('sys_user');
userRecord.addQuery('email', email.from.toString());
userRecord.query();
if(userRecord.next()){
var userName = userRecord.user_name;
var fullName = userRecord.name;
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader