I want to retrieve a Standard Attribute value created over promotion request thorugh code. can some one help with this?
Hi Sumit,
I am actually working on the same thing. Have you gotten any further since posting? I found this discussion which may be of some help if you haven't yet gotten it: http://communities.ptc.com/message/182669
What attribute are you looking for specifically? Is it an IBA? Are you doing this in a workflow?
I'm not sure about Sumit, but I'm looking for the "description" for the promotion request. Yes, I'm looking to do this in a workflow. I'm afraid I don't know what IBA stands for . Also, I'm looking to add the names of the collected objects of the promotion request in the Approval Notification email - do you know if this is possible? I should note that I'm running 9.1, not 10.1 as Sumit is.
If it is in the Promotion Notice workflow , you can just put
String desc = ((wt.maturityPromotionNotice)PrimaryBusinessObject).getDescription()
primarryBusinessObject is the object who"lived" in the worklfow, and Description is a standard attribute, not an IBA, so you can directly access to it by a get method
Thank you so much! To make sure I understand perfectly, this line of code does not need to be entered as a variable, it can simply be entered directly into one of the text boxes for a notification email?
Thanks again!
No you can't use java code in a mail robot
need to use it in a robot expression and use the variable like for example {myString}
What is the Type Name that should be used? java.lang.String? I tried this but it didn't seem to work. Perhaps I've implemented it incorrectly somehow...
Create a global workflow variable java.lang.String "myString"
In a expression robot, add: String myString = ((wt.maturityPromotionNotice)PrimaryBusinessObject).getDescription();
In the body of the mail robot: add your message and the variable
{myString}
When entering that information, if I hit the "check syntax" button I get the following:
Checking Syntax...
C:\ptc\Windchill_9.1\Windchill\temp\WfExpression_Administrator.java:29: cannot find symbol
symbol : class maturityPromotionNotice
location: package wt
myString = ((wt.maturityPromotionNotice)primaryBusinessObject).getDescription();
^
1 error
Syntax check complete.
This is if I omit "String" in the code provided above. If I include "String" as per above, I get 2 syntax errors. If you try to duplicate this, note that PrimaryBusinessObject should have a lowercase "p".
Thanks in advance.
Upcoming October 2019
Regional User Groups