Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Persist Data between process step and participant step

Avatar

Level 10

Hello ,

I have a sequential workflow

1. Process Step (Custom Process step)

2. Participant Step (Custom participant step returning group name)

3.Process step(Approval step)

  • A) I am not able to send data between steps 2 and 3, but am able to send data between steps 1 and 2 

I have made use of workflowData.getMetaDataMap().get("groupPath") and         workflowData.getMetaDataMap().put("groupPath","test");

  • B) Is there a way to identify which user , and users profile , who has approved the payload?

Please let me know.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi Nicole,

I am not exactly sure what you're trying to do - are you saying that in Step2 you use a Dynamic Participant step to assign to a group of users, and on Step3 you would like to know which user from that group completed the workitem?

If that is the case, you can dig into the workflow history to determine which user completed the previous workitem.  Something like:

List<HistoryItem> historyItems = workflowSession.getHistory(workItem.getWorkflow()); String userWhoCompletedLastStep = historyItems.get(historyItems.size() -1).getUserId();

Hopefully this helps - let us know!

Will

View solution in original post

9 Replies

Avatar

Correct answer by
Employee

Hi Nicole,

I am not exactly sure what you're trying to do - are you saying that in Step2 you use a Dynamic Participant step to assign to a group of users, and on Step3 you would like to know which user from that group completed the workitem?

If that is the case, you can dig into the workflow history to determine which user completed the previous workitem.  Something like:

List<HistoryItem> historyItems = workflowSession.getHistory(workItem.getWorkflow()); String userWhoCompletedLastStep = historyItems.get(historyItems.size() -1).getUserId();

Hopefully this helps - let us know!

Will

Avatar

Level 10

Will McGauley wrote...

Hi Nicole,

I am not exactly sure what you're trying to do - are you saying that in Step2 you use a Dynamic Participant step to assign to a group of users, and on Step3 you would like to know which user from that group completed the workitem?

If that is the case, you can dig into the workflow history to determine which user completed the previous workitem.  Something like:

 
  1. List<HistoryItem> historyItems = workflowSession.getHistory(workItem.getWorkflow());
  2. String userWhoCompletedLastStep = historyItems.get(historyItems.size() -1).getUserId();

Hopefully this helps - let us know!

Will

 

 

 

Thank you Will, that helped a lot.:)

Avatar

Level 10

I asked Eng to take a look at this. 

Avatar

Level 10

Hey Will,

I am trying to access the metadata property/ node in the workflow process step, which is after the custom participant step.

  • Participant Step
  • Process step -(Here is where i am trying to access the metadata)

I have added the following lines which works fine if it was series of process steps, but now that i pass data from participant step I see it not possible to extract.

workflowData.getMetaDataMap().get(langCode) - in process step that follows the participant step -Returns null in workflow

I also see that when i run the code with workflowData.getMetaDataMap().put("test",test) at participant step it doesn't get stored , 

 

Please let me know.

Avatar

Employee

One thing that I'd like to point out is that there are two different workflowData objects in play all the time:

1) workItem.getWorkflowData() returns metadata for just the workitem

2) workItem.getWorkflow().getWorkflowData() returns metadata for the entire workflow


From your code snippets I cannot tell which WorkflowData you are referring to, perhaps this was part of the problem?

Will

Avatar

Level 10

Figured it out. Thanks :), extracted using the node.getProperty, wondered if there was a simple way to do it, using API's

Avatar

Level 10

Thank you scott, really appreciate the help.

Regards,

Nicole

Avatar

Level 10

I am glad that you got that solved.