Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Workflow - Duplicate users in participant selection with nested user groups

Avatar

Former Community Member

Hi all,

I am using AEM 5.6.1 and facing issues with the workflow participant step when I have nested participant groups. The issue is that the users in the user selection is duplicated if they belong to a sub group of the main approver group.

Here is the model of my workflow:

Start > Workflow Initiator Participant Chooser > Participant Step > Activate Page/Asset > End

The "Participant Step" will be configured with the main approver group. Basically once the workflow starts, the initiator will be able to go to the next step and select the next user or group to continue the workflow. However, with nested groups, the user which belongs to the sub group appears twice in the dropdown for the initiator's selection. Any way to remove these duplicates with nested user groups?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

Thanks for the steps - I now see the issue.  I consider this a bug - can you file a daycare ticket so we can get it fixed?

In the meantime to get you going I have some steps to fix this on your own.

1) find the file /libs/cq/workflow/components/workitem/routes.json.jsp. 

2) copy that file to the /apps folder to overlay the jsp.  create folder strucutre to mirror this jsp under apps and copy the file to: /apps/cq/workflow/components/workitem/routes.json.jsp

3) now edit the newly copied file under apps (careful not to modify the one under libs!) as follows:

add imports for

import java.util.Set; import java.util.HashSet;add this line before the for loop looping over routes:     
Set existingUsers = new HashSet();

add the following lines after the String participant = ...

String participant = wfNode.getMetaDataMap().get("PARTICIPANT", String.class); if (existingUsers.contains(participant)) { continue; } existingUsers.add(participant);

This will exclude participants from showing up more than once.

Hope this helps!

Will

View solution in original post

3 Replies

Avatar

Employee

Hi,

I am unable to reproduce this - and it should not happen.  Are you sure you don't have more than one user in the system with the same name?  The exclusion that is done on the delegate list is by user path not their name.

(you are talking about the delegate option here correct?)

Will

Avatar

Former Community Member

Hi,

Yup I am sure that there is only one user with that name. I have started a new instance, and configured the following model, as per my initial description

[img]workflow-model.png[/img]

In my main approver group, there is a sub approver group (region approvers group) which contains 2 users. When i run the workflow, I am seeing the following:

[img]select-approver.png[/img]

Thanks!

Avatar

Correct answer by
Employee

Hi,

Thanks for the steps - I now see the issue.  I consider this a bug - can you file a daycare ticket so we can get it fixed?

In the meantime to get you going I have some steps to fix this on your own.

1) find the file /libs/cq/workflow/components/workitem/routes.json.jsp. 

2) copy that file to the /apps folder to overlay the jsp.  create folder strucutre to mirror this jsp under apps and copy the file to: /apps/cq/workflow/components/workitem/routes.json.jsp

3) now edit the newly copied file under apps (careful not to modify the one under libs!) as follows:

add imports for

import java.util.Set; import java.util.HashSet;add this line before the for loop looping over routes:     
Set existingUsers = new HashSet();

add the following lines after the String participant = ...

String participant = wfNode.getMetaDataMap().get("PARTICIPANT", String.class); if (existingUsers.contains(participant)) { continue; } existingUsers.add(participant);

This will exclude participants from showing up more than once.

Hope this helps!

Will