- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2020 04:20 AM
Hi all,
I have two fields namely User and Manager on a catalog form. Both these fields are of lookup select box type. The look up table for both is sys_user table.
I want to populate the value of manager field as soon as someone fills user field i.e The user which is selected in the user field, his/her manager name should populate on the manager field.
I have seen a lot of articles regarding reference field but there is nothing related to look select box field. Any help would be appreciated,
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2020 04:46 AM
Hi Rohit,
getReference() doesn't work on lookup select box.
Refer below link if you require to use Lookup select box
[SOLVED]: - Dependent variable on Catalog item using Lookup Select Box
OR
Make both the variables as reference type
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2020 04:35 AM
Hi,
Did you try out onChange Client Script on the User variable along with GlideAjax
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2020 04:43 AM
Hi Ankur,
I have used a onChange client script as follow:
function onChange(control, oldValue, newValue, isLoading) {
if (newValue == '') {
g_form.clearValue('manager');
return;
}
var req = g_form.getReference('user', fillmanager);
}
function fillmanager(req) {
g_form.setValue('manager', req.manager);
}
The variable name in the onChange was user.
Please see the screenshot attached for more clarity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2020 04:46 AM
Hi Rohit,
getReference() doesn't work on lookup select box.
Refer below link if you require to use Lookup select box
[SOLVED]: - Dependent variable on Catalog item using Lookup Select Box
OR
Make both the variables as reference type
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2020 09:42 AM
Hi Rohit ,
No scripting is required for this use case. You can accomplish this via Reference qualifier
1. In the first lookup select box set the Lookup Value field to SysId and Lookup Label to which ever field you want to display
2. Now in the second lookup select box set the lookup value field to what ever field you want and Lookup Label to Manager field with reference qualifier value as javascript:'sys_id='+current.variables.PASS FIRST LOOKUP SELECTBOX VARIABLE NAME HERE; and update the variable attribute as ref_qual_elements=PASS FIRST LOOKUP SELECTBOX VARIABLE NAME HERE
- Pradeep Sharma