Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

pavanb46130733
Level 2
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
Will_McGauley
Correct answer by
Employee
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
smacdonald2008
Level 10
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

Will_McGauley
Correct answer by
Employee
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