Adding a Dependent Variables using Question_Choice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2011 05:00 PM
I need to make choice list B dependent on the selection of choice list A selection within a Catalog Item. Each variable is a short list of values (not currently a reference to an existing table).
I reviewed this WIKI article:
http://wiki.service-now.com/index.php?title=Adding_Dependent_Variables
(and other WIKI articles) and made it work by creating a custom table then making choice2 dependent on choice1, and added entries into sys_choices table.
Is there a better way to do this leveraging a variable's question_choice table?
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2011 07:39 AM
Another way to do this could be to just fill in the list manually with javascript; below is an example of how to do that.
function onChange(control, oldValue, newValue, isLoading) {
if (oldValue == newValue){
//if the value hasn't changed do nothing
return;
}
if (newValue == "OpTime"){
g_form.getControl('type_of_request').options.length = 1;//remove all options except --none--
g_form.addOption('type_of_request', "Documentation", "Documentation");
g_form.addOption('type_of_request', "Surgeon Authorizations", "Surgeon Authorizations");
}else if (newValue == "HB"){//hb
g_form.getControl('type_of_request').options.length = 1;//remove all options except --none--
g_form.addOption('type_of_request', "HB Something", "HB Something");
g_form.addOption('type_of_request', "Billing Stuff", "Billing Stuff");
}else if (newValue == "" || newValue == undefined || newValue == "undefined"){
//if --none-- is picked clear options as well.
g_form.getControl('type_of_request').options.length = 1;//remove all options except --none--
}
Or if the second dropdown data is in another table you could query that and return that into the list.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 08:06 AM
There is another way to do this which is way better. When I replied years ago I don't know if it existed, but it does now.
Attribute ref_qual_elements
I'm pulling an example up and I'll more comments to this with that detail in a minute.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 08:14 AM