AnsweredAssumed Answered

Ending a userTask from a TimerEvent using the task.endTask(transitionId) method

Question asked by darkredd1 on Apr 22, 2013
Latest reply on Apr 24, 2013 by darkredd1
Hi to all,

I am working on a workflow that has a multiInstance process, I have a requirement to escalate a task if not complete in time (specified).
I am using a timerEvent to trigger this action. However, the task does not end using the endTask() method. Here is a snippet code of what we are working on:

<blockcode>
<scriptTask id="reminderMail">
       <extensionElements>
          <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
             <activiti:field name="script">
                <activiti:string>
                   var workDef = workflow.getDefinitionByName("activiti$submissionWorkflow");
            
                   var instances = workDef.getActiveInstances();
                  
                  var taskid = "activiti$" + execution.getVariable('recotaskId');
                  
                  var instance = instances[0];
                  var paths = instance.paths;
                  
                  var alltasks = paths[0].tasks;
                  execution.setVariable('sita_reviewOutcome', "Recommend");
                  paths[0].signal("Next");
                  var counter = alltasks[0].transitions;

                  logger.log(alltasks[0].name + " task name kkkkkkkkkkkkkkkkkkk");
                  alltasks[0].endTask("Next");
                </activiti:string>
             </activiti:field>
          </activiti:executionListener>
       </extensionElements>
    </scriptTask>
</blockcode>

Our multi-Instance task has two possible outcomes: Recommend or Reject; which leads an exclusive gateway to assess the decision.
What we get is an error about the transaction failing because it does not know where to go after the endTask method.

Thanks for the help in advance

Regards
DarkRedd

Outcomes