Use Case:
We recently had a client that wanted us to create an incident ServiceNow record producer with some of the same functionality as the portal record producer. Specifically, adding a Category and Subcategory field and having the Subcategory choices limited to only display choices associated with the selected Category. To properly have the Subcategories filter based on the Category a user selects, we need to use Lookup Select Box and ref_qual_elements attribute on the Subcategory field.
Work Steps:
- The first thing we need is a Lookup select box on the record producer for Category.
- Map to field: True
- Field: Category
- Record Producer Table: incident
- Type: Lookup Select Box
- Catalog item: (Select your record producer)
- In the Question form section, we will simply name the field Category (or whatever you’d like in your scenario)
- The Type Specifications tab is what we really need to focus on and what will drive the first half of our solution.
- Lookup from table: Choice (sys_choice)
- Lookup value field: Value
- Lookup label field: label
- And our most important field will be our Reference Qualifier. We need to find all the Category choices for the incident table.
- Reference Qualifier: name=incident^element=category
- The next piece is to set up our Subcategory field.
- Map to field: True
- Field: Subcategory
- Record Producer Table: incident
- Type: Lookup Select Box
- Catalog item: (Select your record producer)
- In the “Question” form section, we will simply name the field Subcategory (or whatever you’d like in your scenario)
- Once again, the “Type Specifications” tab is what we really need to focus on.
- Lookup from table: Choice (sys_choice)
- Lookup value field: Value
- Lookup label field: label
- Once again, our ServiceNow reference qualifier is very important. Like before, we need to find all the Subcategory choices on the incident table and dynamically add the dependent value from the selected Category.
- Reference Qualifier: javascript: “name=incident^element=subcategory^dependent_value=” + current.variables.category;
- Lastly, we will add our ref_qual_elements field to our “Default Value” Tab.
- Variable attributes: ref_qual_elements=category
Once these items are in place, your Category and Subcategory fields on your record producer on ServiceNow will be functional and the Subcategory field will dynamically be filtered and driven by the Category field.