How do i assign a workflow dynamically to participants?

Answer, Resolution

In CQ5.3, this can be done by by creating your own workflow model using a custom ecma script that assign the next step dynamically. This is useful for situations where multiple users/groups need to use a same workflow model. In earlier versions, you will need to create multiple identical workflow models for the individual users/groups which makes it difficult to maintain. With this dynamic workflow model, one is only required for all the users/groups.

By developing your own ecma script, you can customize your own logic on how it will be assigned. The workflow model can call this ecma script during one of the steps.

Example of the ecma script for dynamic participants

function getParticipant() {
    var workflowData = workItem.getWorkflowData();
    if (workflowData.getPayloadType() == "JCR_PATH") { 
        var path = workflowData.getPayload().toString(); 
        if (path.indexOf("/content/geometrixx/en") == 0) {
            return "admin";
        } else {
            return "author";

The above shows how the workflow's next step gets assigned dynamically based on the payload's path.

Attached is a example package. Check the Dynamic user/group selection test workflow model for this example.

Applies to



Licencia na používanie tohto diela sa poskytuje v súlade s podmienkami licencie Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Na príspevky v sociálnych sieťach Twitter™ a Facebook sa nevzťahujú podmienky licencií Creative Commons.

Právne upozornenia   |   Zásady ochrany osobných údajov online