Skip to main content
14-Alexandrite
July 29, 2019
Solved

Workflow expression compile error

  • July 29, 2019
  • 1 reply
  • 6495 views

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

 

Best answer by AbhijeetMule

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.

1 reply

1-Visitor
July 29, 2019

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

14-Alexandrite
July 29, 2019
Hi Abhijeet,

Do you mean system JRE or windchill java home ?

Rahul
1-Visitor
July 29, 2019

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.