Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
How can I prevent the workflow continuing to the next task, if the user still has the "Resulting Objects" checked out? (Windcill PDMLink 9.1).
When the user clicks "Complete Task", and an object is still checked out the workflow breaks (stalls). What can I add so the workflow checks for the checked out object and pops up a message to the user that the object is still checked out? I have very little programming. Thanks.
Following should addrees this
wt.change2.WTChangeActivity2 ca = (wt.change2.WTChangeActivity2)primaryBusinessObject;
try {
wt.fc.QueryResult objQueryResult = wt.change2.ChangeHelper2.service.getChangeablesAfter(ca);
while(objQueryResult.hasMoreElements()){
wt.enterprise.RevisionControlled obj = (wt.enterprise.RevisionControlled) objQueryResult.nextElement();
if(wt.vc.wip.WorkInProgressHelper.isCheckedOut(obj)){
java.lang.Exception e = new Exception("Please make sure all resulting objects are checked in before completing task");
result=false;
throw new wt.workflow.engine.FailedTransitionException(e);
}
}
} catch (wt.util.WTException e) {
e.printStackTrace();
}
Thank you! Can the popup message be edited?
Folllowing exception was an attempt for that, but it does not seem working. I have seen it working in other custom workflows for transitions in activity robots though.
java.lang.Exception e = new Exception("Please make sure all resulting objects are checked in before completing task");
throw new wt.workflow.engine.FailedTransitionException(e);
Please remove catch on WTException and throw as new WTException. It should work
wt.change2.WTChangeActivity2 ca = (wt.change2.WTChangeActivity2)primaryBusinessObject;
wt.fc.QueryResult objQueryResult = wt.change2.ChangeHelper2.service.getChangeablesAfter(ca);
while(objQueryResult.hasMoreElements()){
wt.enterprise.RevisionControlled obj = (wt.enterprise.RevisionControlled) objQueryResult.nextElement();
if(wt.vc.wip.WorkInProgressHelper.isCheckedOut(obj)){
result=false;
throw new wt.util.WTException("Please make sure all resulting objects are checked in before completing task");
}
}
Hello
Will the above code only work in the Change Activity workflow?
Is there a way to make it more generic to use in workflows that have been created and are not OOTB?
Many Thanks
Hi,
in the above code, some part is specific to Change Activity.
but the following part can be used as Generic
wt.enterprise.RevisionControlled obj = (wt.enterprise.RevisionControlled) objQueryResult.nextElement();
if(wt.vc.wip.WorkInProgressHelper.isCheckedOut(obj)){
result=false;
throw new wt.util.WTException(obj.getDisplayIdentity()+" is checked out" );
}
Kelly Hawker wrote:
Hello
Will the above code only work in the Change Activity workflow?
Is there a way to make it more generic to use in workflows that have been created and are not OOTB?
Many Thanks