AnsweredAssumed Answered

How can I choose the assignee in a previous form?

Question asked by mafaldap on Oct 18, 2016
Latest reply on Oct 24, 2016 by jpotts

I can't understand why but the assignment doesn't work and the customized form for psw:activitiCreaCS hasn't the fields psw:DSGAincaricato and psw:DSincaricato

In my bpmn file I have an user task event where I need two select two assignees for other user tasks, like this:

 

<userTask id="creaCS" name="Crea Certificato di Servizio" activiti:candidateGroups="DSGA" activiti:formKey="psw:activitiCreaCS">

    <extensionElements>

    <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">

    <activiti:field name="script">

    <activiti:string><![CDATA[logger.log("Log Log");

    execution.setVariable('DSGAincaricato', task.getVariable('psw_DSGAincaricato'));

    execution.setVariable('DSincaricato', task.getVariable('psw_DSincaricato'));]]>

    </activiti:string>

    </activiti:field>

    </activiti:taskListener>

    </extensionElements>

    </userTask>

 

<userTask id="valutaCS" name="Valuta Certificato di Servizio" activiti:assignee="${DSincaricato.properties.userName}" activiti:formKey="psw:activitiValutaCS">

    <extensionElements>

    <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">

    <activiti:field name="script">

    <activiti:string>if(task.getVariableLocal('psw_esitoValutazioneCS') == 'Approvato'){

    execution.setVariable('psw_prosegui', true);

    }else{

    execution.setVariable('psw_prosegui', false);

    }

    </activiti:string>

    </activiti:field>

    </activiti:taskListener>

    </extensionElements>

    </userTask>

Following a tutorial I wrote a model:

 

<type name="psw:activitiCreaCS">

  <parent>bpm:startTask</parent>

  <associations>

  <association name="psw:DSGAincaricato">

  <title>DSGA incaricato</title>

  <source>

  <mandatory>false</mandatory>

  <many>false</many>

  </source>

  <target>

  <class>cm:person</class>

  <mandatory>false</mandatory>

  <many>false</many>

  </target>

  </association>

  <association name="psw:DSincaricato">

  <title>DS incaricato</title>

  <source>

  <mandatory>false</mandatory>

  <many>false</many>

  </source>

  <target>

  <class>cm:person</class>

  <mandatory>false</mandatory>

  <many>false</many>

  </target>

  </association>

  </associations>

  </type>

 

  <type name="psw:activitiValutaCS">

  <parent>bpm:activitiOutcomeTask</parent>

  <properties>

  <property name="psw:esitoValutazioneCS">

  <type>d:text</type>

  <default>Respinto</default>

  <constraints>

  <constraint type="LIST">

  <parameter name="allowedValues">

  <list>

  <value>Approvato</value>

  <value>Respinto</value>

  </list>

  </parameter>

  </constraint>

  </constraints>

  </property>

  </properties>

  <overrides>

  <property name="bpm:packageItemActionGroup">

  <default>edit_package_item_actions</default>

  </property>

  <property name="bpm:outcomePropertyName">

  <default>{http://www.portaleScuola.com/model/workflow/1.0}esitoValutazioneCS</default>

  </property>

  </overrides>

  </type>

And a share-config-custom.xml like this

 

<config evaluator="task-type" condition="psw:activitiCreaCS">

  <forms>

  <form id="workflow-details">

  <field-visibility>

  <show id="bpm:workflowDescription"/>

  <show id="packageItems"/>

  <show id="psw:DSGAincaricato"/>

  <show id="psw:DSincaricato"/>

  <show id="transitions"/>

  <show id="bpm:status"/>

  </field-visibility>

  <appearance>

  <set id="" appearance="title" label-id="workflow.set.general" />

               <set id="items" appearance="title" label-id="workflow.set.items" />

    <set id="progress" appearance="title" label-id="workflow.set.task.progress" />              

               <set id="other" appearance="title" label-id="workflow.set.other" />

              

               <field id="bpm:workflowDescription" label-id="workflow.field.message">

                  <control template="/org/alfresco/components/form/controls/textarea.ftl">

                     <control-param name="style">width: 95%</control-param>

                  </control>

               </field>

               <field id="packageItems" set="items" />

               <field set="actors" id="psw:DSGAincaricato">

               <control template="/org/alfresco/components/form/controls/authority.ftl">

              

               </control>

               </field>

               <field set="actors" id="psw:DSincaricato">

               <control template="/org/alfresco/components/form/controls/authority.ftl">

              

               </control>

               </field>

               <field id="bpm:status" set="progress" />

  </appearance>

  </form>

  <form>

  <field-visibility>

  <show id="bpm:workflowDescription"/>

  <show id="packageItems"/>

  <show id="psw:DSGAincaricato"/>

  <show id="psw:DSincaricato"/>

  <show id="transitions"/>

  <show id="bpm:status"/>

  </field-visibility>

  <appearance>

  <set id="" appearance="title" label-id="workflow.set.general" />

               <set id="items" appearance="title" label-id="workflow.set.items" />

    <set id="progress" appearance="title" label-id="workflow.set.task.progress" />              

               <set id="other" appearance="title" label-id="workflow.set.other" />

              

               <field id="bpm:workflowDescription" label-id="workflow.field.message">

                  <control template="/org/alfresco/components/form/controls/textarea.ftl">

                     <control-param name="style">width: 95%</control-param>

                  </control>

               </field>

               <field id="packageItems" set="items" />

               <field set="actors" id="psw:DSGAincaricato">

               <control template="/org/alfresco/components/form/controls/authority.ftl">

              

               </control>

               </field>

               <field set="actors" id="psw:DSincaricato">

               <control template="/org/alfresco/components/form/controls/authority.ftl">

              

               </control>

               </field>

               <field id="bpm:status" set="progress" />

  </appearance>

  </form>

  </forms>

</config>

Outcomes