Skip to main content
12-Amethyst
April 24, 2025
Solved

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

Best answer by SriTalatam

Thanks to my colleague, the solution here is to update the variable properties with:

1. Disabling visible property.

2. Declare the same variable in both 'Initialize From' and 'Copy Into'. 

This ensured to assign the WTUser value generated through expression, to the approval task. 

1 reply

SriTalatam12-AmethystAuthorAnswer
12-Amethyst
April 28, 2025

Thanks to my colleague, the solution here is to update the variable properties with:

1. Disabling visible property.

2. Declare the same variable in both 'Initialize From' and 'Copy Into'. 

This ensured to assign the WTUser value generated through expression, to the approval task.