Choice lists are one of the basic input elements available in Service-now.com. They are very simple to personalize and add or remove any options you need for your application. Something I see fairly often is the need to use the EXACT same choices in different tables that may not be directly related as extended database tables. Another scenario is where you have a choice list defined on a standard field and you want to use that same field and its choices in a service catalog ‘Select box’ variable. Service catalog record producers often have this requirement. In these cases, you may be tempted just to manually re-create the entire list of choice list options for the new field or ‘Select box’ variable. As long as the lists are the same, you can save yourself some setup time (not to mention the ongoing headache of maintaining the same information in 2 places) by making use of the ‘Choice table’ and ‘Choice field’ options.
In order to re-use choice list field values, the first thing you’ll need to do is set up a choice list field on a standard form with corresponding values. Once that’s complete, you can simply open up the dictionary entry (to re-use for a field) or the variable definition (to re-use for a variable) for your new field or variable and select the Choice table and Choice field values for the field that you want to pull the choice values from. Shown below are a couple of screenshots showing how you could set this up to re-use choices from the ‘Category’ field on the ‘Incident’ table…the first for a Choice field and the second for a ‘Select box’ catalog variable.
I have used this a few times but this is the first time I’ve noticed (or ran into this issue). I’m using this select box on a wizard that is collecting information for a record producer at the end of the wizard.
On the actual Incident record, there are fewer choices than there are on the wizard. The reason for this is that the Choice field/list pulls in all variables (no conditions). On the Incident form, some choices are set to inactive=true. The wizard doesn’t allow for a reference qual on the Selectbox option. Is there a way to use the attributes fields to filter where inactive=false?
Unfortunately, there isn’t a way to filter the results currently. This actually seems like a bug to me though. Inactive choices should never show up, regardless of where you’re pulling them in from. One way you might address this would be to set up a ‘before query’ business rule. You could easily filter out invalid choices for non-admins. The other method would be to set up a regular choice list and dynamically populate the choices…or just set up the choices and maintain them in 2 places.
Is there a way to use the ‘suggestions’ style choice list inherited from the referenced field in a Catalog variable of text line type?
@Brendan, unfortunately there isn’t at this time. Catalog variables in general don’t support the same types of attributes for suggestion, autocomplete, etc. as standard fields do.
Hi Mark,
Great tip! I’ve used it to duplicate “country code” values from my user table into my location table (so that they are always in sync). However, when I try to create a business rule which references the related field on the Location table, I’m finding that my new Country Code field isn’t visible… is this expected behaviour here (because the choice list is actually referencing sys_user)?
Regards,
Kevin
That depends on whether or not the country code value has actually been saved to a record. If it’s saved to the record then it should be have as expected. If you’re somehow interrogating those values just in the choice list then you may need to go to the original source to get to them. I haven’t encountered that before.
Hi Mark,
Thanks for the reply. I’ve recreated my new Choice Field for Country Code selecting “string” as the type and then selecting the choice values rather than selecting choice upfront, and that seems to have resolved my problem – I can now see the the Location.Country Code field when I dot-walk from User to Location for my business rule. Not 100% convinced that selecting a different type was the thing that resolved the issue, but happy it’s working now!
Thanks!
Kevin