How to add a user to a Problem Report role via code in Workflow
Through code inside the Workflow, I am able to get a specific user's object by querying their email address. I need to add that user to the Customer Role of the Problem Report so that they will be included in future tasks and notifications. So far, I haven't found any examples of this.
How do I programmatically add a user object to the Customer role of a problem report? Here is the code I has so far which runs in an expression robot:
String requester_query = "mail=me@gmail.com";
wt.org.DirectoryContextProvider dcp = wt.org.OrganizationServicesHelper.manager.newDirectoryContextProvider((String[])null,(String[])null);
java.util.Enumeration users = wt.org.OrganizationServicesHelper.manager.queryPrincipals(wt.org.WTUser.class, requester_query, dcp);
while (users.hasMoreElements()) {
wt.org.WTPrincipal principal=(wt.org.WTPrincipal)users.nextElement();
//principal is the user object that I need to assign to the customer role
//verify the user was found
displayName = principal.getPrincipalDisplayIdentifier();
System.out.println ("Principal Display Identifier - " + displayName);
}
//Add to customer role?

