Auto populate one variable on a Catalog item based on the value of another variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 02:31 AM
Hi!
On my test catalog item, I have created two variables, one call 'Location' and the other called 'Sitecode'. The 'Sitecode' value should automatically update when I select a value in the 'Location' variable.
I have created a custom table.
This is my test form.
This are my catalog item variables.
This is my client script.
Unfortunately, it's not working. What am I doing wrong? Can someone help me please?
BR
Manfred
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 02:37 AM
Hi,
update it as below:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var og = g_form.getReference('Location', callBackMethod);
}
function callBackMethod(og){
g_form.setValue('Sitecode', og.u_og_site_code);
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
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
04-02-2020 04:08 AM
Hello Ankur.
Unfortunately, that doesn't work either.
BR
Manfred
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 04:32 AM
Hi,
Is the Location field a reference to that table?
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
04-02-2020 04:13 AM
Hi,
May I know what is the field type of sitecode in location table?
Regards,
Subhojit