Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
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
Solved! Go to Solution.
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");
}
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");
}