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
Looking for assistance with code that will grab a custom attribute value created using T&AM and write it to a variable in a workflow...Then using a custom email template I'll be able to display that value in the email. Not a code guy at all...thanks!!!
WC10.2 M030 CPS 17
Greg
Solved! Go to Solution.
I just want to narrow in on the use case to make sure I understand your scope. You have a workflow generated from a Change object, for example? And you want to grab the value of an IBA that exists on the PBO (the Change object, for example)?
This is documented through WHC. But I have gone through it extensively in the last couple of months. So I can help you if you have any trouble interpreting the WHC article. Search for "working with PBO attributes" in WHC.
Below is an example from my use case. This code is in Execute Expression robot in the workflow template. The PBO in my case is a WTDocument actually - not a Change object.
doc = (wt.doc.WTDocument)primaryBusinessObject;
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(doc,null,null,null);
obj.load("myIBAsInternalNameHere"); // this is the internal name of the IBA
myWorkflowVariableHere = (String)obj.get("myIBAsInternalNameHere"); // assuming myWorkflowVariableHere has already been instantiated somewhere previous
I just want to narrow in on the use case to make sure I understand your scope. You have a workflow generated from a Change object, for example? And you want to grab the value of an IBA that exists on the PBO (the Change object, for example)?
This is documented through WHC. But I have gone through it extensively in the last couple of months. So I can help you if you have any trouble interpreting the WHC article. Search for "working with PBO attributes" in WHC.
Below is an example from my use case. This code is in Execute Expression robot in the workflow template. The PBO in my case is a WTDocument actually - not a Change object.
doc = (wt.doc.WTDocument)primaryBusinessObject;
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(doc,null,null,null);
obj.load("myIBAsInternalNameHere"); // this is the internal name of the IBA
myWorkflowVariableHere = (String)obj.get("myIBAsInternalNameHere"); // assuming myWorkflowVariableHere has already been instantiated somewhere previous
Greg,
Here is the Help for how to access Type managed attributes from the PBO in workflow
As in Ben's example it uses com.ptc.core.lwc.server.PersistableAdapter. If you are using an version of Windchill older then 10.2 the API had a different name - it was LWCNormalizedObject
Thanks for the information, I was able to come up with code for the exp robot based on our consultants and Ben's help!
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter((wt.fc.Persistable)primaryBusinessObject,null,java.util.Locale.US,null);
obj.load("IBAInternalName");
"Variable"= (String)obj.get("IBAInternalName");