Skip to main content
16-Pearl
March 6, 2015
Solved

Prevent Complete Task if WTdoc is checked out?

  • March 6, 2015
  • 3 replies
  • 1692 views

I would like to add code to the transitions tab in a workflow that would check to make sure the WTdoc used to initiate the workflow is checked in. If it is not I would like an exemption (pop up) to show telling the user to check in the doc.

Does anyone have code they can share?

Greg

Best answer by MarcoFerrari

Sorry my mistake

if(primaryBusinessObject instanceof wt.doc.WTDocument) {

wt.doc.WTDocument doc = (wt.doc.WTDocument) primaryBusinessObject;

if(wt.vc.wip.WorkInProgressHelper.isCheckedOut(doc))

throw new wt.workflow.WfException("Document " + wt.identity.IdentityFactory.getDisplayIdentifier(primaryBusinessObject) + " in c/o state");

}

3 replies

12-Amethyst
March 6, 2015

Try with this:

if(primaryBusinessObject instanceof wt.doc.WTDocument) {

wt.doc.WTDocument doc = (wt.doc.WTDocument) primaryBusinessObject;

if(wt.vc.wipWorkInProgressHelper.isCheckedOut(doc))

throw new wt.workflow.WfException("Document " + wt.identity.IdentityFactory.getDisplayIdentifier(primaryBusinessObject) + " in c/o state");

}

GregOlson16-PearlAuthor
16-Pearl
March 6, 2015

Seems to have an issue:

Checking Syntax...

D:\PTC\Windchill_10.2\Windchill\temp\WfExpression99618082.java:28: error: cannot find symbol

if(WorkInProgressHelper.isCheckedOut(doc))

^

symbol: variable WorkInProgressHelper

location: class WfExpression99618082

Note: D:\PTC\Windchill_10.2\Windchill\temp\WfExpression99618082.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

1 error

Syntax check complete.

12-Amethyst
March 6, 2015

Sorry my mistake

if(primaryBusinessObject instanceof wt.doc.WTDocument) {

wt.doc.WTDocument doc = (wt.doc.WTDocument) primaryBusinessObject;

if(wt.vc.wip.WorkInProgressHelper.isCheckedOut(doc))

throw new wt.workflow.WfException("Document " + wt.identity.IdentityFactory.getDisplayIdentifier(primaryBusinessObject) + " in c/o state");

}