How to assign a workflow task to dynamically generated WTUser variable
- April 24, 2025
- 1 reply
- 822 views
Windchill 12.0.2.13
Tried approach:
1. I have a custom workflow in which, through an expression, I obtain the attribute(of primary business object) that holds user value. For this user, the reporting manager(type: WTUser) is retrieved from the AD.
2. A workflow variable 'supervisor' of type WTUser is created and the WTUser value obtained in step-1 is assigned.
3. In the workflow activity(Participants tab --> Variables section), the 'supervisor' variable is defined as 'Assignee'.
Expectation: Task, if generated successfully, should be assigned to the 'supervisor' user.
However, on the task page, the variable appears as a dropdown and the task is assigned to the admin.
Workflow expression robot to assign Supervisor value:
try {
wt.doc.WTDocument doc = (wt.doc.WTDocument) primaryBusinessObject;
ext.tools.iba.IBAUtility flsIBinst = new ext.tools.iba.IBAUtility ();
String attUserValue = (String)flsIBinst .getAttributeValue(doc,"flsUserId");
ext.util.ADUtil ADUtilinst = new ext.util.ADUtil();
ADUtilinst.initialize();
Supervisor = ADUtilinst.getUsersManager(attUserValue);
} catch (Exception wfe) {
wfe.printStackTrace();
}
Appreciate any insights! Thanks

