Using values in a table column as drop-down values in another table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2019 05:00 AM
I'm new to ServiceNow and I'm trying to use values in a table column as drop-down values in another table. There are a number of posts on this, but none have helped. I haven't found a complete step-by-step, so I have to assume I missing something that might be obvious to someone else. At this point I can't enumerate all of the things I tried, but right now I'm looking at the steps below, which were found in this post: https://community.servicenow.com/community?id=community_question&sys_id=cfbc4fe5db9cdbc01dcaf3231f9619ae
Create the field as a string field.
Open the dictionary entry for the field (advanced view)
Go to Choice List Specification
Set the choice to the one you want
Set the choice table to the table you want
Choose the field you want to display in your field
Save the dictionary entry.
In one iteration of my attempts at this I was able to 'Set the choice table to the table you want', but for 'Choose the field you want to display in your field', the drop-down selector was empty. I had tried a lot of different things at this point so, I started over with a simple test. Here's what I did:
1. Created a States table with 1 column: 'State', type String
2. Populated the States table with a few states
3. Created a Customer table with a column: 'Name', type String
4. Added a column named 'State' to the Customer table and went to Advanced view/Choice List Specification tab
Under Choice Table, my States table is not in the list. I know it exists; it has values in it. I have no idea why, on the iteration with my original tables I described above, I'm able to select the table but it has no Choice fields to select from while here I can't even select the table.
Any guidance would be much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2019 06:19 PM
Hi,
A choice list is a special fixed list of values that is independent from your table but dedicated to it.
Choice lists all reside in the table sys_choice_list, with references\identifiers for the table they are available on.
If you wish to select unique values who's context is your current table then a choice list is perfect.
Based on your description it sounds like you are trying to select values from another table?
if yes then you need a reference field IE a reference to the complete record on the table, not a single field although you can configure the field that is visible for the reference record.
Take a look at an OOB Dev instance instance
Examples of choice list on the Incident table are Category State, Contact type, Priory...
Examples of reference field are Caller, Service, Configuration Item, Assignment group...
and in the related records tab you can identify related tasks, Problem, Change, Caused by change
- If there is a magnifying glass selection option the field is a reference.
The OOB watch list and work notes lists are examples of slush buckets, these allow you to select multiple records from the referenced table.
If this hasn't helped\clarified your question, you may need to provide some clearer details regarding your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2019 08:02 AM
Hi Tony,
Thanks for the response. I did get it working using a reference (what I was missing was checking the 'Display' checkbox on the column I wanted to reference). Having said that, I still would like to know if it possible to use another table as a lookup table w/o doing it as a reference. I've seen a number of posts that indicate it should be. There would also seem to be a limitation using a reference table as (I assume) it's only possible to have one display value. What if you had say a states table with a column for the full state name and a column for the abbreviated state and want to display the full state on one form but the abbreviated value on another?
I couldn't find a sys_choice_list table, but I've seen what I believe you are referring to under System Definition/Choice Lists. This would work fine for probably most needs, but if you want to present the same set of choices on multiple forms, wouldn't you need to create those choices multiple times?