AnsweredAssumed Answered

Initiate multi user property from within the workflow

Question asked by rob562435 on Sep 4, 2007
I have the following association defined:
   <association name="qcp:qcircleMembers">
    <source>
     <mandatory>false</mandatory>
     <many>false</many>
    </source>
    <target>
     <class>cm:person</class>
     <mandatory>false</mandatory>
     <many>true</many>
    </target>
   </association>
When the workflow is started the association is applied, however the initiator need not select the members at start.
Now I want to fill the property with a few names when the initiator has not filled it with at least a single name. Setting a default would not help since it is harder to detect.
I thought a piece of javascript like the following would do:
   <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
    <script>
     <variable name="qcp_qcircleMembers" access="read,write"/>
     <expression>
      var assignedPersons = qcp_qcircleMembers;
      if (qcp_qcircleMembers == null)
      {
       assignedPersons.add(people.getPerson("Russell Fay"));
       assignedPersons.add(people.getPerson("Martyn Riley"));
       assignedPersons.add(people.getPerson("Hans Vlassak"));
       assignedPersons.add(people.getPerson("Constant Gordon"));
       assignedPersons.add(people.getPerson("Dirk-Jan Doensen"));
      }
      qcp_qcircleMembers = assignedPersons;
     </expression>
    </script>
   </action>
However this does not work since the property is not yet defined and thereby the associated methods.
Is there a way to initiate a new collection of "cm:person"s?
I am using the 2.0 community version for now (not sure whether our company will implement 2.0 or 2.1 in our coming architecture….)

Outcomes