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

Prevent Complete Task if WTdoc is checked out?

SOLVED
Highlighted
Alexandrite

Prevent Complete Task if WTdoc is checked out?

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

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Prevent Complete Task if WTdoc is checked out?

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 3

Re: Prevent Complete Task if WTdoc is checked out?

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

}

Re: Prevent Complete Task if WTdoc is checked out?

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.

Re: Prevent Complete Task if WTdoc is checked out?

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

}

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________ Check out the Windchill Tips Board! We're talking about Whirlpool's use of digital twin, augmented reality, and data-driven design!

The NAVIGATE WORKING GROUP is here! Come innovate with PTC!

Sign up for a Working Group