cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically assigning workflow tasks to roles

Highlighted
Newbie

Dynamically assigning workflow tasks to roles

All,

We have a use case where we have a variety of documents that get routed for approval to selected roles based on the type of document it is. We capture their signatures for approval and get audited on the results. Since we have so many types of documents, when it was first setup, we had a workflow per document type which resulted in us having 50+ workflows to maintain. If the roles changed or any part of the process changed, we were left with updating all of the workflow processes to reflect the change.

We then started using the team template variable inside the workflow and how have a single workflow process and multiple teams instead. It works great and maintaining the teams is much easier than modifying the processes.

Here's the issue: when you use the teamTemplate variable in a workflow activity for the participant, the roles don't come across (even though the variable is resolved against the product container). So the participants are populated correctly (the required people are getting the tasks), but the roles are all set to "Assignee". From an audit standpoint, this fails for us since we can't track people back to their roles to ensure that all the correct people signed off on a document. I've opened a call with PTC but they're saying this is to spec.

Am I off here or has anyone else run into a similar situation? We feel that the tasks should be going to the roles on the team and should show up as such for the Signatures tab. We're trying to come up with a resolution but the only thing we've got so far is to go back to the multiple workflow setup again which is a nightmare.

Any suggestions, greatly appreciated,

Jason


4 REPLIES 4

RE: Dynamically assigning workflow tasks to roles

Jason,

You can use this code to set a user to a role for a workflow:

wt.project.Role author_role = wt.project.Role.toRole("AUTHOR");
wt.workflow.engine.WfProcess wfprocess = ((wt.workflow.engine.WfProcess)(self.getObject()));
wt.team.Team team = (wt.team.Team) wfprocess.getTeamId().getObject();

wt.doc.WTDocument doc = (wt.doc.WTDocument)primaryBusinessObject;
wt.org.WTUser user = null;

String UserName = doc.getCreatorName().toString();

user = wt.org.OrganizationServicesHelper.manager.getAuthenticatedUser( UserName.toLowerCase() );

wt.team.TeamHelper.service.addRolePrincipalMap( author_role, user, team );







Note - you can get the user using the WTUser list (this can get quite big) or drop in some code to pick from a group. Another alternative (if you are on 8.0) is to use the Promote tool as it allows much of this to be dynamic OOTB.

z

RE: Dynamically assigning workflow tasks to roles



In Reply to Jeff Zemsky:

wt.workflow.engine.WfProcess wfprocess = ((wt.workflow.engine.WfProcess)(self.getObject()));

Hi,

I'm trying to get the wfprocess from a WTDocument but I can't find the appropiate method. Could you please specificate which kind of object is that "self" in your code?

thanks in advance.

regards

Felipe

RE: Dynamically assigning workflow tasks to roles

"self" is a variable provided to you by default in any workflow. It is of type wt.workflow.engine.WfProcess.

RE: Dynamically assigning workflow tasks to roles

Ah ok,

I thought it was inside a java class. How can I get the WorkFlow of a WTDocument anyway?

regards

Announcements
LiveWorx Call For Papers Happening Now!