Options
- 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.
Options
- 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
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande
Thanks
Anil Lande
Options
- 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
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader