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

Workflow Code - How to remove a user from Workflow Team?

Highlighted

Workflow Code - How to remove a user from Workflow Team?

Hello everyone, hope you all had a good Holiday!



I have a question around how to remove a user from a Workflow team of a Promotion workflow.



Basically let’s say there is a Reviewers role for the Promotion workflow. I want to programmatically remove users XYZ every time if they are accidentally added there.



I have an expression that runs after the workflow starts and it does work well BUT...it only removes the user IF the user is directly added to the team. If the user is in the team via a Group, it does not remove the user from the team.




My hope is that someone has an idea of how to handle the group added users as well.


3 REPLIES 3
Highlighted

RE: Workflow Code - How to remove a user from Workflow Team?

Steve,



for example


Group - "Design Approvers" contain 3 users 1) ABC 2) PQR 3) XYZ is added to Approver role and you don't want user XYZ in Approver then you can remove entire group from Approver role and add only two users (1. ABC and 2. PQR) from Design approver group.



Hope this helps !!!

Shreyas

RE: Workflow Code - How to remove a user from Workflow Team?

Hi Steve ,


It is centric around 2 entities ,


1. Are you using Team Template to define the WF Roles & Memeber . OR


2. Shared Team



In the first case , you may need to capture the WFProcess -> Get Team -> Check for the User assigned to that Role and Remove.


In Second case , you need to capture the user assiged in container level and remove the user.



Something like this ,


Team processTeam = TeamHelper.service.getTeam((TeamManaged) wfProcess.getObject());


(HashMap) processTeam.getRolePrincipalMap(); ( Check User)


wt.team.TeamHelper.service.deleteRolePrincipalMap(ownerRole, thePrincipal, team);


ContainerTeamHelper.service.remover() ...



Regards,


Sriram Rammohan

Highlighted

Re: RE: Workflow Code - How to remove a user from Workflow Team?

Hello Sriram,

I have similar type requirement, but in my case i am to remove required role from Workflow. could you please guide, how i can achieve this?

Announcements