Illegal access error in workflow

oliver_shields
Mega Contributor

Ive written the below code in an 'Approval - User' activity on a workflow. Its purpose is to pull users from a glide list field on the software table (the field itself is on the cmdb_ci table) and add them as approvers on a REQ task. However im getting this error: Illegal access to getter method getMessage in class org.mozilla.javascript.RhinoException

Please dont mock my code too much, im not a coder and most of my codes are frankensteins monsters from other bits of code people have written:

var r = new GlideRecord('sc_req_item');
r.addQuery('request',current.sys_id);
r.query();
if(r.next())
{	
var Approvers = (r.Variables.please_select_the_software_you_would_like.u_sw_add_approvers) ;
}
{
answer.push = Approvers;
}

Thanks for any assistance.

12 REPLIES 12

Hi,

 

Unfotunately this doesnt work. Ive also used it in conjuction with the script @Abhishek Gardade provided below.

 

Thanks

AbhishekGardade
Giga Sage

Why you are not pushing approvers like this:

var r = new GlideRecord('sc_req_item');
r.addQuery('request',current.sys_id);
r.query();
if(r.next())
{
var Approvers = (r.Variables.please_select_the_software_you_would_like.u_sw_add_approvers.toString()) ;
}
answer.push(Approvers);

Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade

Thank you,
Abhishek Gardade

Thanks for the reply.

 

Ive tried this full script and its still throwing back the same error.

 

Thanks

Hi Oliver,

Can you share the updated script?

Regards

Ankur

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

var r = new GlideRecord('sc_req_item');
r.addQuery('request',current.sys_id);
r.query();
if(r.next())
{
var Approvers = (r.Variables.please_select_the_software_you_would_like.u_sw_add_approvers.toString()) ;
}
answer.push(Approvers);