Using getReference on Catalog Client Script and I get sysid of location from sys_user table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 04:41 PM
I am using getReference on Catalog Client Script to get information about the Requester from sys_user and i get sysid of the location field.
is there a way to get the Value instead of the sysid?
any help would be appreciated
here is the script below
unction onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var reqByName = g_form.getReference('u_requested_by', callback);
function callback(reqByName) {
var offc = reqByName.u_office.getDisplayValue();
g_form.setValue('u_req_by_office',offc);
g_form.setValue('u_req_by_location1', reqByName.location);
g_form.setValue('u_req_by_location2', reqByName.u_desk_location);
}
}
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 05:54 PM
Hello,
The location field on the sys_user record is a reference, the value of reference fields is a sys_id. So that is the value. I assume you mean you want the display value or "name" of the location, correct?
Your script is a bit confusing because you used getDisplayValue() for the u_office field, so if that's working for you, then you'd do the same for location (again, if you meant the display value for that field).
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 05:59 PM
Thanks for replying
Yes i need the location Display Value, the office is also a reference field and it is not displaying the value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 06:10 PM
var offc = reqByName.u_office.toString();
Shakeel Shaik 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 06:12 PM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var reqByName = g_form.getReference('u_requested_by', callback);
function callback(reqByName) {
g_form.setValue('u_req_by_office', reqByName.u_office);
g_form.setValue('u_req_by_location1', reqByName.location);
g_form.setValue('u_req_by_location2', reqByName.u_desk_location);
}
}
Shakeel Shaik 🙂