Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to dot walk a reference type list field

samarasinghe
Kilo Contributor

Hi,

 

How to dot walk through list type reference field.

 

I have table called escalation. so, there's field called task that's List type field reference to task table.

find_real_file.png

 

 

So, I have to query as below.

 

ticket_number='INC9876234';
var gr = new GlideRecord('u_escalation');
gr .addQuery('u_task[1].number', ticket_number); //ticket_number means INC/SCTASK/RITM/REQ number
gr .query();
if(!gr.hasNext())
{

}

 

 

This is not working. Appreciate any guidance on this, how to dot walk this kind of list type reference field.

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@samarasinghe 

Hi,

Only reference fields are supporting dot walk

List field don't support.

You need to query and that's the only way

1) get the sys_id of the incident you want to search and then use this query

It would look like this and will work fine

var ticket_number = 'INC9876234';

var incRec = new GlideRecord('incident');
if(incRec.get('number', ticket_number)){

	var gr = new GlideRecord('u_escalation');
	gr.addQuery('u_task', 'IN', incRec.getUniqueValue());
	gr.query();
	if(!gr.hasNext())
	{

	}
}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

This didn't work. I tested.

Aman Kumar S
Kilo Patron

Hey,

You can't dotwalk, you will need to glide the table with the sys_id and then pass it along.

Check @Chuck Tomasi 's response :

Dot walking list type field in scripting

 

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

Ankur Bawiskar
Tera Patron
Tera Patron

@samarasinghe 

Hi,

Only reference fields are supporting dot walk

List field don't support.

You need to query and that's the only way

1) get the sys_id of the incident you want to search and then use this query

It would look like this and will work fine

var ticket_number = 'INC9876234';

var incRec = new GlideRecord('incident');
if(incRec.get('number', ticket_number)){

	var gr = new GlideRecord('u_escalation');
	gr.addQuery('u_task', 'IN', incRec.getUniqueValue());
	gr.query();
	if(!gr.hasNext())
	{

	}
}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader