Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Employee

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

View solution in original post

2 Replies

Avatar

Level 10

"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

Avatar

Correct answer by
Employee

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