- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 05:27 AM
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);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 06:10 AM
Try
var req_for = ritm.u_requested_item.u_requested_for.getDisplayValue()
Manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 07:27 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2017 10:40 AM
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
any suggestions?