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
Hi Mike,
I know this is an old post but, how did you add the ECN number to the front of the Workflow Task name? I tried to add {primaryBusinessObject} to the Name field of the Activity node but that didn't work.
Hi Raymond,
My client having similar type requirement and have tried the above code for WTDocument Type, however while executing the Check Syntax, Its giving errors,
Kindly help me out to execute the same.
Do i need to create *.java file to execute the above code?
Thanks in advance.
Regards,
Mahesh Kumar G
What is the code that you're using to give you syntax errors? Can you post the code?
Ben,
I am using this below code for WTDocument Type "FM01",
I have created workflow variable, "number",
Code:
java.lang.String number = ((wt.WTdocument|com.ptc.abc.FM01)primaryBusinessObject).getNumber();
wt.workflow.engine.WfActivity myActivity =(wt.workflow.engine.WfActivity)self.getObject();
String prefix=myActivity.getName();
if (!prefix.endsWith(number)) {
java.lang.String Activity_Name = prefix + ": " + number;
myActivity.setName (Activity_Name);
myActivity = (wt.workflow.engine.WfActivity) wt.fc.PersistenceHelper.manager.save(myActivity);
}
Please find the Syntax error,
Checking Syntax...
F:\ptc\Windchill_10.2\Windchill\temp\WfExpression2582982.java:28: error: variable number is already defined in method executemethod_1(Object[])
java.lang.String number = ((wt.doc.WTdocument|com.abc.FM01)primaryBusinessObject).getNumber();
^
F:\ptc\Windchill_10.2\Windchill\temp\WfExpression2582982.java:28: error: cannot find symbol
java.lang.String number = ((wt.doc.WTdocument|com.abc.FM01)primaryBusinessObject).getNumber();
^
symbol: class doc
location: package wt
F:\ptc\Windchill_10.2\Windchill\temp\WfExpression2582982.java:28: error: cannot find symbol
java.lang.String number = ((wt.doc.WTdocument|com.abc.FM01)primaryBusinessObject).getNumber();
^
symbol: class abc
location: package com
Note: F:\ptc\Windchill_10.2\Windchill\temp\WfExpression2582982.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
Syntax check complete.
Hi Mahesh,
Please change to
java.lang.String number = ((wt.WTDocument)primaryBusinessObject).getNumber();
wt.workflow.engine.WfActivity myActivity =(wt.workflow.engine.WfActivity)self.getObject();
String prefix=myActivity.getName();
if (!prefix.endsWith(number)) {
java.lang.String Activity_Name = prefix + ": " + number;
myActivity.setName (Activity_Name);
myActivity = (wt.workflow.engine.WfActivity) wt.fc.PersistenceHelper.manager.save(myActivity);
}
Regards
Sudhakar
Hi Sudhakar,
I am using WTDocument sub type, shall i use full name for sub type document or Only WTDocument Name?.
Thanks in Advance.
Regards,
Mahesh Kumar G
Hi Mahesh,
For all MBAs you use WTDocument If you want get Typed Attributes use LWCNormalizedObject.
Regards
Sudhakar
Mahesh,
I also notice some other things just by looking at the code.
number = ((wt.doc.WTDocument)primaryBusinessObject).getNumber();
wt.workflow.engine.WfActivity myActivity =(wt.workflow.engine.WfActivity)self.getObject();
String prefix=myActivity.getName();
if (!prefix.endsWith(number)) {
java.lang.String Activity_Name = prefix + ": " + number;
myActivity.setName (Activity_Name);
myActivity = (wt.workflow.engine.WfActivity) wt.fc.PersistenceHelper.manager.save(myActivity);
}