Setting Manager Field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 06:28 AM
Afternoon,
I am using a client script to set a manager variable based on a user selected in a list collector variable. Its working fine in the portal, but not in the back end. Can anyone advise how to correct this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', g_form.getValue('user_name'));
gr.query(myCallBackUser);
function myCallBackUser(gr) {
if (gr.next()) {
g_form.setValue('user_manager',gr.manager);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 06:35 AM
Hello @Cirrus
Greetings!
What is the UI type. Select the UI type as all and check.
Please hit the thumb and Mark as correct if it helped!
Kind Regards,
Ravi Chandra

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 07:19 AM
Ravi,
Its an on-change client script, on change of field name user_name in all UI types. The catalog item in question is part of an order guide, so the list collector will only ever have one name in it. I am wondering if the list collector treats that value differently in the back end?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 07:25 AM
It appears the issue is we are using a g.list command in a client script to limit the amount of users selected in the list collector, and this is not supported in the client. If I deactivate that script, the above code works as required. Thankyou