Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Dot-walking examples

Dot-walking examples

Dot-walking can be performed in several ways. Examples of each are provided.

Tree pickers

The tree picker interface presents an expandable, hierarchical view that may be used when selecting fields. It provides a special reference lookup for the following items.
  • Configuration Items (CIs) for a field that depends on another CI field.
  • Reference elements for any hierarchical table. A hierarchical table is any table that has a parent field pointing back at itself.
  • Values for a user reference that depends on the group.

For example, the following Users glide list field has a select fields icon ( Picker icon ):

Figure 1. List field
List field

Clicking this icon presents a list of fields available on the current record:

Figure 2. Select fields
Select fields

Reference fields have + icons next to their name. Clicking the + expands a list of the fields on that referenced field. In this example, expanding the Assigned To field shows the User fields for that record:

Figure 3. Select referenced fields
Select referenced fields

Selecting the Manager field adds the variable ${assigned_to.manager}:

Figure 4. Dot-walked variable
Dot-walked variable
Note: A limit of 1000 has been placed on the number of nodes returned to the tree picker. This limit is configurable with the glide.ui.group_heirarchy.max_nodes property. To set the property, Modify the dictionary entry for the field, and add tree_picker=true to the Attributes field. If there are multiple attributes, use a comma to separate them without any spaces between.

Choice list fields

Users can dot-walk to related fields in a choice list, such as the field list in a filter. This example demonstrates how to filter the incident table by the company of the caller who registered the incident.

First, open the choice list of fields to filter by. This action presents a list of the fields that are present on the Incident [incident] table. Reference fields are followed by related fields, which are presented in blue. For instance: Caller is followed by Caller > User fields. This means that Caller is a reference field, and the related fields are User fields on the Caller record. If the blue related fields are not present in the list, select Show Related Fields in blue at the bottom of the list:
Figure 5. Show related fields
Show related fields
When the related fields are present, select a set of related fields.
Figure 6. Related fields
Related fields
After the related field is selected, the menu reloads with the fields of the related table.
Figure 7. Related table fields
Related table fields

The new field is: caller.company.

When looking at the list, it is easy to see where in the dot-walk the user currently is. Each selected reference is stored at the top, and the number of dots in front indicate how many dots from the initial record the user has reached.
Figure 8. Dot-walked field
Dot-walked field

In this picture, the user is at incident.caller.company. It is possible to return to higher levels in the hierarchy by selecting the blue records. For instance, selecting Incident fields returns to the list of incident fields.

The related fields can be dismissed by selecting Remove Related Fields in blue at the bottom of the list:
Figure 9. Remove related fields
Remove related fields

List collectors

When selecting a list of fields from a list collector (for example, when you are configuring a form), it is also possible to dot-walk to fields from other forms.

To see which fields are reference fields and can be dot-walked, look for green fields with a plus symbol.
Figure 10. Reference fields for dot-walking
Reference fields
Once a reference field is highlighted, the expand icon appears above the add icon.
Figure 11. Expand icon
Expand icon
Selecting the expand icon opens the list of fields from the related list in the Available pane. In this picture, the user has opened the Assigned to fields. As in other examples, the previous lists of fields appear at the top of the list in blue.
Figure 12. Lists of fields
Lists of fields
Once the field is added to the Selected pane, it appears with its full dot-walked syntax. In the next picture, the user has selected Assigned_to.active.
Figure 13. Dot-walked field
Dot-walked field

Scripts

You can dot-walk within a script by invoking the dot-walk syntax.

This functionality requires a knowledge of JavaScript.

For scripts that run on the server side, such as business rules, it is necessary to add current.

The following script, for example, is a scripted approval rule that requests an approval from the manager of the user who opened the ticket.
try {
    current. opened_by. manager ; } catch (err ) { }
For scripts that run on the client side, such as client scripts, current is not necessary. For instance, the following Highlight VIP Caller script runs on the client side.
function onChange (control , oldValue , newValue , isLoading ) {
 
     //wait until there is a valid record in the field if (newValue ) {
 
       //get the caller object so we can access fields var caller  = g_form. getReference ( 'caller_id' ) ;
 
       var callerLabel  = document. getElementById ( 'label.incident.caller_id' ) ; var callerField  = document. getElementById ( 'sys_display.incident.caller_id' )
 
       //check for VIP status if (caller. vip == 'true' ) {
 
         //change the caller label to red background //style object is CSSStyleDeclaration, style names are not standard css names if (callerLabel )
           document. getElementById ( 'label.incident.caller_id' ). style. backgroundColor = 'red' ;
 
         //change the caller's name field to red text if (callerField )
           document. getElementById ( 'sys_display.incident.caller_id' ). style. color = 'red' ; } else { //not a VIP, remove temporary styles if (callerLabel )
           document. getElementById ( 'label.incident.caller_id' ). style. backgroundColor = '' ; if (callerField )
           document. getElementById ( 'sys_display.incident.caller_id' ). style. color = '' ; } } }

Variables

Often, you can add variables into templates, notifications, or other forms where a value is being called from the form.

For example, ${assigned_to} is the variable for the Assigned to field.

As illustrated above, it is possible to dot-walk to fields on the original record of any reference field. In the case above, it is possible to dot-walk to any field on the assigned_to record, for example, ${assigned_to.manager}.

As is always the case with dot-walking, this can be a longer chain if needed, as in this example: ${assigned_to.department.manager.mobile_phone}.

Sometimes this variable can be selected from a tree picker.