AnsweredAssumed Answered

Come posso selezionare l'assignee in un user task precedente?

Question asked by mafaldap on Oct 18, 2016
Latest reply on Oct 20, 2016 by mafaldap

Sto creando un workflow personalizzato e avrei bisogno di far selezionare l'assegnatario di un task in uno dei passaggi precedenti. Ho fatto un tentativo ma provandolo su Alfresco non viene riconosciuto l'assegnatario (nemmeno quello di gruppo) e non compaiono neanche i campi dei form personalizzati che ho definito. Riporto alcune parti del codice.

Nel file bpmn:

<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>

Nel modello:

<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>

Sul progetto share:

<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