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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

About Programmatically assign groups to roles in a workflow

smcvr
15-Moonstone

About Programmatically assign groups to roles in a workflow

In the workflow I created, I need to assign a separate task for each section. I can do this by creating activities for each section. How can I use it in a single activity by assigning it to the role?

ACCEPTED SOLUTION

Accepted Solutions
smcvr
15-Moonstone
(To:avillanueva)

thanks @avillanueva I wrote a code about it

wt.org.DirectoryContextProvider contextProvider = 
wt.inf.container.WTContainerHelper.service.getExchangeContainer().getContextProvider()
; 
wt.org.WTGroup wgroup = wt.org.OrganizationServicesHelper.manager.getGroup(WTGName, 
contextProvider);
wt.query.QuerySpec qs = new wt.query.QuerySpec(wt.org.WTGroup.class);
wt.query.SearchCondition sc = new wt.query.SearchCondition(wt.org.WTGroup.class, 
wt.org.WTGroup.NAME, wt.query.SearchCondition.EQUAL, WTGName);
qs.appendWhere(sc, new int[] { 0 });
for(wt.fc.QueryResult queryResult = wt.fc.PersistenceHelper.manager.find(qs); 
queryResult != null && queryResult.hasMoreElements();)

roleA=null;
wt.team.TeamHelper.service.deleteRolePrincipalMap(wt.project.Role.toRole("SUBMITTER"), 
wtprincial , team );

wt.change2.ChangeIssue ci =( wt.change2.ChangeIssue)primaryBusinessObject;
wt.doc.WTDocument ci =( wt.doc.WTDocument)primaryBusinessObject; 
 team = wt.team.TeamHelper.service.getTeam(ci);

 roleA = wt.project.Role.toRole("SUBMITTER");
 team.addPrincipal(roleA, wgroup );

 WTGName string is a value I assign group name to it

View solution in original post

2 REPLIES 2
avillanueva
22-Sapphire II
(To:smcvr)

I believe I have done something similar to what you are asking. I used role variables in the activity. By programmatically populating the role variable with a role, it pulled members from the PBO team at time of execution. So my activity has 20 role variable which stands in for 20 possible signoffs that could occur. Before the task is started, I populate the variables with a list of roles. I do not need to use all 20 but when the task is issued, say one of the roles is Mechanical Engineering. It sends the signoff to members of the ME role against the change object team which is the primary business object. Would this approach work?

smcvr
15-Moonstone
(To:avillanueva)

thanks @avillanueva I wrote a code about it

wt.org.DirectoryContextProvider contextProvider = 
wt.inf.container.WTContainerHelper.service.getExchangeContainer().getContextProvider()
; 
wt.org.WTGroup wgroup = wt.org.OrganizationServicesHelper.manager.getGroup(WTGName, 
contextProvider);
wt.query.QuerySpec qs = new wt.query.QuerySpec(wt.org.WTGroup.class);
wt.query.SearchCondition sc = new wt.query.SearchCondition(wt.org.WTGroup.class, 
wt.org.WTGroup.NAME, wt.query.SearchCondition.EQUAL, WTGName);
qs.appendWhere(sc, new int[] { 0 });
for(wt.fc.QueryResult queryResult = wt.fc.PersistenceHelper.manager.find(qs); 
queryResult != null && queryResult.hasMoreElements();)

roleA=null;
wt.team.TeamHelper.service.deleteRolePrincipalMap(wt.project.Role.toRole("SUBMITTER"), 
wtprincial , team );

wt.change2.ChangeIssue ci =( wt.change2.ChangeIssue)primaryBusinessObject;
wt.doc.WTDocument ci =( wt.doc.WTDocument)primaryBusinessObject; 
 team = wt.team.TeamHelper.service.getTeam(ci);

 roleA = wt.project.Role.toRole("SUBMITTER");
 team.addPrincipal(roleA, wgroup );

 WTGName string is a value I assign group name to it

Announcements


Top Tags