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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Workflow expression compile error

rbhoraskar
13-Aquamarine

Workflow expression compile error

Following code as in https://www.ptc.com/en/support/article?n=CS260605&source=Case%20Viewer

To set the state of a Change Notice's Resulting Objects in Windchill

 

I am on WC  11.1 M020-CPS03

using the following Code in expression Robot:

 

wt.lifecycle.State state = wt.lifecycle.State.toState("ISSUED");
wt.fc.QueryResult resulting = wt.change2.ChangeHelper2.service.getChangeablesAfter((wt.change2.ChangeOrderIfc) primaryBusinessObject);
while(resulting.hasMoreElements())
{
wt.fc.Persistable persistable = (wt.fc.Persistable) resulting.nextElement();

if (persistable instanceof wt.doc.WTDocument && !wt.vc.wip.WorkInProgressHelper.isCheckedOut((wt.vc.wip.Workable) persistable))
{
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState((LifeCycleManaged)persistable, state);
}
}

 

Here is the error in Compile window >> Check Syntax


Error: MS Logs

2019-07-24 12:06:44,107 ERROR [ajp-nio-127.0.0.1-8010-exec-6] WF_EXEC_EXPR Administrator -    compile - OUT: warning: Supported source version 'RELEASE_7' from annotation processor 'com.microsoft.azure.management.apigeneration.LangDefinitionProcessor' less than -source '1.8'

C:\ptc\Windchill_11.1\Windchill\temp\WfExpression_11.java:46: error: cannot find symbol

      if (persistable instanceof UNDERREVIEW && !wt.vc.wip.WorkInProgressHelper.isCheckedOut((wt.vc.wip.Workable) persistable))

                                 ^

  symbol:   class UNDERREVIEW

  location: class WfExpression_11

C:\ptc\Windchill_11.1\Windchill\temp\WfExpression_11.java:48: error: cannot find symbol

             wt.lifecycle.LifeCycleHelper.service.setLifeCycleState((LifeCycleManaged)persistable, state);

                                                                     ^

  symbol:   class LifeCycleManaged

  location: class WfExpression_11

Note: C:\ptc\Windchill_11.1\Windchill\temp\WfExpression_11.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

2 errors

1 warning

 

Looking for valuable help!

 

Thanks

 

ACCEPTED SOLUTION

Accepted Solutions

Kindly ignore previous comment. I saw that you are doing it from workflow robot. If you are trying it from Workflow, use below code:

 

wt.lifecycle.State state = wt.lifecycle.State.toState("ISSUED");
wt.fc.QueryResult resulting = wt.change2.ChangeHelper2.service.getChangeablesAfter((wt.change2.ChangeOrderIfc) primaryBusinessObject);
while(resulting.hasMoreElements())
{
wt.fc.Persistable persistable = (wt.fc.Persistable) resulting.nextElement();

if (persistable instanceof wt.doc.WTDocument && !wt.vc.wip.WorkInProgressHelper.isCheckedOut((wt.vc.wip.Workable) persistable))
{
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState((wt.lifecycle.LifeCycleManaged)persistable, state);
}
}

 

Copy it in notepad first and then Paste it in robot. it should work.

View solution in original post

7 REPLIES 7

Hi Rahul

 

What is the java version on the Windchill server? I have seen this error in the past where I had Java 1.7 which was not compatible with Windchill 11.1. You may need to check the same.

 

Regards,

Abhijeet

Hi Abhijeet,

Do you mean system JRE or windchill java home ?

Rahul

Kindly ignore previous comment. I saw that you are doing it from workflow robot. If you are trying it from Workflow, use below code:

 

wt.lifecycle.State state = wt.lifecycle.State.toState("ISSUED");
wt.fc.QueryResult resulting = wt.change2.ChangeHelper2.service.getChangeablesAfter((wt.change2.ChangeOrderIfc) primaryBusinessObject);
while(resulting.hasMoreElements())
{
wt.fc.Persistable persistable = (wt.fc.Persistable) resulting.nextElement();

if (persistable instanceof wt.doc.WTDocument && !wt.vc.wip.WorkInProgressHelper.isCheckedOut((wt.vc.wip.Workable) persistable))
{
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState((wt.lifecycle.LifeCycleManaged)persistable, state);
}
}

 

Copy it in notepad first and then Paste it in robot. it should work.

Hi Abhijeet,

I will definitely try that when I am back on server. I wonder if you can help in this expression.

This expression is basically for WTDocument, how should I make it more generic so that it should work for all resulting objects independent of object type like epm or wtpart too?

Looking forward for yours suggestions.

Thanks
Rahul

You can try:

 

Approach 1: Just removing Document type from condition considering CA resulting items allows only WTDocument, WTPart or EPMDocument types in your environment.

 

if (!wt.vc.wip.WorkInProgressHelper.isCheckedOut((wt.vc.wip.Workable) persistable))
{
Condition
}

 

Approach 2: Tweaking if condition to check if the resulting items is any of types WTDocument, WTPart or EPMDocument and not checked out.

 

if ((persistable instanceof wt.doc.WTDocument||persistable instanceof wt.epm.EPMDocument||persistable instanceof wt.part.WTPart) && !wt.vc.wip.WorkInProgressHelper.isCheckedOut((wt.vc.wip.Workable) persistable))

{

Condition...

}

 

Try it on test server and make the necessary changes...

Thanks for suggestions Abhijeet.

Br,
Rahul
rbhoraskar
13-Aquamarine
(To:rbhoraskar)

Hi Abhijeet,

 

this code works for all types of Object in Resulting table.

 

wt.lifecycle.State state = wt.lifecycle.State.toState("ISSUED");
wt.fc.QueryResult resulting = wt.change2.ChangeHelper2.service.getChangeablesAfter((wt.change2.ChangeOrderIfc) primaryBusinessObject);
while(resulting.hasMoreElements())
{
wt.fc.Persistable persistable = (wt.fc.Persistable) resulting.nextElement();

if (!wt.vc.wip.WorkInProgressHelper.isCheckedOut((wt.vc.wip.Workable) persistable))
{
wt.lifecycle.LifeCycleHelper.service.setLifeCycleState((wt.lifecycle.LifeCycleManaged)persistable, state);
}
}

 

Cheers

Rahul

Announcements


Top Tags