AnsweredAssumed Answered

Failed to execute supplied script: Couldn't serialize value 'org.mozilla.javascript.NativeArray

Question asked by mtsiak on Jul 5, 2018
Latest reply on Jul 30, 2018 by mtsiak

I am trying to set the users list that can execute a user task.
So, the user task is something like:

<userTask id="userTask1" name="Review" 
  activiti:assignee="${myflow_reviewassignee.properties.userName}"
  activiti:formKey="myflow:review">
    ...
    <multiInstanceLoopCharacteristics isSequential="false"
       activiti:collection="myflow_supervisors"
       activiti:elementVariable="myflow_reviewassignee">
        <completionCondition>${myflow_reviewapprovalcount != 0}</completionCondition>
      </multiInstanceLoopCharacteristics>
</userTask>

While in a previous serviceTask i am trying to set the user list 'supervisors'

var group = people.getGroup("GROUP_agroup");
var supervisors = people.getMembers(group);
execution.setVariable("myflow_supervisors", supervisors);
...

But i get the error

org.alfresco.scripts.ScriptException: 06040011 Failed to execute supplied script: 
Couldn't serialize value 'org.mozilla.javascript.NativeArray@28879284'
in variable 'myflow_supervisors'
Returning 500 status code

Any ideas?

 

Meanwhile, but for other workflows, if i add a rule on a folder, that starts a workflow when a user uploads a new documents, the workflow start with no errors.


var workflow = actions.create("start-workflow");
//...
var group = people.getGroup("GROUP_agroup");
workflow.parameters["mymodel:peoplelist"] = people.getMembers(group);
//...
workflow.execute(document);

Is there any difference between 'workflow.parameters' and 'execution.setVariable' ?

Outcomes