How to find participants assigned to participant step in previous process step. | Community
Skip to main content
pavanb46130733
Level 2
April 22, 2016
Solved

How to find participants assigned to participant step in previous process step.

  • April 22, 2016
  • 2 replies
  • 1545 views

Hi All,

This is regarding a problem i am facing in the workflow, i have attached the screen-shot of the workflow which i have created PFA.

In the workflow 'Email to Approver' is a process step, i have created EmailProcessStep.Java class implmenting WorkflowProcess interface to handle this step, 'Validate Content' is a participant step.

I want to know the user/group attached to 'Validate Content'  participant step in EmailProcessStep class.

I tried to get it using List<WorkItem>list = item.getWorkflow().getWorkItems(), but it is returning an empty list.

Can anybody tell how to find?

Thanks in advance,

 

Rgards,

Pavan Bukka.

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 WillMc1

Hi,

You will need to lookup the workflow history to find the previous workitem.  the getWorkItems() api you are using only returns active workitems for the workflow instance.

To load history you must call the following:

worklfowSession.getHistory(item.getWorkflow())

 

Hope this helps,

Will

2 replies

smacdonald2008
Level 10
April 22, 2016

"I want to know the user/group attached to 'Validate Content'  participant step"

I am not sure that the Workflow API offers you this functionality. I am checking with Eng members

 List<WorkItem>list = item.getWorkflow().getWorkItems()

will not give your that information,

One way you can workaround it (assuming it does not have this functionality) is to create a Dynamic Participant Step.  

https://helpx.adobe.com/experience-manager/using/dynamic-steps.html

This will select the user to assign the workflow item. Then have your custom step logic track who the task was assigned to. Maybe persist the information in the JCR. 

When when you need that information later in the workflow - use the JCR API to read the JCR node prop that stores that information, If the workflow has multiple users, you can store in multiple nodes - have a 1-1 relationship. 

Hope this helps

WillMc1Adobe EmployeeAccepted solution
Adobe Employee
April 22, 2016

Hi,

You will need to lookup the workflow history to find the previous workitem.  the getWorkItems() api you are using only returns active workitems for the workflow instance.

To load history you must call the following:

worklfowSession.getHistory(item.getWorkflow())

 

Hope this helps,

Will