AnsweredAssumed Answered

Assign userTask to user automatically ends task

Question asked by didiere on May 29, 2019
Latest reply on Jun 3, 2019 by didiere

Hi !

 

I'm creating a workflow on Alfresco 6.1 and SDK 4 with only a userTask I want to assign to user or group. The task is automatically end and I can't find this task when I log in with the target user.

 

My definition: 

 

<?xml version="1.0" encoding="UTF-8"?>

<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn"

   xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"

   xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema"

   expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">

 

   <process id="demande-recrutement" name="Lancer le processus de validation d'une demande de recrutement" >

 

      <startEvent id="start"/>

 

       <userTask id="validationPoleRH"

                 name="Affectation de la demande de recrutement au pôle RH"

                 activiti:formKey="rhdr:validationPoleRecrutement"

                 activiti:assignee="monuser" [or activiti:candidateGroups="GROUP_DIDIER"]

       >

           <extensionElements>

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

                   <activiti:field name="script">

                       <activiti:string>

                           logger.log("Creation tâche validation pôle recrutement");

                           logger.log("Affectation au pôle recrutement - " + task.assignee);

                           // here task.assignee displays "monuser"

                       </activiti:string>

                   </activiti:field>

               </activiti:taskListener>

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

                   <activiti:field name="script">

                       <activiti:string>

                           logger.log("Tâche terminée avec la réponse : " + task.getVariable('rhdr_resultatValidation'));

                           // here task.getVariable('rhdr_resultatValidation') displays "null"

                       </activiti:string>

                   </activiti:field>

               </activiti:taskListener>

           </extensionElements>

 

           <!-- These méthods don't work  either -->

           <!--<humanPerformer>-->

               <!--<resourceAssignmentExpression>-->

                   <!--<formalExpression>monuser</formalExpression>-->

               <!--</resourceAssignmentExpression>-->

           <!--</humanPerformer>-->

           <!--<potentialOwner>-->

               <!--<resourceAssignmentExpression>-->

                   <!--<formalExpression>group(GROUP_DIDIER)</formalExpression>-->

               <!--</resourceAssignmentExpression>-->

           <!--</potentialOwner>-->

 

       </userTask>

 

      <sequenceFlow id="flow2" sourceRef="validationPoleRH" targetRef="end">

           <extensionElements>

               <activiti:executionListener event="end" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">

                   <activiti:field name="script">

                       <activiti:string>

                           logger.log("Fin du workflow");

                       </activiti:string>

                   </activiti:field>

               </activiti:executionListener>

           </extensionElements>

      </sequenceFlow>

 

 

      <endEvent id="end" />

 

   </process>

 

</definitions>

 

 

 

 

My model:

<?xml version="1.0" encoding="UTF-8"?>

<model name="rhdr:workflowModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

    <!-- Optional meta-data about the model -->

    <description>Sample Workflow Model</description>

    <author>My Name</author>

    <version>1.0</version>

 

    <imports>

        <!-- Import Alfresco Dictionary Definitions -->

        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>

        <!-- Import Alfresco Content Domain Model Definitions -->

        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>

        <!-- Import Alfresco Workflow Model Definitions -->

        <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm"/>

    </imports>

 

    <!-- Custom namespace for your domain -->

    <namespaces>

        <namespace uri="http://www.alptis.com/model/alptis/rh/demande-recrutement/1.0" prefix="rhdr"/>

    </namespaces>

 

    <types>

        <type name="rhdr:validationPoleRecrutement">

            <parent>bpm:workflowTask</parent>

            <properties>

                <property name="rhdr:resultatValidation">

                    <type>d:text</type>

                    <constraints>

                        <constraint type="LIST">

                            <parameter name="allowedValues">

                                <list>

                                    <value>Validation</value>

                                    <value>Rejet</value>

                                    <value>Incomplet</value>

                                </list>

                            </parameter>

                        </constraint>

                    </constraints>

                </property>

            </properties>

        </type>

    </types>

 

</model>

 

My form:

 

    <config evaluator="string-compare" condition="activiti$validationPoleRecrutement">

        <forms>

            <form>

                <field-visibility>

                    <show id="bpm:workflowDescription" />

                    <show id="packageItems" />

                    <show id="rhdr:resultatValidation" />

                    <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 id="rhdr:resultatValidation" set="other" />

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

                </appearance>

            </form>

        </forms>

    </config>

 

 

Can somone helps me to find what going wrong please ?

Outcomes