Workflow Dynamic Participant Step | Community
Skip to main content
chetan001
July 23, 2021
Solved

Workflow Dynamic Participant Step

  • July 23, 2021
  • 3 replies
  • 3703 views

Hi,

 

I have created custom Dynamic Participant Step and getting user from arguments section from Participant chooser column and assigning flow to that person.

 

This follow is working fine for single user but when I am passing AEM group. Workflow is not assigning  to all person who all are in that group.

 

Do I need to use any osgi api which will extract all user within that AEM group ?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Dipti_Chauhan

Hi @chetan001 

  Yes. You can get member emails from group.

Sharing sample code snippet  for your reference 

final UserManager userManager = resourceResolver.adaptTo(UserManager.class); final Resource groupRes = resourceResolver .getResource(userManager.getAuthorizable(/////PASS_GROUP ).getPath()); final Group group = groupRes == null ? null : groupRes.adaptTo(Group.class); final Iterator<Authorizable> memberslist = group.getMembers(); while (memberslist.hasNext()) { final Authorizable user = memberslist.next(); if (user != null && !user.isGroup() && user.getProperty("./profile/email") != null) { // EMAIL ADDRESS FOR MEMBERS user.getProperty("./profile/email"); }

  

3 replies

Adobe Employee
July 23, 2021

Hi @chetan001 ,

 

Please check the below article here its shown how to pick the group and user 

 

https://aem.redquark.org/2019/09/workflows-in-aem-03-dynamic-participant.html

 

You can create a custom  Dynamic Participant workflow step by implementing ParticipantStepChooser. When creating a Dynamic Participant Step, you can use application logic to determine whom to assign the workflow item. In your logic, you can get group information too. All of this can be coded.

 

Hope this helps!!

Thanks

Dipti_Chauhan
Community Advisor
Community Advisor
July 23, 2021

Hi @chetan001 

  It should get assigned to all members of selected group.

Can you share your Participant Chooser step code snippet?

 

Thanks

Dipti Chauhan

chetan001
chetan001Author
July 26, 2021

Hi @dipti_chauhan 

thanks for your reply

 

Yes tested, it is assigning to all members. But As per second requirement custom email should be sent to all that users which is in this AEM group. UserManager Api should work here. Right ? to get user from groups

Dipti_Chauhan
Community Advisor
Dipti_ChauhanCommunity AdvisorAccepted solution
Community Advisor
July 26, 2021

Hi @chetan001 

  Yes. You can get member emails from group.

Sharing sample code snippet  for your reference 

final UserManager userManager = resourceResolver.adaptTo(UserManager.class); final Resource groupRes = resourceResolver .getResource(userManager.getAuthorizable(/////PASS_GROUP ).getPath()); final Group group = groupRes == null ? null : groupRes.adaptTo(Group.class); final Iterator<Authorizable> memberslist = group.getMembers(); while (memberslist.hasNext()) { final Authorizable user = memberslist.next(); if (user != null && !user.isGroup() && user.getProperty("./profile/email") != null) { // EMAIL ADDRESS FOR MEMBERS user.getProperty("./profile/email"); }

  

chetan001
chetan001Author
July 28, 2021
Thanks @dipti_chauhan ,It is very helpful