Receiving error "illegal access to getter method getmessage in class org.mozilla.javascript.rhino exception" in user approval action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2019 02:33 AM
Below is the script I'm using in the approval workflow activity and below that is a screenshot of the workflow and error. I know others have reported this issue before but I wasn't able to glean much in the way of helpful information from their posts. Seems like an error that could arise in response to many different scripting and configurations. I would appreciate any help or suggestions any of you may have.
// Set the variable 'answer' to a comma-separated list of group ids or an array of group ids to add as approvers.
//
// For example:
// var answer = [];
// answer.push('id1');
// answer.push('id2');
if(current.variables.roles=='developer'){
answer.push('f0d6c17313daab84819a3598d144b067'); //Jeffrey Chen
}
else if(current.variables.roles=='governance'){
answer.push('0bcc891d131b6340819a3598d144b0ee'); //Rao Harsha
}
else if(current.variables.roles=='admin'&¤t.variables.admin_access=='infa_tools'){
answer.push('8ed01ff813229a00819a3598d144b0a3');//James Gregory
}
else if(current.variables.roles=='admin'&¤t.variables.admin_access=='dba_edw'){
answer.push('8ed01ff813229a00819a3598d144b0a3');//James Gregory
}
else if(current.variables.roles=='admin'&¤t.variables.admin_access=='edl'){
answer.push('8ed01ff813229a00819a3598d144b0a3');//James Gregory
}
else if(current.variables.function!='Information Technology'&¤t.variables.education=='true'){
answer.push('59d01ff813229a00819a3598d144b056');//Nicole Moses
}
else if(current.variables.function!='Information Technology'&¤t.variables.facilities=='true'){
answer.push('4ed01ff813229a00819a3598d144b09d');//Corey Wong
answer.push('f7c0dbf813229a00819a3598d144b0c2');//Scott Jung
}
else if(current.variables.function!='Information Technology'&¤t.variables.finance=='true'){
answer.push('f7a4186f133b2b005d3870146144b01f');//Libby Souter
}
else if(current.variables.function!='Information Technology'&¤t.variables.gcs=='true'){
answer.push('bac0dbf813229a00819a3598d144b070');//Ashok Gunasekaran
}
else if(current.variables.function!='Information Technology'&¤t.variables.human_resources=='true'){
answer.push('e0bf0c7e130b5600b4223d27d144b043');//Jeremy Bushaw
}
else if(current.variables.function!='Information Technology'&¤t.variables.professional_services=='true'){
answer.push('a24ab33613446fc45d3870146144b026');//Steven Knauer
}
else if(current.variables.function!='Information Technology'&¤t.variables.it=='true'){
answer.push('f1edaaea13f61ec0b4223d27d144b052');//Samantha Keh
}
else if(current.variables.function!='Information Technology'&¤t.variables.legal=='true'){
answer.push('42d01ff813229a00819a3598d144b0a8');//Joseph Bracken
}
else if(current.variables.function!='Information Technology'&¤t.variables. corporate_marketing=='true'){
answer.push('3233d80813869380db7b345fd144b02f');//Anton Van Deth
}
else if(current.variables.function!='Information Technology'&¤t.variables.sales=='true'){
answer.push('a24ab33613446fc45d3870146144b026');//Steven Knauer
}
else if(current.variables.function!='Information Technology'&¤t.variables.sales=='true'){
answer.push('87c0dbf813229a00819a3598d144b087');//Claudia Chandra
}
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2019 03:57 AM
Can you try adding toString() as below?
var sysID = 'f0d6c17313daab84819a3598d144b067 ;
answer.push(sysID.toString());
Or:
or GlideRecord the user table and find sys_id of user and add it like below:
answer.push(grUser.getValue('sys_id'));
Please mark as Correct Answer and Helpful, if applicable.
Thanks!
Abhishek Gardade
Hexaware Technologies
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2020 03:31 PM
You need to initialize answer as an array. So:
var answer = [];
Additionally, it is not recommended to hardcode sys_id's, but if you have to, I would change this code to a switch-case statement instead if-else.