- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2019 12:18 AM
Hello All,
I am creating dependent Variables on catalog item via client script.
Server certificate variable will be dependent on Location Variable.
Now the catalog where I am defining it is contains ordered guide, Location filed is set on one page and the dependent field is set on another page.
I have written below on change client script to achieve this but not working:-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue=="TM-01"){
g_form.removeOption('ServerCertificate1', "rsp-1000.oberthur.net");
g_form.removeOption('ServerCertificate2', "rsp-1000.oberthur.net");
g_form.removeOption('ServerCertificate3', "rsp-1000.oberthur.net");
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2019 10:17 PM
Hello Harshvardhan,
Thank you for the help.
I solved this issue, by making my script onLoad not on change.
I just had a thought that my catalog is using order guide, and that location variable is not on the same page where i want to remove the option.
so on change script is defiantly not gonna work.
Here is the catalog client script for future reference, from which I achieved the desired result:-
function onLoad() {
if(g_form.getValue('Location') == "TM-01"){
g_form.removeOption("ServerCertificate1", "rsp-0000.oberthur.net");
g_form.removeOption("ServerCertificate2", "rsp-0000.oberthur.net");
g_form.removeOption("ServerCertificate3", "rsp-0000.oberthur.net");
}
}
Regards,
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2019 10:17 PM
Hello Harshvardhan,
Thank you for the help.
I solved this issue, by making my script onLoad not on change.
I just had a thought that my catalog is using order guide, and that location variable is not on the same page where i want to remove the option.
so on change script is defiantly not gonna work.
Here is the catalog client script for future reference, from which I achieved the desired result:-
function onLoad() {
if(g_form.getValue('Location') == "TM-01"){
g_form.removeOption("ServerCertificate1", "rsp-0000.oberthur.net");
g_form.removeOption("ServerCertificate2", "rsp-0000.oberthur.net");
g_form.removeOption("ServerCertificate3", "rsp-0000.oberthur.net");
}
}
Regards,
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2019 06:28 AM
Here is the blog post I have written that can help you. Dependent catalog variables can be created in two ways.
Hit Like if this helps you!
Regards,
Snehal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 11:52 PM
Hi All,
Please take a look at Article below:
1. dependent on single table
2. dependent on two tables using referene
[SOLVED]: - Dependent variable on Catalog item using Lookup Select Box
https://community.servicenow.com/community?id=community_article&sys_id=1ce7dceedb5914101cd8a345ca961952
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Thank you!
Regards,
Kailash.