Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Workflow Dynamic Participant Step

chetan001
Level 2
Level 2

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 ?

1 Accepted Solution
Dipti_Chauhan
Correct answer by
Community Advisor
Community Advisor

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");
            }

  

View solution in original post

5 Replies
Bimmi_Soi
Community Advisor
Community Advisor

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

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
Level 2
Level 2

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
Correct answer by
Community Advisor
Community Advisor

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");
            }

  

View solution in original post