logo

NJP

Dot Walk from Parent to Child Table

Import · Apr 15, 2020 · article

Running the above script gives you UNDEFINED.

Explaination: The script above will give you 'Undefined' because you are on task table record, and incident_state is a field on incident table.

Solution:

Now to get the result of the original script , we will modify it slightly and get the desired result.

var gr = new GlideRecord('task');gr.addEncodedQuery('number=INC0000001');gr.query();if(gr.next()){

gs.print(gr.ref_incident.incident_state); //Change is highlighted

}

Running the above script will give you the result which is right and expected.

Want to Achieve the same from UI Filters

If you want to go a mile ahead and provide this functionality from UI filter as well, all You need to do is add this system property in your system, if not already present.

glide.ui.list.allow_extended_fields and set its value to true

Now From the UI , from any parent table, you will be able the extended tables as show below

image

The ones with the + at the end represent the extended tables.

Hope this helps:)

View original source

https://www.servicenow.com/community/developer-blog/dot-walk-from-parent-to-child-table/ba-p/2275892