Is there an easy way to add a custom attribute only to a specific task in a workflow? For example, in the OOTB Change Notice workflow there is an Audit task. How would I add an attribute to this task only?
Solved! Go to Solution.
Awesome. I actually got this far on my own. Next I want to take that variable information and map it back into an attribute on the change notice that way it is visible on the details of the change.
Any idea what the code for this is?
It ends on what version you're on... LWCNormalizedObject is the API to use for earlier versions, for 10.2 and beyond use PersistableAdapter. See the JavaDoc for your version for code samples
I'm on Windchill PDMLink 10.2 M020. I downloaded the "JavaDoc" but it is way over my head. Any Chance you could supply me with the code snippet I need to put in the expression robot? The internal name of the attribute I am working with is "IFRQ_Number" and the variable is named the same. I tried this code but there is an error when I do check syntax... not sure how to fix or if this is even the correct code:
wt.change2.WTChangeOrder2thisNotice = (wt.change2.WTChangeOrder2thisNotice) primaryBusinessObject;
com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject(thisNotice,null,null,null);
Object nameValue = obj.get("IFRQ_Number");
ChangeNoticeName = obj.get("IFRQ_Number")toString();
Try below code.
wt.change2.WTChangeOrder2 thisNotice = (wt.change2.WTChangeOrder2) primaryBusinessObject;
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(thisNotice,null,null,null);
String IFRQ_Number= (String) obj.get("IFRQ_Number");
Thanks for the help. I dropped that code in my expression robot and hit check syntax and got the following (see image) im not sure how to fix it:
is IFRQ_Number already defined as a workflow process variable? If so drop the String declaration in your code snippet.
If you want to set the value back to the Change Task you need to have an attribute for it. You would use the sequence of:
obj.load("IFRQ_Number"); // assumes that this is what the attribute is called in your Change Object
obj.set("IFRQ_Number", myProcessVariable); //assumes that myProcessVariable is defined in your workflow and is the same data type as IFRQ_Number
// then you need to update the Change Object
Both my Variable and the attribute on the Change notice are called "IFRQ_Number" and both are of type string.
I tried some of the updates and am still getting a syntax error (see image):