Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hi All,
I need to find out the Role of User who initiate the workflow.
On the basis of user's "Role", Routing of Workflow decided.
Ex. If "Member" Role user initiated a workflow then it will follow different direction like, notify to Product Manager and after approval of "Product Manager" it will start to next process.
But if the Workflow initiator is itself "Product Manager" role user, then in this case no need of Approval and all.
Please let me help to know, which API i have to use to find out a "Role" of a user who initiate the Workflow.
Regards,
Vivek
Vivek Uchekar wrote:
Hi All,
I need to find out the Role of User who initiate the workflow.
On the basis of user's "Role", Routing of Workflow decided.
Ex. If "Member" Role user initiated a workflow then it will follow different direction like, notify to Product Manager and after approval of "Product Manager" it will start to next process.
But if the Workflow initiator is itself "Product Manager" role user, then in this case no need of Approval and all.
Please let me help to know, which API i have to use to find out a "Role" of a user who initiate the Workflow.
Check out article CS126532:
https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS126532
Hi Vivek,
I'm not sure if this is exactly what you need but here is a simple procedure I wrote to print out all the assignees to all roles in a workflow:
public void printAssignees(WfProcess process) {
try {
Vector roles = process.getProcessRoles();
if (roles.size() == 0)
System.out.println("there are no assignees in any roles for this process");
for(int i=0; i < roles.size(); i++) {
wt.project.Role procRole = (Role) roles.get(i);
Enumeration procPrins = process.getPrincipals(procRole);
if (! procPrins.hasMoreElements())
System.out.println("There are no assignees for Role[" + procRole.getFullDisplay() + "]");
while (procPrins.hasMoreElements()) {
WTPrincipalReference roleUserRef = (WTPrincipalReference) procPrins.nextElement();
WTPrincipal p = ((WTPrincipalReference)roleUserRef).getPrincipal();
if (p instanceof WTUser) {
System.out.println("user for Role[" + procRole.getFullDisplay() + "] is [" + p.getPrincipalDisplayIdentifier() + "]");
} else if (p instanceof WTGroup) {
System.out.println("group for Role[" + procRole.getFullDisplay() + "] is [" + p.getPrincipalDisplayIdentifier() + "]");
}
}
}
} catch (WTException e) {
e.printStackTrace();
}
}
I hope this is of some help.
Thanks,
Dave Christy