TUESDAY, FEBRUARY 07, 2012

Re-using Choice List Options in Fields and Variables

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.

Re-use choices in a field (Dictionary entry)
Re-use choices in a variable (Variable definition)

Comments

Posted On
Nov 07, 2011
Posted By
Cary Trusty

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?

Posted On
Nov 07, 2011
Posted By
Mark Stanger

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.

Leave a Reply


Notify me of followup comments via e-mail. You can also subscribe without commenting.

Latest Comments

  • Mark Stanger: This functionality doesn’t connect to an FTP server. See this line in the post above…...
  • Mark Stanger: The report page is back-end XML so there’s no way to directly manipulate the behavior of that...
  • Mark Stanger: Due to some ServiceNow limitations, the localhost MID server option had to be removed.
  • Matt Haak: Is it possible to use this with the local Mid Server (mid.server.localhost) It appears from this community...