This article is about dot walking in ServiceNow lot of  times you must have got requirement when you have to access Fields of table of reference field value which is actually not on the same table you’re working on then dot walking comes into the picture.  Dot Walking allows direct access to the fields and field Values on reference records in conditions, filters and scripting. Let’s see you need to update the assignee of an incident for the location of caller however location of caller which is referencing to the user table is not on incident table and you cannot access directly in that case you can access caller location by dot walking.

Access Data of Referenced Table Fields

This is the Incident table in ServiceNow in which you can see table fields now in this table there is one field which is the caller field and this field is a reference field that means this caller field is referencing the user table that is another table now this user table has its own field. for eg if we want find the user’s first name, last name, email, user  id of the caller you need to do dot walking.

Condition:

You can use dot walking in condition you can see in the above screenshot I have selected caller location, so I have to select the value caller’s location but caller’s location is not in incident table so in that case we can use related field condition in order to find the caller location.

Scripting:

You can also use dot walking in scripting and the syntax is Object.related_object.field_nameFor example if we want to find the caller email id of the current record we can use below script to access the email of the caller.eg: Current.caller_id.email

Dot Walking in Client Script:

In incident table we can only see caller name field. we can create client script for dot walking. Right click on the incident table click on configure Client Scripts.

Now I will guide you how to configure client scripts. Click on New

Below screenshot shows the client script form we can add all the required details and select the type as on load and in the scripting area we can type our script for dot walking

Client Scriptfunction onload() {var caller = g_form.getReference’caller_id’,callBack);function  callBack(caller){alert(“The email of caller is +caller.email;”)                                          }                                }

Dot Walking in Business Rule:

We can also use dot walking in Business Rule.Script:
(function executeRule(current, previous) {var callerEmail = current.caller_id.email;gs.addInfoMessage(“The mail address of caller is + callerEmail”);})(current, previous); 

1 CommentClose Comments

1 Comment

  • Minerva
    Posted April 24, 2022 at 10:15 pm 0Likes

    I loved as much as you’ll receive carried out right
    here. The sketch is attractive, your authored material
    stylish. nonetheless, you command get got an nervousness over that you
    wish be delivering the following. unwell unquestionably come further formerly again as exactly
    the same nearly very often inside case you shield this increase.

Leave a comment

Newsletter Subscribe

Get the Latest Posts & Articles in Your Email

We Promise Not to Send Spam:)