- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2025 07:08 AM
Hello all,
I am attempting to query the sys_template table with gliderecord and it appears that I cannot query the table to get a record set. I CAN however, query the table for individual records with this code:
var template = new GlideRecord('sys_template');
template.get('675a23363b50265014266ea9e5e45a90');
gs.debug(template.getValue('template'));
var regexMatch = /assignment_group=(.*?)\^/.exec(template.getValue('template'));
if (regexMatch && regexMatch[1]){
gs.debug(regexMatch[1]);
} else {
gs.debug('No assignment group value.');
}
What am I missing here?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 06:32 AM - edited 03-27-2025 06:37 AM
Heya,
This is due to sys_template table having a field called "next", and I am assuming you are trying to use something in the vein of "template.next()" to query through records.
As a workaround you can try using "._next()":
var grST = new GlideRecord("sys_template");
grST.addEncodedQuery('active=true');
grST.setLimit(5);
grST.query();
while (grST._next()){
gs.info(grST.template.toString());
}
It works for me [Washington DC Patch 10 hotfix 2].
Edit: Found the relevant dev docs as well:
https://developer.servicenow.com/dev.do#!/reference/api/washingtondc/server_legacy/c_GlideRecordAPI#...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 06:32 AM - edited 03-27-2025 06:37 AM
Heya,
This is due to sys_template table having a field called "next", and I am assuming you are trying to use something in the vein of "template.next()" to query through records.
As a workaround you can try using "._next()":
var grST = new GlideRecord("sys_template");
grST.addEncodedQuery('active=true');
grST.setLimit(5);
grST.query();
while (grST._next()){
gs.info(grST.template.toString());
}
It works for me [Washington DC Patch 10 hotfix 2].
Edit: Found the relevant dev docs as well:
https://developer.servicenow.com/dev.do#!/reference/api/washingtondc/server_legacy/c_GlideRecordAPI#...