Hi,
I am creating custom workflow for requirement.I have created a new process step for meta data validation. Based on the output of process step i have to decide the flow.
If the validation passed it need to go to different user
Else it need to send back to assigner.
For this I used below code snippet
if(custTag.getTitle().equalsIgnoreCase("Summer")){ //For testing I added validation based on tag title value n = jcrSession.getNode(path); n.setProperty("validateFlag", true); jcrSession.save(); } List<Route> routeList = arg1.getRoutes(arg0, false); if(!validateFlag) //default value is false { arg1.complete(arg0, routeList.get(0)); } else { arg1.complete(arg0, routeList.get(1)); }
I added the validate Flag property to asset.But the value is not getting overridden if the condition satisfies. Please guide me how to proceed with this
Thanks!
Kirithi
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
I am a bit confused by what you're trying to accomplish here. You have hard coded the fact that there are two routes leaving the step in question in the workflow model. I'm curious why you don't put the logic as to which route to follow in the route rule in the model? That way there should be no issue, it will be far more dynamic, and you can just use "handler advance" on the step and you won't even need to call complete.
Also your code snippet is quite hard to follow since the 'validateFlag' local variable simply exists out of the blue and I have no idea where you populate it's value. Presumably you load it from somewhere, I guess check that code to verify it's doing what you expect.
Will
Views
Replies
Total Likes
Hi,
I am a bit confused by what you're trying to accomplish here. You have hard coded the fact that there are two routes leaving the step in question in the workflow model. I'm curious why you don't put the logic as to which route to follow in the route rule in the model? That way there should be no issue, it will be far more dynamic, and you can just use "handler advance" on the step and you won't even need to call complete.
Also your code snippet is quite hard to follow since the 'validateFlag' local variable simply exists out of the blue and I have no idea where you populate it's value. Presumably you load it from somewhere, I guess check that code to verify it's doing what you expect.
Will
Views
Replies
Total Likes
If you are reading 'validateFlag' from jcr in your condtion, then you will have to refresh your jcrSession after saving.
In Oak, jcrsession will represent the state of the repository when it is created and the latest. You have to refresh it explicitly to get the latest state of a repository.
Views
Replies
Total Likes
Hi,
I tried refreshing the repository but it is not overriding.Please guide me on this
jcrSession.refresh(true);
Thanks!
Kirithi
Views
Replies
Total Likes
I tried this and it works when I save the session
Views
Replies
Total Likes
Hi,
Please confirm me have you tried setting the property in the above way?
Views
Replies
Total Likes
Yup..
workflowSession.complete(workItem, workflowSession.getRoutes(workItem, false).get(0));
adminSession.save();
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies