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

We are happy to announce the new Windchill Customization board! Learn more.

get Err during approval promotion workflow

CHASEONHO
18-Opal

get Err during approval promotion workflow

To change the status of a promotional target, we configured the following code:

 

 

wt.maturity.PromotionNotice pn = (wt.maturity.PromotionNotice)primaryBusinessObject;
wt.fc.QueryResult qr= wt.maturity.MaturityHelper.service.getPromotionTargets(pn);

while (qr.hasMoreElements()) 
                  {
                    wt.doc.WTDocument doc=(wt.doc.WTDocument) qr.nextElement();
                    wt.lifecycle.LifeCycleServerHelper.service.setState((wt.lifecycle.LifeCycleManaged)doc,wt.lifecycle.State.toState("DESIGNCHANGE"));
                  }

try
{
wt.util.WTProperties props = wt.util.WTProperties.getLocalProperties();
VERBOSE = props.getProperty("wt.maturity.verbose",VERBOSE);
}
catch( Throwable t )
{
 
}

try{
     wt.maturity.MaturityServerHelper.service.unlockTargets (pn);
} catch (wt.maturity.MaturityException me){
       if ( VERBOSE )
         me.printStackTrace();     
}

 

I got the following error:

wt.util.WTException: java.lang.ClassCastException: wt.part.WTPart cannot be cast to wt.doc.WTDocument
중첩 예외: java.lang.ClassCastException: wt.part.WTPart cannot be cast to wt.doc.WTDocument
중첩 예외: wt.util.WTException: java.lang.ClassCastException: wt.part.WTPart cannot be cast to wt.doc.WTDocument
중첩 예외: java.lang.ClassCastException: wt.part.WTPart cannot be cast to wt.doc.WTDocument
wt.workflow.engine.FailedExpressionException: wt.util.WTException: java.lang.ClassCastException: wt.part.WTPart cannot be cast to wt.doc.WTDocument

 

I tried to promote the part object, but I get the following error:
I knew that if I ran this code on a part, I would ignore it and perform the original workflow.
But it was not.
What should I do?

Thanks

2 REPLIES 2
Jason27
12-Amethyst
(To:CHASEONHO)

the primaryBusinessObject is a part object.

 

change

wt.doc.WTDocument doc=(wt.doc.WTDocument) qr.nextElement();

 to

wt.part.WTPart part=(wt.part.WTPart) qr.nextElement();

 

Dear Jason27

 

If so, does not the same error occur for WTDocument?
I do not know how to handle the API properly, so I have to apply the if statement to specify the lifecycle state only for the WTDocument and the rest to apply the original process?

 

I copied the original Approval promotion Request Process and assigned it as the default process.

 

Thank you.

 

 

Top Tags