Choice list with multiple dependent values?

Jake Berkes
Tera Expert

This has had me stumped for a while and I'm hoping someone can help.

 

I have a Symptoms dropdown list that I'm trying to make dependent on the Incident Category. Any one symptom may need to appear in the list for several categories, which is where I'm running into problems.

 

Example:

CategorySymptom
Cat1

Sym1

Sym3

Sym5

Cat2

Sym1

Sym2

Sym3

Cat3

Sym2

Sym3

Sym4

Cat4

Sym2

Sym4

Sym5

 

The symptoms list is about 30 items long, with several symptoms needing to appear based on each category. Using a standard dependent value requires multiple instances of each symptom in the choice list, which is tedious and gets out of hand quickly (around 200 items in choice list).

 

Is there a better way to do this? It almost seems like I need to reverse the dependency, but I'm not sure how to go about it - Sym1 = Cat1, Cat2; Sym2 = Cat2, Cat3, Cat4, etc.

 

Hope this makes sense, please let me know if I can clarify at all. Thanks!

10 REPLIES 10

harikrish_v
Mega Guru

Hi Jake,



Dependent choice list is the best way to do this. You can do this via client scripts as well, but as you mentioned, using it for 200+ choices is not a good way to go. If you are implementing this via dependent choices, it will be little more efficient .It takes a lotoff time to iterate through all the conditions if you write it in a client script. Here is an article from guru that you can refer if you want to do it via client scripts:-


http://www.servicenowguru.com/scripting/client-scripts-scripting/removing-disabling-choice-list-opti...



Thanks & Regards,


Hari


Community Alums
Not applicable

Hi tred this script but when I submit the it is showing none again any inputs?

solutioningnow
Giga Guru

Hi Jake,



  • The best option would be to have a custom table with two fields where one multi-select field for incident category and a string field for symptom values. By having the category as multi-select you no need to have multiple instances for same symptom.
  • Then on your form onLoad and category onChange you can query the custom table with the selected category to pull the applicable symptoms and populate the Symptom choice field.
  • This way your maintainabilty increases since your symptom, category dependency is stored in a table so that you can easily add/remove the dependency at custom table level.


Suggestion: If you make the Symptom field as a reference to the custom table, then you can easily acheive this with a simple reference qualifier by which you can avoid the script to pull symptoms from table on every onLoad/onChange.



Please let me know if you need more details on this and kindly mark the answer as correct/helpful, if it was helpful.



Regards,


Solutioner


Logo.png


Enhance Knowledge NOW@ www.solutioningnow.com


http://www.solutioningnow.com/


AnishSasidharan
Mega Expert

Hi Jake,


As mentioned before you can use a reference field for showing this type of values and also you can try tree picker option for your reference field.


Refer the link below how to create the tree picker attributes



Tree Picker - ServiceNow Wiki





Thanks,


Anish