Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Following code as in https://www.ptc.com/en/support/article?n=CS260605&source=Case%20Viewer
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
Solved! Go to Solution.
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 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
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.
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...
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