Tree picker in ServiceNow

When configuring ServiceNow, in order to provide clients with a quality product, it benefits a developer to have a strong understanding of how the core UI functions. Clients have varied needs, and knowing what good-practice options are available, and what pitfalls to avoid, ensures that the client can feel comfortable knowing that they’re getting well-informed guidance.

A potentially underused UI feature in ServiceNow (that developers should be conscious of) is the tree picker. The tree picker allows reference choices to be listed in a hierarchical format, as pictured below. The most often encountered baseline implementation of the tree picker is on the Incident form, when clicking the magnifying glass next to the “Assignment group” field. However, the tree picker can be applied to any reference field where there is a parent-child, hierarchical structure.

Tree Picker

Good examples of tables using a hierarchical structure / cases when a tree picker would be appropriate are:

  • Records that possess a “parent” field where “parent” points back to the same table
  • Configuration item (CI) fields for CIs with dependencies (ie. Applications exist on Servers)
  • Fields that are dependent on other fields on the same form (i.e., apply the tree picker to Assigned to, which depends on Assignment group)

To apply the tree picker to a reference field, you simply need to add an attribute to the field’s dictionary entry. In the attributes field, add tree_picker=true to display the tree picker for that field’s reference dialog.

Keep in mind, when utilizing the tree picker on fields that have reference qualifiers, there is a notable pitfall that needs to be avoided. When creating the reference qualifier to only show specific values, you must take care to include all parent values of values you want to include.

As an example of how this issue may crop up, consider the following: Say you wished to restrict the choices for “Assignment group” on incident to a specific division, which was defined as all groups where Parent = “Software”. If you applied this reference qualifier, but did not include the “Software” group itself, no groups would be selectable. This issue is true for any part of the hierarchy. Failing to include anything that acts as a parent will prevent the children from appearing.

Judicious use of this UI feature, native to ServiceNow, to present hierarchies on reference fields in an intuitive way to improve the day-to-day experience of clients and their users.