cancel
Showing results for 
Search instead for 
Did you mean: 

How can I choose the assignee in a previous form?

mafaldap
Star Contributor
Star Contributor

I can't understand why but the assignment doesn't work and the customized form for psw:activitiCreaCS hasn't the fields pswSmiley Very HappySGAincaricato and pswSmiley Very HappySincaricato

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="pswSmiley Very HappySGAincaricato">

  <title>DSGA incaricato</title>

  <source>

  <mandatory>false</mandatory>

  <many>false</many>

  </source>

  <target>

  <class>cmSmiley Tongueerson</class>

  <mandatory>false</mandatory>

  <many>false</many>

  </target>

  </association>

  <association name="pswSmiley Very HappySincaricato">

  <title>DS incaricato</title>

  <source>

  <mandatory>false</mandatory>

  <many>false</many>

  </source>

  <target>

  <class>cmSmiley Tongueerson</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="bpmSmiley TongueackageItemActionGroup">

  <default>edit_package_item_actions</default>

  </property>

  <property name="bpmSmiley SurprisedutcomePropertyName">

  <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="pswSmiley Very HappySGAincaricato"/>

  <show id="pswSmiley Very HappySincaricato"/>

  <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="pswSmiley Very HappySGAincaricato">

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

              

               </control>

               </field>

               <field set="actors" id="pswSmiley Very HappySincaricato">

               <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="pswSmiley Very HappySGAincaricato"/>

  <show id="pswSmiley Very HappySincaricato"/>

  <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="pswSmiley Very HappySGAincaricato">

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

              

               </control>

               </field>

               <field set="actors" id="pswSmiley Very HappySincaricato">

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

              

               </control>

               </field>

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

  </appearance>

  </form>

  </forms>

</config>

11 REPLIES 11

mafaldap
Star Contributor
Star Contributor

I'm doing it like in Creating Custom Advanced Workflows.

jpotts
World-Class Innovator
World-Class Innovator

Zip up your source and attach it, please.