- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2020 11:34 PM
Ist that Possible?
check();
function check() {
var gr = new GlideRecord("hr_case");
gr.addActiveQuery();
gr.addQuery('parent.template', '16c971f9db58ec14066c4f63059619b8');
gr.query();
gr.next();
gs.info(gr.parent.template);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2020 01:28 AM
check();
function check() {
var gr = new GlideRecord("hr_case");
gr.addActiveQuery();
gr.addQuery('parent.ref_sm_order.template', '16c971f9db58ec14066c4f63059619b8');
gr.query();
gr.next();
gs.log(gr.number);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2020 11:41 PM
Hi there,
Yes that should be possible.
Are you running into any issues?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2020 11:50 PM
Yes with this example 😉
I tested it wiht a Fix Sript.
Error ist to long to copy
I have also heard that if an error occurs, too many GR elements could be created

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2020 11:52 PM
So can you see anything in that error? For example table hr_case might be incorrect. I would expect sn_hr_case or sn_hr_core_case.
Also double check the template sys_id.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2020 11:55 PM
this should work fine
Can you try to use if(gr.next()) in order to print the value
check();
function check() {
var gr = new GlideRecord("sn_hr_core_case");
gr.addActiveQuery();
gr.addQuery('parent.template', '16c971f9db58ec14066c4f63059619b8');
gr.query();
gr.next();
if(gr.next()){
gs.info(gr.parent.template);
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader