Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hello All,
My requirement is to add few custom attributes on workflow task page, so user will fill the values while completing the task.
ex. Attributes to add on task page
Attribute Country - Drop down list of country's
Boolean Attribute - Radio options (YES/NO)
How i can achieve this requirement.
Thanks,
Vivek
Hi
Dropdown and checkbox are handled as enumerations.
check this post https://www.ptc.com/en/support/article/CS81989?&language=en&posno=1&q=display%20windchill%20class%20it%20workflow&source=search
Regards
HI Vivek,
Can you please elaborate your request ?
Are you talking about workflow variable or IBA (for an Windchill object -part, document etc ..)
For workflow variable, please use this artciel for dropdown value :
https://www.ptc.com/en/support/article/CS36017?&posno=1&q=workflow%20dropdown&source=search
for boolean, in workflow property create a boolean attribute (it will be global - (so the variable will be available in all the workflow)), and recreate one in the activty linked to the global. The attribute will be displayed in your task.
From the above, if your need is to update an IBA of any Windchill object, you will have to create an expression in the complete activity if variable is local to activy, or in any robot expressoin if variable is global to the workflow, Checkout the object, update the attribute, and checkin the object like this :
wt.doc.WTDocument doc = (wt.doc.WTDocument) primaryBusinessObject;
wt.doc.WTDocument docWorkingCopy = (wt.doc.WTDocument) wt.vc.wip.WorkInProgressHelper.service.checkout(doc,wt.vc.wip.WorkInProgressHelper.service.getCheckoutFolder(), "").getWorkingCopy();
com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject(docWorkingCopy,null,java.util.Locale.getDefault(),new com.ptc.core.meta.common.UpdateOperationIdentifier());
obj.load("MyIBA");
obj.set("MyIBA", Name of the attribute in workflow);
System.out.println("...done setting MyIBA...");
docWorkingCopy=(wt.doc.WTDocument)obj.apply();
wt.fc.PersistenceHelper.manager.modify(docWorkingCopy);
wt.vc.wip.WorkInProgressHelper.service.checkin(docWorkingCopy, "Attributes updated from workflow task.");
System.out.println("Attributes updated from workflow task.");
Hope this is somehow what you need. But if you want detailed reply, please elaborate your request. this kind of question deserve more description while requesting help.
IBA from object cannot be added directly in task, unless if you manage some code to get the value, and to affect it into a workflow variable.
To know more about workflow variable please check the helpcenter in Working with PBO Attributes as Workflow Variables :
Hicham
Hicham