Dependent drop downs

JohnnySnow
Mega Sage

Hi Team,

 

We have a requirement in a catalog item to implement dependent dropdowns. There are three lookup select boxes — SB1, SB2, and SB3 — each containing multiple dropdown values.

 

What is the best practice for configuring dependent dropdowns in ServiceNow?

 

Our Current Approach
We have added all dropdown options into the sys_choice table as below:

Table: sys_choice
Element: SB1
Value: abcd

 

Questions

Is it okay to use sys_choice and set the Table field to "sys_choice" within the sys_choice table itself? if not where should we put the choices if the number of choices are less than 30.

Should we be using a different table instead?

OR

Would it be better to create a custom table to store all lookup values and then configure the dependent dropdowns using reference fields and reference qualifiers?

 

 

Thanks
Johnny

Please mark this response as correct or helpful if it assisted you with your question.
9 REPLIES 9

@JohnnySnow 

that's what I am referring.

sys_choice is always tagged to a table field.

In your case it's a catalog item, so better to use Select box variable and add choices and handle the script part

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

so are you saying that if I had attached data, I should do this in script via addoption and remove option? and in future if this list grows do we continue to add remove options via script?

How could this be easily maintained?

 

 

 

 

Thanks
Johnny

Please mark this response as correct or helpful if it assisted you with your question.

SD_Akshay
Tera Guru

Hello @JohnnySnow 

 

We had same requirement where we have to populate three fields such as Category -> Subcategory->item

 

I was able to achieve this using maintain item catalog variables itself, I created the variables in sys_choice table itself and fetched them from variable by giving it type as "Lookup Select Box" and in "Type Selection" related section had the below configurations

 

Lookup from table : Choice
Lookup value field : Value
Lookup value field(s): label
Reference qualifier: javascript:'name=incident^element=subcategory^dependent_value=' + current.variables.category;
 
And if the third field is there which is dependent on sub-category I would add in Type Specification section
 
Variable attributes : ref_qual_elements=subcategory
 
With this I did not had to add any custom table or any choices in maintain item variable. 
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Akshay Kamble (SD_Akshay)
ServiceNow Developer
LinkedIn: https://www.linkedin.com/in/akshay-kamble-1504/
****************************************************************************************************************

@SD_Akshay that was the plan but can you tell me what did you put in the 'table' field of the sys_choice table for these dropdown values?

Thanks
Johnny

Please mark this response as correct or helpful if it assisted you with your question.

Have you tried it ? You can use choice table which will be there under variable or any unused table from sys_choice which is not that useful (not recommended). I'm not recalling what I had used but the method worked for me.

 

Do let me know what you did

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Akshay Kamble (SD_Akshay)
ServiceNow Developer
LinkedIn: https://www.linkedin.com/in/akshay-kamble-1504/
****************************************************************************************************************