- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2023 08:04 AM
I'd like to parse an inbound email for a user employee number and use it to retrieve multiple other attributes in the record to populate a form.
My sys_user table has an attribute called "u_employee_number"
In the email body I'm user this variable pair
requestor:123456
In my inbound action script I'm trying
var userid = new GlideRecord('sys_user');
userid.addQuery('u_employee_number',requestor);
userid.query();
if(userid.next()){
var id = userid.sys_id();
}
Then I want use the sys_id in my catalog item:
if(requestor!=undefined)
hddcart.setVariable(item,"requestor_name",id);
This isn't working.
Can you help?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2023 08:43 AM - edited 11-13-2023 08:52 AM
Hi @Joe Taylor
You can fetch multiple attributes using the same object:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2023 08:17 AM
Hello @Joe Taylor,
Try this updated scripts -
if (email.body.requestor != undefined){
var userid = new GlideRecord('sys_user');
userid.addQuery('u_employee_number', email.body.requestor);
userid.query();
if(userid.next()){
var id = userid.getUniqueValue();
}
}
If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 👍🏻
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2023 08:35 AM
Yay!
This worked to get the sys_id of the requestor using the employee number.
Now how do get multiple attributes for this user from the sys_user table to use in my forms?
Say I want to get:
sys_id (This is working now!)
name
title
dept
etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2023 08:43 AM - edited 11-13-2023 08:52 AM
Hi @Joe Taylor
You can fetch multiple attributes using the same object:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2023 09:49 AM
Thanks so much!