- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 12:01 PM
In our request catalog we auto populate "On behalf of" and their "location." The Get User Location client Script looks like this:
function onChange(control, oldValue, newValue, isLoading) {
if (newValue == '') {
return;
}
var obo = g_form.getValue('on_behalf_of').toString();
var user = new GlideRecord('sys_user');
user.addQuery('sys_id',obo);
user.query(callBack);
function callBack(user){
if(user.next()){
g_form.setValue('location',user.location);
}
}
//Type appropriate comment here, and begin script below
}
It works like a charm. I am running into issues adding the User's Phone number. I modified the Get User Location Script but I can't get it to populate the phone onChange:
function onChange(control, oldValue, newValue, isLoading) {
if (newValue == '') {
return;
}
var obo = g_form.getValue('on_behalf_of').toString();
var user = new GlideRecord('sys_user');
user.addQuery('sys_id',obo);
user.query(callBack);
function callBack(user){
if(user.next()){
g_form.setValue('phone',user.mobile_phone);
}
}
//Type appropriate comment here, and begin script below
}
What am I missing?
Thank you
Solved! Go to Solution.
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 01:31 PM
In the catalog client script screenshot, the variable you selected is phone, it should be on behalf of instead. Change it to on behalf of and you are good to go

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 01:11 PM
Change the filed type from reference to Single line text and try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 12:46 PM
It is a reference (Like the "on behalf of" and "location." The Mobile number is location in the sys_user table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 12:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 01:23 PM
I have check the names multiple times and they are correct. Also, the phone number is filled out in the user table. Not sure what else to try.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 01:15 PM
As I told you earlier variable type of phone should be a single line text. mobile phone on user table is a string type, so the phone should be a single line text.