Setting Manager Field

Cirrus
Kilo Sage

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);
}
}
}

3 REPLIES 3

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @Cirrus 

Greetings!

What is the UI type. Select the UI type as all and check.

images (8).png

Please hit the thumb and Mark as correct if it helped!

 

Kind Regards,

Ravi Chandra

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?

 

 

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