AnsweredAssumed Answered

Execution variable data type

Question asked by jurgisl on Nov 26, 2012
Latest reply on Nov 28, 2012 by jurgisl
Hi,

I'm developing a complex workflow using Activiti engine. And I'm struggling with execution variables in the Javascript task listener scripts. I could not find what data types execution.setVariable function accepts, but it seems that it accepts only String data types.

I have a workflow where in one of the middle steps I get multiple assignees, for the next multi instance User Task. I want to store them as an Execution variable, because they will be needed in following tasks. But following code throws an error:

java.lang.ClassCastException: org.alfresco.repo.workflow.activiti.ActivitiScriptNode cannot be cast to java.lang.String


    <userTask id="p_1_3" name="…" activiti:assignee="${wf_responsible}" activiti:formKey="wf:assignCreateResponseTask">
      <extensionElements>
       <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>
              execution.setVariable('wf_assignees', task.getVariable('wf_assignees'));

If I put their usernames in an array and join them with commas, later split them for multi instance loop user task. Another error is thrown, that activiti:collection requires data type Collection. And I found no way to cast javascript native array to Collection data type.

How can I store multiple assignees in a execution variable?
Does this question relate more to Alfresco or Activiti?

Outcomes