I have a process step in a workflow which is used to send mail to the initiator of the workflow on getting certain approval or rejection . How do I find the Email ID associated with that particular user in the process step ? How do I retrieve the user from the Workflow Item ?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi,
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);
Thanks
Hi,
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);
Thanks
I could not get the Resource Resolver using the steps that you suggested , so I instead adapted the workflow session into ResourceResolver and the program worked.
Thanks for the help!!
Hi @Ankan_Ghosh ,
You can retrieve the User from the workItem in process step.
workItem.getWorkflow().getInitiator()
and make use of UserManager API to fetch further details.
Hope this helps.
Regards,
Nitesh
Views
Likes
Replies