Expand my Community achievements bar.

SOLVED

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

Avatar

Level 5

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 4

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...



Arun Patidar

Avatar

Correct answer by
Level 4

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);