AnsweredAssumed Answered

Error executing an script in UserTask Workflow

Question asked by jlabuelo on May 21, 2015
Latest reply on Sep 28, 2017 by vmiorga
Hi there

We are creating a usertask in a Alfresco 5.0 Share workflow of type "ActivityReviewTask" so the assigned user can approve or reject the task.

We have included a listener so if the user approves the task an Alfresco Script shoule be lauched.


<userTask id="revisarOT" name="Revisar OT" activiti:assignee="externo" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[var test = bpm_package;
       var doc = test.children[0];
                   if(task.getVariableLocal('wf_reviewOutcome') == 'Approve') {
        doc.properties["my:estado"]="Aprobada_tecnico";
           doc.save();
                   } else {
        doc.properties["my:estado"]="Rechazada_tecnico";
           doc.save();
                   }]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>


however when we click in Approve task or Reject task we get this error


Exception while invoking TaskListener: The field 'script' should be set on the TaskListener


We dont know exactly where the error is. Would you please give us a hand here??

Thanks a lot in advance

Outcomes