Evaluator: org.mozilla.javascript.EcmaError: is not a function.

Daryll Conway
Giga Guru

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?

1 ACCEPTED SOLUTION

use _next() for sys_template because there is already a field on sys_template called 'next'


View solution in original post

4 REPLIES 4

Daryll Conway
Giga Guru

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?


use _next() for sys_template because there is already a field on sys_template called 'next'


Thank you mguy, that was it.


I never thought to see if 'sys_template' had a next field.


Much appreciated


patk1000
Giga Contributor

Just wasted 20 minutes of my life on this. Thanks for the answer!