AnsweredAssumed Answered

Exclusive Gateway cannot decide on the path of the flow

Question asked by darkredd on Apr 9, 2013
Latest reply on Apr 11, 2013 by darkredd
Hi all,

Backgroung: Working with Activiti engine on Eclipse Juno deploying on Alfresco Version 4.1.3.

We have a custom workflow with multiple exclusive gateways. Now one gateway evaluates two possible outcomes and chooses the task depending on the outcome. We are trying to feed the possible gateway outcome via a (timer and a ScriptTask), this does not work even when the outcome is hard coded in the passing variable. But if the task is completed manually it goes accordingly.
Here are the code snippets:

Possible outcomes sita_reviewOutcome == 'Recommend' or sita_reviewOutcome == 'Reject':
<blockcode>
<sequenceFlow id="flow24" sourceRef="exclusivegateway2" targetRef="qualityassurerTask">
      <extensionElements>
        <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string>&lt;import resource="classpath:alfresco/extension/workflows/scripts/qualitynotification.js"&gt;</activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${sita_reviewOutcome == 'Recommend'}]]></conditionExpression>
    </sequenceFlow>
</blockcode>


Below is the boundaryEvent timer and its associated scriptTask:
<blockcode>
       <boundaryEvent id="reminder" cancelActivity="true" attachedToRef="recommendationTask">
       <timerEventDefinition>
          <timeDuration>PT120S</timeDuration>
       </timerEventDefinition>
    </boundaryEvent>
    <sequenceFlow targetRef="reminderMail" sourceRef="reminder"></sequenceFlow>
    <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;
                  
                  var counter = alltasks[0].transitions;
                  
                  execution.setVariable('sita_reviewOutcome', "Recommend");
                  alltasks[0].endTask("Next");
                  
                   logger.log("Task escalated " + execution.getVariable('sita_reviewOutcome'));
                </activiti:string>
             </activiti:field>
          </activiti:executionListener>
       </extensionElements>
    </scriptTask>
     <sequenceFlow targetRef="exclusivegateway2" sourceRef="reminderMail"></sequenceFlow>
</blockcode>

The above code yields the following exception:
org.mozilla.javascript.WrappedException: Wrapped org.activiti.engine.ActivitiException: No outgoing sequence flow of the exclusive gateway 'exclusivegateway2' could be selected for continuing the process (AlfrescoJS#18)

This exception is only thrown when the timer fires, not in the manual process.

Considering the above, what could be the problem.

Gratitude for you help and inputs.

Regards

Outcomes