Expand my Community achievements bar.

SOLVED

Can you return multiple users in a custom Participant Chooser (AEM 6.1)

Avatar

Level 5

We have a business (real life) workflow that allows for multiple user to be assigned as another user's approver. When that approver requests the activation of a page, I'd like to move a workflow forward to the users designated as the approvers. Approvers can change and the business workflow doesn't lend itself well to user groups.

The doc for ParticipantStepChooser seems to indicate that only individual users or groups can be chosen. Is my situation something that's possible within the system? Is there perhaps a way to create a virtual group (either on the front end, when a user's approvrs are altered, or the back end when the participants are chosen)?

(Aside: The user's approvers are stores on a property as string[] in the user's node. I have the retrieval of this data working, but I'm stuck on what I would return from my ParticipantStepChooser.getParticipant() method).

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can setup app logic to perform conditions and return different users to whom to assign the task (ie - approve content). However - looking at this API:

http://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/workflow/exec/ParticipantStepChooser.html

It looks like its a single participant (that will define the participant dynamically) - all code that i have seen indicates this as well:

@Component(immediate=true)
@Service
@Properties({@org.apache.felix.scr.annotations.Property(name="service.description", value={"Sample Implementation of dynamic participant chooser."}), @org.apache.felix.scr.annotations.Property(name="chooser.label", value={"Sample Workflow Participant Chooser"})})
public class ParticipantStepImpl
  implements ParticipantStepChooser
{
  private static final Logger logger = LoggerFactory.getLogger(ParticipantStepImpl.class);
   
  public String getParticipant(WorkItem workItem, WorkflowSession wfSession, MetaDataMap metaDataMap)
    throws WorkflowException
  {
    logger.info("################ Inside the SampleProcessStepChooserImpl GetParticipant ##########################");
    String participant = "admin";
    Workflow wf = workItem.getWorkflow();
    List<HistoryItem> wfHistory = wfSession.getHistory(wf);
    if (!wfHistory.isEmpty()) {
      participant = "administrators";
    } else {
      participant = "admin";
    }
    logger.info("####### Participant : " + participant + " ##############");
    return participant;
  }
}

For those reading this and want to learn how to build a custom Participant Step see:

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

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

You can setup app logic to perform conditions and return different users to whom to assign the task (ie - approve content). However - looking at this API:

http://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/workflow/exec/ParticipantStepChooser.html

It looks like its a single participant (that will define the participant dynamically) - all code that i have seen indicates this as well:

@Component(immediate=true)
@Service
@Properties({@org.apache.felix.scr.annotations.Property(name="service.description", value={"Sample Implementation of dynamic participant chooser."}), @org.apache.felix.scr.annotations.Property(name="chooser.label", value={"Sample Workflow Participant Chooser"})})
public class ParticipantStepImpl
  implements ParticipantStepChooser
{
  private static final Logger logger = LoggerFactory.getLogger(ParticipantStepImpl.class);
   
  public String getParticipant(WorkItem workItem, WorkflowSession wfSession, MetaDataMap metaDataMap)
    throws WorkflowException
  {
    logger.info("################ Inside the SampleProcessStepChooserImpl GetParticipant ##########################");
    String participant = "admin";
    Workflow wf = workItem.getWorkflow();
    List<HistoryItem> wfHistory = wfSession.getHistory(wf);
    if (!wfHistory.isEmpty()) {
      participant = "administrators";
    } else {
      participant = "admin";
    }
    logger.info("####### Participant : " + participant + " ##############");
    return participant;
  }
}

For those reading this and want to learn how to build a custom Participant Step see:

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

Avatar

Former Community Member


Hi Scott,

I have similar requirement as B Stockwell had for my project to return multiple users in a custom Participant Chooser (AEM 6.2). I am looking forward for a solution and steps to two achieve this.