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:
Kindly let me know what am I missing. Let me know if you need more details and will update the question.
Solved! Go to Solution.
Views
Replies
Total Likes
Make sure to get active work item
WorkItem newWorkItem = wfsession.getActiveWorkItems()[0];
wfsession.complete(newWorkItem, wfsession.getRoutes(newWorkItem).get(0));
Views
Replies
Total Likes
Make sure to get active work item
WorkItem newWorkItem = wfsession.getActiveWorkItems()[0];
wfsession.complete(newWorkItem, wfsession.getRoutes(newWorkItem).get(0));
Views
Replies
Total Likes
u have to make a refreence of workitem
new Workitem
and assign it to this
complete(new WorkItem item, Route routeofnextWorkflow)
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies