Hello there,
I'm currently working on an AEM Approval Workflow, and I've hit a bit of a roadblock. I'm struggling to properly set up the initiator, and I could use some assistance.
Here's a breakdown of my workflow:
The Manager Approval task is a custom implementation of ParticipantChooser, where I retrieve the workflow initiator using:
String initiator = workItem.getWorkflow().getInitiator();
Afterward, I identify all the groups this user belongs to and match the author group to the approval groups. This part works smoothly when I manually start the workflow.
However, my goal is to streamline the process for authors by triggering the workflow automatically when the authors publish content using a launcher.
Here lies the issue: when the launcher triggers the workflow, the user is set to "workflow-service" which prevents me from finding the correct approvers.
I tried using the metadata
String initiator2 = workItem.getWorkflowData().getMetaDataMap().get("userId", String.class);
* Get workflow history */
final List<HistoryItem> histories = workflowSession.getHistory(workItem.getWorkflow());
/* Get last item in workflow history */
final HistoryItem lastItem = histories.get(histories.size() - 1);
/* Get the user that participated in the last item */
final String lastUser = lastItem.getUserId();
Solved! Go to Solution.
Views
Replies
Total Likes
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-retrieve-the-email-...
From workflow item ,you can retrieve user id by this code below
item.getWorkflow().getInitiator();
Code to get mail id .
resourceResolver = getResourceResolver(workflowSession.getSession());
UserManager manager = resourceResolver.adaptTo(UserManager.class);
Authorizable authorizable = manager.getAuthorizable(workItem.getWorkflow().getInitiator());
Value[] email = authorizable.getProperty("./profile/email");
System.out.println(email);
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-workflow-set-user-inpu...
Thanks @VatsalGupta I was able to get unblock by using this.
Views
Replies
Total Likes
@PRHebert Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies