Get Current User who invokes particular step in the workflow.

Avatar

Avatar
Level 1
JJ_JayantJain
Level 1

Likes

0 likes

Total Posts

5 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
JJ_JayantJain
Level 1

Likes

0 likes

Total Posts

5 posts

Correct reply

0 solutions
View profile
JJ_JayantJain
Level 1

23-08-2020

I  tried to get current user using session and authorizable. But none of them giving the current user who invokes the particular step.

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

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 2
kalyan_venkat
Level 2

Likes

15 likes

Total Posts

28 posts

Correct reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 2
kalyan_venkat
Level 2

Likes

15 likes

Total Posts

28 posts

Correct reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
kalyan_venkat
Level 2

23-08-2020

Hi @JJ_JayantJain 

 

In your execute method try the following

workItem.getWorkflow().getInitiator()

 -Kalyan

Answers (2)

Answers (2)

Avatar

Avatar
Establish
MVP
Nupur_Jain
MVP

Likes

165 likes

Total Posts

186 posts

Correct reply

76 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Establish
MVP
Nupur_Jain
MVP

Likes

165 likes

Total Posts

186 posts

Correct reply

76 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile
Nupur_Jain
MVP

23-08-2020

Hi @JJ_JayantJain 

 

You can use getInitiator() method of Workflow API to get the user ID of the user who started the workflow. 

 

Refer https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/co... API to get to know more about this particular method.

 

String getInitiator()
Returns the initiator of the Workflow instance.
Returns:
The user who initiated the Workflow.

 

Hope it helps!

Thanks!

Nupur

Avatar

Avatar
Establish
Level 2
fanindras
Level 2

Likes

15 likes

Total Posts

19 posts

Correct reply

1 solution
Top badges earned
Establish
Give Back
Boost 5
Boost 3
Boost 10
View profile

Avatar
Establish
Level 2
fanindras
Level 2

Likes

15 likes

Total Posts

19 posts

Correct reply

1 solution
Top badges earned
Establish
Give Back
Boost 5
Boost 3
Boost 10
View profile
fanindras
Level 2

24-08-2020

@JJ_JayantJain ,

I understand that you need the userId of the most recent participant in your workflow. This can be fetched as follows:

 

Step1: workflowSession.getHistory. This should return the history of workflow:

List<HistoryItem> histories = workflowSession.getHistory(workItem.getWorkflow());

Step2: The most recent action of the participant user should be the first item in the histories list at index 0, and this can be accessed as:

HistoryItem recentHistory = histories.get(0);

 Step3: The recent user id can be fetched using the getUserId method of HistoryItem:

String recentUser = recentHistory.getUserId();

 

Please let me know if this works.