Illegal access to getter method getMessage in class org.mozilla.javascript.RhinoException

Puru2
Tera Contributor

Dear All,

One of the custom script in Workflow is throwing the error in Workflow Context as *Illegal access to getter method getMessage in class org.mozilla.javascript.RhinoException*.

The objective of this Workflow activity is to push Group-Approvals.

Following is the code snippet which shows the execution path -->

 

Group-Approval activity : 


if(current.variables.appl){
var arr=[]; 
var rec_arr=[]; 

arr.push(current.variables.appl);

rec_arr=new SCUtils(current).getApplicationApprovals(arr);   //Script Include to call the required group

for(var i=0;i<rec_arr.length;i++){
answer.push(rec_arr[i].toString());
}

 

Script Include

getApplicationApprovals: function (application) {

var arr = [];
var groups = [];
var app_nv = [];

for(var j=0;j<application.length;j++){
app_nv.push(application[j]);
}

for(var i=0;i<app_nv.length;i++){
var record = new GlideRecord('cmdb_ci_appl');
record.addQuery('sys_id',app_nv[i].toString());
record.query();

if(record.next()){

groups.push(record.approval_group.toString());
}
}
return groups;
},

 

 

Please let me know any suitable modification , if any.

 

Best Regards,

Puru

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Puru,

Is that a custom script include?

SCUtils

can you check below links?

https://community.servicenow.com/community?id=community_question&sys_id=15b7c3e9db1cdbc01dcaf3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=dde243a1dbd8dbc01dcaf3231f96...

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Masarrat Siddi1
Kilo Guru

Apply canRead or use GlideRecordSecure, ACL might be an issue here.

 

 

 

Thanks!!

Priyanka95
Kilo Contributor

Did you find any solution to the error?

Phil Mayfield
Giga Contributor

For what its worth anyone coming across this thread, I was getting this error and it happened to be that I had a typo when calling new GlideRecord('my_table_name'), where I had just simply typed 'my_table_name' incorrectly, but the linting and error didnt really lead me in the right direction.