Skip to main content
1-Visitor
June 3, 2014
Question

Prevent Complete Task if an object is checked out?

  • June 3, 2014
  • 2 replies
  • 2769 views

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.

2 replies

1-Visitor
June 4, 2014

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

1-Visitor
June 5, 2014

Thank you! Can the popup message be edited?

1-Visitor
June 5, 2014

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

1-Visitor
June 18, 2014

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

1-Visitor
June 19, 2014

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