
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2014 08:41 AM
I'm having an issue with a background script I'm trying to run.
This is my code...
runTemp(); function runTemp() { var grpStr; var gr = new GlideRecord('sys_template'); gr.addQuery('active','true'); gr.query(); while (gr.next()) { grpStr = String(gr.u_groups); grpStr = grpStr.split(',')[0]; gr.group = grpStr; gr.update(); } }
When I run this I get this 'Evaluator: org.mozilla.javascript.EcmaError: is not a function.' Pointing to my gr.update(); line.
If I comment this line it gives the same error for the above line and so on and so on.
I can't for the life of me see why this isn't working?
Can anyone shine some light on this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2014 01:38 AM
use _next() for sys_template because there is already a field on sys_template called 'next'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2014 01:37 AM
I've changed a few elements to try and find where the problem lays but I've had no joy.
This is the new code...
runTemplateFieldCopy();
function runTemplateFieldCopy() {
var grpStr = '';
var gr = new GlideRecord('sys_template');
gr.addEncodedQuery('active=true^group=NULL^u_groupsISNOTEMPTY');
gr.query();
while (gr.next()) {
if(gr.group == '') {
grpStr = String(gr.u_groups);
grpStr = grpStr.split(",",1)[0];
gr.group = grpStr;
gr.update();
}
}
}
Has anyone else had the Evaluator issue when trying to run background scripts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2014 01:38 AM
use _next() for sys_template because there is already a field on sys_template called 'next'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2014 01:41 AM
Thank you mguy, that was it.
I never thought to see if 'sys_template' had a next field.
Much appreciated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2015 12:17 PM
Just wasted 20 minutes of my life on this. Thanks for the answer!