Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Is it possible to get the current user in the workflow?

Avatar

Level 4

I have created a workflow model. Where initiator/author triggers the workflow and assign the payload for approve to the approver. Approver will be triggering the process step. How can I get the approver details in process step? or how can I get the current user details in my workflow?

1 Accepted Solution

Avatar

Correct answer by
Level 3

To get intiator/author :

String intiator = workItem.getWorkflow().getInitiator();

to get approvar details

you have to get it from user manager api.

UserManager userManager = resolver.adaptTo(UserManager.class);
Set<String> toEmails = new TreeSet<>();
Authorizable user = userManager.getAuthorizable(authId);
validateAuthroable(userManager, toEmails, user);

View solution in original post

3 Replies

Avatar

Community Advisor

Hi,

You can get the approver details from the workflow instance. All the information related to the workflow is stored at the /var/workflow/instances.

 

You can use workflow APIs to fetch the details of users who acted on this workflow instance.

https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/adobe/granite/wor...

Avatar

Correct answer by
Level 3

To get intiator/author :

String intiator = workItem.getWorkflow().getInitiator();

to get approvar details

you have to get it from user manager api.

UserManager userManager = resolver.adaptTo(UserManager.class);
Set<String> toEmails = new TreeSet<>();
Authorizable user = userManager.getAuthorizable(authId);
validateAuthroable(userManager, toEmails, user);