- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 04:44 AM
Hi All,
I'm Getting a Error 'org.mozilla.javascript.NativeArray@ede053' while running a before BR Script
(function executeRule(current, previous /*null when async*/ ) {
var grChildTask = new GlideRecord("u_model_resource");
grChildTask.addQuery("u_task_id", current. u_task_id); //check task no field name properly
grChildTask.query();
var TaskAssigneeList=[];
while (grChildTask.next()) {
TaskAssigneeList.push(grChildTask.getValue('u_assignee')); // check field backend name
}
current.u_all_assignee =TaskAssigneeList; // check field backend name
//current.update();
})(current, previous);
Also we have a Sc task and those Sc task have some child task with some task id and child table name is -u_model_resource and the parent table name is sc_task. The name of the child task number field is - u_task_id and the name of the assignee filed is - u_assignee and we want that every time a new task id is created (i.e child task is created) then the BR will run and the new assignee which is added to that list will be update to all the child task assignee list field which is - u_assignee_list.
Please help by providing the correct script to remove the error and to achieve this functionality.
Thanks & Regards,
Siddharth Gupta
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 05:32 AM
@Siddharth4 Try to change the code as below
(function executeRule(current, previous /*null when async*/ ) {
var grChildTask = new GlideRecord("u_model_resource");
grChildTask.addQuery("u_task_id", current.u_task_id); //there was a space between current. and u_task_id
grChildTask.query();
var TaskAssigneeList=[];
while (grChildTask.next()) {
TaskAssigneeList.push(grChildTask.getValue('u_assignee')); // check field backend name
}
current.u_all_assignee =TaskAssigneeList.toString(); //As the field is of string type and we are trying to store array in it
current.update();
})(current, previous);
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 01:55 AM
@Siddharth4 Any error you are getting?
Please try to add the logs line by line and check where the code is getting stuck.
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023