- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 12:14 PM
Hi all,
I need to autopopulate manager in the manager variable on catalog form for the request for field.
I can add to the default value - javascript:gs.getUser().getManagerID(); and it autopopulates the manager, however if the request for name is changed (for example if an EA is logging on behalf of they would change the request for field name from them to other person) - then the manager field does not update to reflect that changed users manager (stays to the logged in users manager), is there any simple code to update the manager onChange, I am guessing I need catalog client script?
thanks.
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 12:24 PM
If you looking for something on the client side, you can do it using getReference
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var usr = g_form.getReference('requested_for',callBack);
}
function callBack(usr){
g_form.setValue('manager',usr.manager);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 12:24 PM
If you looking for something on the client side, you can do it using getReference
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var usr = g_form.getReference('requested_for',callBack);
}
function callBack(usr){
g_form.setValue('manager',usr.manager);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 06:34 PM
Sorry i have not used the GlideRecord scripts so i went with the "Dvps" script and that's working as requirement.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2019 05:03 AM
GlideRecord is not a good option in client script. It will not work when using mobile or Service Portal without some modifications or moving to a script include. However the code you used will work with Service Portal.