- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2022 12:17 AM
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.
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2022 01:38 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2022 01:07 AM
This didn't work. I tested.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2022 01:31 AM
Hey,
You can't dotwalk, you will need to glide the table with the sys_id and then pass it along.
Check
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 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2022 01:38 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
