
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2020 11:22 PM
Dear all,
How to display a catalog item variable that auto-populates field value based on another field input? I am referring to dot walking here.
E.g. Catalog item - X has two variables: User and Manager.
Requirement: While the requester selects User - a reference to sys_user, the Manager variable should auto-populate the value from the sys_user table for the selected user. (Just as it happens on the form while dot walking)
I doubt if this is possible, because another thread was mentioning this as not possible. Is there any workaround? If yes, please detail with script, if possible.
Solved! Go to Solution.
- Labels:
-
Multiple Versions
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2020 11:27 PM
Please try with the script below.
function onChange(control, oldValue, newValue, isLoading) {
var caller = g_form.getReference('user', PopulateManager); // PopulateManager is our callback function
}
function PopulateManager(user) { //reference is passed into callback as first arguments
g_form.setValue('manager',user.manager);
}
Please change the variable name that you have exactly in your catalog form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2020 11:26 PM
Hi,
You cannot bring dot walked field on catalog form from reference variable.
So you would require to create another variable to hold the manager
How to auto-populate?
1) use g_form.getReference() with callback to get manager and then set
OR
2) use GlideAjax and script include approach
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
‎10-22-2020 11:27 PM
Please try with the script below.
function onChange(control, oldValue, newValue, isLoading) {
var caller = g_form.getReference('user', PopulateManager); // PopulateManager is our callback function
}
function PopulateManager(user) { //reference is passed into callback as first arguments
g_form.setValue('manager',user.manager);
}
Please change the variable name that you have exactly in your catalog form.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2020 05:00 AM