Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

How to get current logged in user details in workflow process step

Avatar

Level 2

I tried to get current logged in user using session and authorizable. But none of them giving the current user.

Is there any other way to get the current user details ?

6 Replies

Avatar

Community Advisor

Are you referring to initiator of the workflow user if that’s the case then please refer to https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/is-it-possible-to-get-the-...

current user can be found from session object 

session.getUserID();

I am not sure what’s the use case you have to get the current use in workflow process step and I believe in workflow you work with workflow session and not the current user session.

Avatar

Level 2

Hi,

I need to check initiator and approver are same user or not. 

 

session.getUserID()

will return workflow-service user id not the user who logged in. 

Avatar

Employee Advisor

A workflow process step is a piece of code, which runs in the background. For that it is not bound to a HTTP request and also not to a user in the first place. 

That means that in a process step the concept of a "current user" simply does not exist.

Avatar

Administrator

@mani_kandan1 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni