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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Prevent Complete Task if WTdoc is checked out?

GregOlson
15-Moonstone

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

ACCEPTED SOLUTION

Accepted Solutions

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

}

View solution in original post

3 REPLIES 3

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

}

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.

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

Top Tags