AnsweredAssumed Answered

How can I update task properties with data captured from the start task ?

Question asked by livier on Aug 21, 2018
Latest reply on Aug 21, 2018 by livier

I am trying to update task properties with data captured from the START task in the same workflow

 

 <startEvent id="startevent1" name="Start" activiti:formKey="scwf:submitReviewTask">
    <extensionElements>
            <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                    <activiti:string>
                        <![CDATA[
                            execution.setVariable('scwf_toto', task.getVariable('scwf_numAgent'));
                        ]]>
                    </activiti:string>
                  </activiti:field>
            </activiti:taskListener>
        </extensionElements>
    </startEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <userTask id="usertask1" name="Budget" activiti:candidateGroups="GROUP_Budget" activiti:formKey="scwf:activitiBudgetReview">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
              <activiti:field name="script">
                <activiti:string><![CDATA[
                    task.setVariable('scwf_historique', scwf_toto);                    
                ]]></activiti:string>
              </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>
                <![CDATA[
                    if(task.getVariableLocal('scwf_approveRejectOutcome') == 'Approve') {
                        var newApprovedCount = scwf_approveCount + 1;
                        execution.setVariable('scwf_approveCount', newApprovedCount);
                    }
                ]]>
            </activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>

When I try to run the workflow, I get an error message.

scwf_numAgent is a property from an aspect.

scwf_historique is a custom property that I add to my activitiBudgetReview modele

 

Any help please

 

Thanks in advance.

Outcomes