cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Prevent Complete Task if an object is checked out?

vedderkris
1-Newbie

Prevent Complete Task if an object is checked out?

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.

6 REPLIES 6

Following should addrees this

  • Navigate to Organizations―Utilities―Workflow Template Administration―Change Activity Workflow―Edit
  • Open “Complete Change Notice Task” activity icon and add following code under “Transitions”―”Complete”

1.png

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();

}


  • Following pop up will show up to users preventing them from completing task if any resulting object is found checked out

2.png

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);

g_prajeesh
4-Participant
(To:ybagul)

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

g_prajeesh
4-Participant
(To:khawker)

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

Top Tags