Workflow Script Error Illeg access to method getMessage in class orb.mozilla.javascript.RhinoException

johnfeist
Mega Sage
Mega Sage

I'm working on an approval workflow where the approval group needs to be determined from the Assignment Group.   I've built a table to match assignment groups to approvers where the assignment group is a reference to sys_user_group.

The script to get the correct recipients is as follows:

workflow.info("In approval step ");

var gr = new GlideRecord("u_incident_change_management_approvers");
gr.addQuery('u_assignment_group', assignment_group);
gr.query();
if (gr.next()){
          var answer = gr.u_approval_group;
          workflow.info("GroupID is " + gr.u_approval_group);
}
else {
          workflow.info("No approval group found");
}

When this executes as part of a Request Approval task, it generates the error message in the title.   I've tried assigning the assignment_group value to a variable and passing that with the same result.   The only time I don't get the error is when the second parameter in gr.addQuery is quoted.   That doesn't get the error, but it also doesn't get the result I need as there is no row in the table with a value of assignment_group.

I suspect that I'm missing something simple but cannot figure out what.   Any assistance will be greatly appreciated.

John

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster
1 ACCEPTED SOLUTION

Shishir Srivast
Mega Sage

if assignment_group is a variable then can you please check what value are there, it should have sys_id?



Also, have you just tried with the sys_id to test if it gives any result? like


gr.addQuery('u_assignment_group', 'SYS ID OF ASSIGNMENT GROUP');



if you are have assignment_group field on the table then I believe you should use current object.


gr.addQuery('u_assignment_group', current.assignment_group);


View solution in original post

2 REPLIES 2

Shishir Srivast
Mega Sage

if assignment_group is a variable then can you please check what value are there, it should have sys_id?



Also, have you just tried with the sys_id to test if it gives any result? like


gr.addQuery('u_assignment_group', 'SYS ID OF ASSIGNMENT GROUP');



if you are have assignment_group field on the table then I believe you should use current object.


gr.addQuery('u_assignment_group', current.assignment_group);


Thank you Shishir.   adding current did it.  


Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster