Implementing Custom Keyword Search for Category and Sub-category Fields in ServiceNow

06 Feb, 2020 | 3 minutes read

About ServiceNow

ServiceNow is an IT Service Management tool designed as per ITIL guidelines. This is a cloud platform with one user interface and one data model. The main vision of ServiceNow is to build a cloud-based platform that would enable people to create a meaningful application to route work through enterprise. It is founded in 2003 by Fred Luddy, David Loo, Don Goodliffe and Bow Ruggery, headquartered in Santa Clara, California.


In this article, we will explain how to iterate through all categories and subcategories in the Choice [sys_choice] table.

The Choice table [sys_choice]

The Choice [sys_choice] table contains the translated text for options that appear in choice lists.

The main fields for this table are:

  • Table: the name of the table the translation applies to.
  • Element: the name of the field the translation is used for.
  • Language: two-character ISO language code for the translated choice.
  • Value: English description of this choice.
  • Label: translated text that users see for this choice.

The values for Category and Subcategory fields are stored in the Choice table. The main problem here is that it is not allowed to reference the Choice table.

  • First of all, we need to create a new field in the incident form, in order to help the user to search the category and subcategory. Let’s name the field “Categorization Lookup”.
  • In order to answer this challenge, we decided to create a new table, identical to the sys_choice table, with the same values. Using this solution, we can configure the new Categorization Lookup field to reference this new table. As a result, we have the values that we are searching for displayed in the new field. Every new value that is inserted in the Choice table is automatically copied into this new table.

  • Next, we need to approach the problem of updating Category and Subcategory with the values that we have in the new field. For this reason, we created an onChange Client Script. Both Category and Subcategory are dropdown fields.
    • The values shown in the category field are dependent on the value that is chosen in the Operational Type field.
    • Values shown in Subcategory are dependent on the value which is picked in the Category field.
  • So, when we choose some value in the operational type field, from the Categorization Lookup field we can only search through the values which are dependent on the value in the operational type field. By using this solution, we get the expected result. Now users can search through the new field in an easier and simpler way.

This was an explanation of how to iterate through all categories and subcategories in the Choice [sys_choice] table and fill the category and subcategory field in the incident form. If you need more information about it, feel free to contact us.

Benefits and Results

  • The user time is greatly reduced.
  • There is more visibility.
  • There is a possibility to enter just the first letter (independently, letter of required category or subcategory), in that way you can easily get the desired combination.
  • There is no need to remember the combinations of categories and subcategories.


This functionality enables users to select from the search results field, and the chosen combination will be applied to the Category and Subcategory fields on the New Incident Form. In that case, we will help the user to reduce the time to find the specific category and subcategory.

If you want to find out more about ServiceNow, you can contact us.