- 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:08 AM
Hi Julia,
Dot walking would not work here. I would suggest to use Catalog Data lookup Definition to accomplish this work as a no code approach.
https://community.servicenow.com/community?id=community_article&sys_id=96153c14db2dd010f7fca851ca96192b
Let me know in case you have any further queries
If you think my response is helpful for you? If yes, mark it as correct answer and close the loop so that it would help future readers as well.
Regards,
Deepankar Mathur