Expand my Community achievements bar.

Workflow OR Split is having issue

Avatar

Level 2

I have 2 branch, I made 1st branch as default and set the below function

function check()
{
 return false;
}

 

it is still going under 1st branch no matter what ever the return value is. I spent so much time understanding why this simple function donot work. I even tried process step just above the OR split and my process step looks like below

var workflowData = workItem.getWorkflowData();
if (workflowData.getPayloadType() == "JCR_PATH") {

    // querying work items
    var workItems = workflowSession.getActiveWorkItems();

    // getting routes
    var routes = workflowSession.getRoutes(workItem,true);


    var payloadPath = workflowData.getPayload().toString();
    var updatedOriginalpath = payloadPath + "/jcr:content/renditions/updated.original";
    var status = (null != updatedOriginalpath) ? workflowSession.getSession().nodeExists(updatedOriginalpath) : false;

    if(status)
    {
        // completing or advancing to the next step
        workflowSession.complete(workItem, routes.get(0));
        log.info("********* Route 1***********");
    }
    else
    {
        workflowSession.complete(workItem, routes.get(1));
        log.info("********* ROUTE 2**************");
    }

}

 

It prints Route2 but it still going under branch 1. Can any one please help?

 

Thanks in advance

2 Replies

Avatar

Level 10

Can you put the screenshot of your workflow model 

Avatar

Level 10

Also which version of AEM are you using?