How to dot walk in Business rule

shaik_irfan
Tera Guru

Hello Everyone,

I want to populate a field name which is present on u_bsa table.

On u_bsa table i field named as Req for which was dot walk by sc_req_item table, i want to display that Req for field name for which i written a script like below

i am getting a display value as undefined

var ritm = new GlideRecord('u_bsa');

if(ritm.get(current.sysapproval)){

var req_for = ritm.u_requested_for.name;   //Output i am getting is undefined

var ge = ritm.u_requested_item.number; // I am getting correct output here

gs.addInfoMessage(req_for);

gs.addInfoMessage(ge);

1 ACCEPTED SOLUTION

Try



var req_for = ritm.u_requested_item.u_requested_for.getDisplayValue()



Manish


View solution in original post

16 REPLIES 16

Shaik,



The reason you were getting output as undefined was because ServiceNow was not able to get to the variable. Based on your snapshot, it was evident that the Requested For could not be reached directly and you had to dot walk using the Requested Item variable. Glad the issue was resolved.



Manish


I am trying to do something very similar but I keep getting undefined no matter what I try.



I am using the following:



var gr = GlideRecord('time_card');         //variable gr = GlideRecord(Using the Time Cards table)


var gr1 = GlideRecord('u_district_hours'); //variable gr1 = GlideRecord(Using the District Hours table)


var district = gr.task.location.u_district.getDisplayValue();



var district = gr.task.location.u_district.getDisplayValue(); is returning undefined.



The actually field is 'u_district' located on the time_card table and is dot walked from the task table


showdistrict.JPG



any suggestions?