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

下載

此産品由 Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 授權  Creative Commons 條款未涵蓋 Twitter™ 與 Facebook 文章。

法律說明   |   線上隱私權政策