Question

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

CQ5.3

Prenos

Za ta izdelek je bila izdana neprenosljiva licenca za priznanje avtorstva, nekomercialno uporabo in skupno rabo pod enakimi pogoji 3.0  Objav v storitvah Twitter™ in Facebook ne urejajo pogoji pogodbe Creative Commons.

Pravna obvestila   |   Pravilnik o zasebnosti v spletu