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:
Participant Step 1 → Assigned to User A (e.g., qauser)
Participant Step 2 → Assigned to User B (e.g., designuser)
Dynamic Participant Step → Configured with “Assigns to previous task completer”
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.
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
Solved! Go to Solution.
Views
Replies
Total Likes
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...
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...
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 :
@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 !
Views
Replies
Total Likes
Views
Likes
Replies