4

I have a workflow.

In the first step it sets a variable called language.

WorkflowData data = workItem.getWorkflow().getWorkflowData();
data.getMetaDataMap().put("language", "English");
workflowSession.updateWorkflowData(workItem.getWorkflow(), data);

Next is "OR SPLIT", it has 2 branches with ECMA script First branch is checked with default and has following

function check(){
   var action = workflowData.getMetaDataMap().get("language");
   return (action == "en_US");
}

Second branch has only,

function check(){
   return true;
}

When the flow runs through first branch, it works fine. If it goes through second branch I face following error.

com.adobe.granite.workflow.WorkflowException: No route found to continue from step node1 in model /etc/workflow/models/example/jcr:content/model. Probably a configuration error.
    at com.adobe.granite.workflow.core.WorkflowSessionImpl.getRoutes(WorkflowSessionImpl.java:734)
    at com.adobe.granite.workflow.core.job.HandlerBase.complete(HandlerBase.java:497)
    at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:336)
    at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:512)
    at org.apache.sling.event.impl.jobs.queues.JobRunner.run(JobRunner.java:205)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

enter image description here

Dileepa
  • 1,019
  • 1
  • 15
  • 40

1 Answers1

6

have you tried adding a no operation step to the second branch?

marwell
  • 116
  • 4
  • You were right. Apart from adding "No Operation" step. Removed "Default Route" and modified the condition to (action === "en_US"). – Dileepa Feb 24 '16 at 15:42
  • Can you also let me know what does "Default Route" serve? – Dileepa Feb 24 '16 at 15:45
  • 2
    The "Default Route" is a strange animal. If you add log.info() to both routes, you will see that there will be 3 log entries. One for the first route, one for the second and one for the default. So it seems that the default will be checked in either way. But, if neither of the routes return true, the default will fail. You should use the default as a fallback route, always returning true. – marwell Feb 26 '16 at 07:49
  • Also notice a strange behaviour. Some times, even when function fail or not, workflow proceeds with the failed/success branch.. O.o, even if noop was added and both situation for default route.. :( – Andrea Bori Jan 10 '17 at 09:35