Need help in programmatically advance to next step in CQ 5.5 workflow process step | Community
Skip to main content
yasha34006128
Level 2
October 16, 2015
Solved

Need help in programmatically advance to next step in CQ 5.5 workflow process step

  • October 16, 2015
  • 3 replies
  • 2498 views

Below is the code I am using to programmatically move to next workflow step i.e. auto handler advance programmatically instead of selecting the checkbox auto handler advance on the step.

List<Route> routes = workflowSession.getRoutes(workItem); if(CollectionUtils.isNotEmpty(routes)) { for (Route route : routes) { logger.info("Route: " + route.getName() + " route: " + route); } workflowSession.complete(workItem, routes.get(0)); }

Although the logger gives me the right route information I am not able to proceed to the next step and the workflow goes on running state.

References used for the above code:

API Reference

Similar Question

Kindly let me know what am I missing. Let me know if you need more details and will update the question.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sham_HC

Make sure to get active work item

WorkItem newWorkItem = wfsession.getActiveWorkItems()[0];
wfsession.complete(newWorkItem, wfsession.getRoutes(newWorkItem).get(0));

3 replies

Sham_HC
Sham_HCAccepted solution
Level 10
October 16, 2015

Make sure to get active work item

WorkItem newWorkItem = wfsession.getActiveWorkItems()[0];
wfsession.complete(newWorkItem, wfsession.getRoutes(newWorkItem).get(0));

zeeshanKhan0786
Level 5
October 16, 2015

u have to make a refreence of workitem

new Workitem

and assign it to this

complete(new WorkItem item, Route routeofnextWorkflow) 
smacdonald2008
Level 10
October 16, 2015

This should advance to the next step:

// completing or advancing to the next step
wfSession.complete(workItem, routes.get(0));

See the Javadoc:

https://docs.adobe.com/docs/en/cq/5-5/javadoc/com/day/cq/workflow/WorkflowSession.html