How to know which user is running the workflow for a page? | Community
Skip to main content
October 16, 2015
Solved

How to know which user is running the workflow for a page?

  • October 16, 2015
  • 4 replies
  • 4528 views

I am not able to fetch the user name, like who is running the workflow for a particular page. The issue is

    1. Since workflow uses admin session, session.getUserId() always returns "admin".

    2. Payload's cq:lastModifiedBy property is also not changing because the payload is locked during the workflow, and doesn't let non-admins write to its jcr:content

Is there any other way to know which user is running the workflow ?? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

Hi lokesh waran

You can look at "Workflow Archive tab" where you can get the information about 

  • Status: The status of the workflow. 
  • Initiator: The AEM user whom started the workflow
  • Start Time: The start time.
  • End Time: The end time.
  • Workflow Model: The workflow model
  • Model version: The verison of the workflow
  • Payload: The content (for example, a page) on which the workflow is used.

Link:- https://helpx.adobe.com/experience-manager/using/Workflows.html

 

Option 2 "Participant chooser service"

"workItem.getWorkflow().getInitiator();"

Link:- https://docs.adobe.com/docs/en/cq/5-6/workflows/wf-ref/workflow_steps.html#Dynamic Participant Step

 

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni

4 replies

Employee
August 5, 2017

Hi Jt Jayati,

Did you ever find a solution to your problem. I have the very same issue in my code as we've recently upgraded our code and now our workflow is throwing that same exception.

Thanks,

krs

Jt_Jayati
New Participant
March 31, 2017

When i try to impersonate wfSession to initiator this throws exception : javax.security.auth.login.FailedLoginException: Impersonation not allowed.
I necessarily need initiator's session to trigger some task in my workflow, earlier i used to get this using :
initiatorSession= adminSession.impersonate(new SimpleCredentials(initiatorUser,"".toCharArray()));

where adminSession is now deprecated and we use system users now, and so i cannot impersonate system user to initiator user, any suggestions?

kautuk_sahni
kautuk_sahniAccepted solution
Employee
October 16, 2015

Hi lokesh waran

You can look at "Workflow Archive tab" where you can get the information about 

  • Status: The status of the workflow. 
  • Initiator: The AEM user whom started the workflow
  • Start Time: The start time.
  • End Time: The end time.
  • Workflow Model: The workflow model
  • Model version: The verison of the workflow
  • Payload: The content (for example, a page) on which the workflow is used.

Link:- https://helpx.adobe.com/experience-manager/using/Workflows.html

 

Option 2 "Participant chooser service"

"workItem.getWorkflow().getInitiator();"

Link:- https://docs.adobe.com/docs/en/cq/5-6/workflows/wf-ref/workflow_steps.html#Dynamic Participant Step

 

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
vikramca06
New Participant
October 16, 2015

Hi,

You can get the workflow initiator user ID from workitem in custom workflow process.

workItem.getWorkflow().getInitiator();

Regards,

Vikram.