Expand my Community achievements bar.

SOLVED

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

Avatar

Former Community Member

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

1 Accepted Solution

Avatar

Correct answer by
Administrator

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

View solution in original post

4 Replies

Avatar

Correct answer by
Administrator

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

Avatar

Level 4

Hi,

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

workItem.getWorkflow().getInitiator();

Regards,

Vikram.

Avatar

Level 2

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?

Avatar

Employee

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