The CreatorCon Call for Content is officially open! Get started here.

Choice list with a custom table

jmuomini
Mega Expert

Hi;

I've set up a new custom table that has a particularly complicated Choice list requirement with categories, buildings, equipment, and details. They want dependencies between the fields so you select a category, then a building, then the piece of equipment, and in some cases an additional item of detail. I started working with the sys_choice table but it was getting to be a bit of a mess because of the overlapping buildings and the large amount of data. I then decided to build a little table with a record for each piece of equipment and just the four fields I need for the lists. Then I reset my list fields to point to this table with the Choice table field and selected the fields I want to pull in. But I see nothing when I try the drop downs. Should this work or am I missing something? Do choice lists only work with a specific "choice" table like sys_choice?

I liked the idea of maintaining this in a simple table rather than through choice list maintenance. And if I do use sys_choice, I have to give the building names slightly different names in the data field (Harney-1, Harney-2) or the dependence doesn't work properly.

Thanks, JiM

3 REPLIES 3

kcaldwell
Kilo Expert

Choice lists will only get values from sys_choice. What you are doing when you set the Choice Table and the Choice Field is tell the field to look at sys_choice and get the value for the Table and Field you select instead of using values defined on sys_choice for this field. This would keep you from repeating values if they already existed in another list.

Since you have put your values into a new table you created, you need to change your choice fields to reference fields and point them to your new table. Either you can keep the reference field look or you can make them display as choice lists.
http://wiki.service-now.com/index.php?title=Reference_Fields#Displaying_the_Reference_Field_as_a_Choice-List

It also sounds like all of values are in 1 table so you can use reference qualifiers to pull only the data you need for each field.
http://wiki.service-now.com/index.php?title=Reference_Qualifiers


Thanks for clarifying. I have too many entries for the choice display with reference fields. I think I need to convince them to use the reference display approach as SNC intended for such things and get away from choice lists. This are in effect CIs, afterall. 😉


susharma
Tera Contributor

Here is the accurate solution :

 

The custom table should have a field which is String.

 

On Dictionary Entry of the String field Add the Choice List as you need. Example :

susharma_0-1684390311895.png

 

Now you should be able to see this table and that field in the Configuration of Choice list in all the places.