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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Programmatically assign groups to roles in a workflow

JacobH
6-Contributor

Programmatically assign groups to roles in a workflow

I am trying to come up with some code to 

A. Pull groups from org level

B. Assign those groups to an empty role (based on some workflow variable)

 

For example:

 

if workflowVar = A (string), add members from groupA to role

if workflowVar = B (string), add members from groupB to role

 

I was looking at some of the API on the javadocs, but not quite sure where to start. Any help would be very much appreciated!

 

Jacob

1 REPLY 1
shin1h
13-Aquamarine
(To:JacobH)

Hi Jacob,

I implement it with the following code.

// groupA is WTPrincipal which got by OrganizationServicesHelper.manager.getGroup.

WfProcess wfp = (WfProcess) self.getObject();
Team team = TeamHelper.service.getTeam(wfp);

Role roleA = Role.toRole("ROLE_A");
team.addPrincipal(roleA, groupA);

 

Announcements

Top Tags