11-30-2016 04:19 AM
Hello, i'm trying to assign bpm_assignees variable in the sequence flow, and added this code(Alfresco execution script):
var approvers = ["admin","jack"];
execution.setVariable('bpm_assignees',approvers);
And i get a error like this "Cannot serialize native javascript array to variable".
HELP PLEASE, what i'm doing wrong?
Thanks
11-30-2016 06:28 AM
You are trying to store a native JavaScript array. You must use a Java list for setting multi-valued attributes. Unfortunately creating a Java list is not possible using an inline script in a workflow definition.
Also, bpm:assignees / bpm_assignees typically is a variable on tasks - setting it on the execution can have unintentional side effects.
Is there a reason you cannot set the assignees directly on the task using BPMN constructs? As long as they are static like this there is no reason to use a script.
Also, if you want to set assignees on a task dynamically, you can use the corresponding task API operations, e.g. setAssignee(String) for a single assignee, addCandidateUser(String) to add one of multiple assignees or addCandidateUsers(Collection<String>) to add all in one (in this case the script should be able to automatically convert an array into a collection).
11-30-2016 06:28 AM
You are trying to store a native JavaScript array. You must use a Java list for setting multi-valued attributes. Unfortunately creating a Java list is not possible using an inline script in a workflow definition.
Also, bpm:assignees / bpm_assignees typically is a variable on tasks - setting it on the execution can have unintentional side effects.
Is there a reason you cannot set the assignees directly on the task using BPMN constructs? As long as they are static like this there is no reason to use a script.
Also, if you want to set assignees on a task dynamically, you can use the corresponding task API operations, e.g. setAssignee(String) for a single assignee, addCandidateUser(String) to add one of multiple assignees or addCandidateUsers(Collection<String>) to add all in one (in this case the script should be able to automatically convert an array into a collection).
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.