cancel
Showing results for 
Search instead for 
Did you mean: 

Why the workflow doesn't catch the assignee from bpm:assignee?

mafaldap
Star Contributor
Star Contributor

My workflow doesn't get first group assignment and also it gives me an error using bpm:assignee

Schermata 2016-10-20 alle 15.49.54.png

Any advice?

1 ACCEPTED ANSWER

afaust
Legendary Innovator
Legendary Innovator

The first option. The second does not do anything at all - the "var" is immediately being lost when the script context is exited.

View answer in original post

7 REPLIES 7

afaust
Legendary Innovator
Legendary Innovator

In your case the bpm_assignee cannot be resolved because you have not passed on the data from the task where the user sets if (creaCSS user task) so that the other task (valutaCSS) can used. Data is not automatically transferred from a task to the workflow and you must define task listeners to copy the data you need. You have done so already for psw_esitoValutazioneCS in the second task but must also do this for bpm_assignee in the first.

mafaldap
Star Contributor
Star Contributor

Ok, so I need something like this in my "creaCSS" task?

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

     <activiti:field name="script">

          <activiti:string>

               <![CDATA[execution.setVariable('bpm_assignee', task.getVariableLocal('bpm_assignee'))]]>

          </activiti:string>

     </activiti:field>

</activiti:taskListener>

Or I need another variable like this:

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

     <activiti:field name="script">

          <activiti:string>

               <![CDATA[var assegnatario = task.getVariableLocal('bpm_assignee')]]>

          </activiti:string>

     </activiti:field>

</activiti:taskListener>

And then I have to pass "assegnatario" to "valutaCSS", so something like

<userTask id="valutaCSS" name="Valuta Certificato di Servizio (semplice)" activiti:formKey="psw:activitiValutaCS">

      <extensionElements>

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

          <activiti:field name="script">

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

    execution.setVariable('psw_prosegui', true);

    }else{

    execution.setVariable('psw_prosegui', false);

    }]]></activiti:string>

          </activiti:field>

        </activiti:taskListener>

      </extensionElements>

      <humanPerformer>

                <resourceAssignmentExpression>

                    <formalExpression>${assegnatario.properties.userName}</formalExpression>

                </resourceAssignmentExpression>

            </humanPerformer>

    </userTask>

afaust
Legendary Innovator
Legendary Innovator

The first option. The second does not do anything at all - the "var" is immediately being lost when the script context is exited.

mafaldap
Star Contributor
Star Contributor

Thank you very much, now it works Smiley Happy

kaynezhang
World-Class Innovator
World-Class Innovator

Did your share-config-custom contain an task-type entry  that corresponds to the  content type "psw:activitiCreaCSSemplice"?

No, I didn't, I'm doing it now

mitpatoliya
Star Collaborator
Star Collaborator

Few points

  • I do not see any out going flow from your first user task.
  • In none of your task forms you have added bpm:assignee. In order to use it you have to include it as part of your  tasks in workflow model and need to include it in form for task where you want it to be selected.
  • For using group assignment you will have to use bpm_groupAssignee

Hope this helps you to figure out your issue.