Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
SOLVED

Dynamic Participant Step assigning to admin instead of previous task completer

Avatar

Level 1

I’m working on an AEM workflow where I want to assign a task dynamically to the user who completed the previous participant step using the OOTB Dynamic Participant Step with the option:
"Assigns to previous task completer"

Here’s the structure of my workflow:

  1. Participant Step 1 → Assigned to User A (e.g., qauser)

  2. Participant Step 2 → Assigned to User B (e.g., designuser)

  3. Dynamic Participant Step → Configured with “Assigns to previous task completer”

Expected Behavior:

The Dynamic Participant Step should be assigned to User B (the last user who completed a task) — in this case, designuser.

ISSUE :

Even though User B (designuser) successfully completes Participant Step 2, the Dynamic Participant Step gets assigned to admin, not designuser.

What I’ve already tried:

  • Ensured the workflow was started by qauser, not admin

  • Confirmed each participant step was completed by the correct user

  • Verified the workflow history: the correct users are completing the steps

  • All steps are standard Participant Steps, not custom

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @NikhilRa8 

Is there a task between Participant Step 2 and Dynamic Participant Step ? If yes then it could be fetching the last task's user. You can implement your own logic for Dynamic Participant Step.Could you please check - https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/ext... 

Arun Patidar

AEM LinksLinkedIn

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @NikhilRa8 

Is there a task between Participant Step 2 and Dynamic Participant Step ? If yes then it could be fetching the last task's user. You can implement your own logic for Dynamic Participant Step.Could you please check - https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/ext... 

Arun Patidar

AEM LinksLinkedIn

Avatar

Level 4

@NikhilRa8 

Fixed similar issue by implementing a custom participant chooser to reliably assign the task.

 

@Component(service = ParticipantStepChooser.class, property = {
        "chooser.label=Previous Task Completer Fix"
})
public class PreviousCompleterParticipantStepChooser implements ParticipantStepChooser {

    private static final Logger LOG = LoggerFactory.getLogger(PreviousCompleterParticipantStepChooser.class);

    @Override
    public String getParticipant(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) {
        String lastUser = getLastCompletedBy(workItem);
        if (lastUser != null && !lastUser.equals("admin")) {
            return lastUser;
        }
        return "fallback-user"; // Optional fallback
    }

    private String getLastCompletedBy(WorkItem workItem) {
        HistoryItem latestRelevant = null;
        for (HistoryItem history : workItem.getWorkflow().getHistory()) {
            if ("Participant".equals(history.getType()) && history.getUserId() != null) {
                latestRelevant = history;
            }
        }
        return latestRelevant != null ? latestRelevant.getUserId() : null;
    }
}

 

Points to note :

  • Always confirm who actually completed each task by checking the workflow history programmatically or in CRX/DE under:
    /var/workflow/instances/server0/{your-workflow-id}/history
  • If you’re using groups, remember that the user completing the task may be recorded as the group or admin, depending on how the workflow is run.
  • Consider enabling detailed audit logging (com.adobe.granite.workflow.core) for debugging participant resolution.

Avatar

Administrator

@NikhilRa8 Did you find the suggestions helpful? If you need more information, please let us know. If a response resolved your issue, kindly mark it as correct to help others in the future. Alternatively, if you discovered a solution on your own, we'd appreciate it if you could share it with the community. Thank you !



Kautuk Sahni