- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 08:00 AM
I need to have an onChange client script on a catalog item populate another field.
The field 'Site Name' should populate 'Site Number' when Site Name is filled in. Site Name is a reference field to the cmn_location table, and on that table, there is a u_location_number field. This field is what would populate the Site Number field on the catalog item.
I am pretty sure I am missing a step in the script, but not sure where I should fix it.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 08:05 AM
Hello,
The way you are dot walking will not work, so either you have to use Glidereference or Glideajax, here is sample script for glidereference. Also change UI type to 'ALL'
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var gr = g_form.getReference('site_number_name', getData);
if(gr != '')
function getData(gr)
{
g_form.setValue('sit',gr.sit_location);
}
}
Also, try to follow no code approach as well
https://community.servicenow.com/community?id=community_article&sys_id=49deac8ddb92a010ab0202d5ca961967
Regards
Regards,
Musab

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 08:05 AM
Hello,
The way you are dot walking will not work, so either you have to use Glidereference or Glideajax, here is sample script for glidereference. Also change UI type to 'ALL'
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var gr = g_form.getReference('site_number_name', getData);
if(gr != '')
function getData(gr)
{
g_form.setValue('sit',gr.sit_location);
}
}
Also, try to follow no code approach as well
https://community.servicenow.com/community?id=community_article&sys_id=49deac8ddb92a010ab0202d5ca961967
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 08:34 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 08:48 AM
See Catalog matcher variable definition is wrong, Matcher table field should be Sys id and in next tab Catalog Setter Variable Definition write reference for number , see screenshot of that article again and do it.
Regards,
Musab

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2022 11:00 AM
Hello,
If you are fine with my reply, Please mark my answer as correct and close the thread.
Regards
Regards,
Musab