Workflow

Purpose

Access and control of Workflow Steps service behaviour.

Methods

Binding name: p6.workflow


Method: Map localeText(stepXml, ConfigXpath)

Reads a workflow step i18n format into a Map. The ConfigXpath syntax is not standard XPath but a variant supported by Apache Configuration. Typically this method is used from the workflow task enhancement script as specified in the step XML.

<WorkItem script="AwfWorkflowTaskEnhancer"/>

Method: List<String> stepNames

Returns a list of all workflow step names.


Method: List<Map> assignees(String stepName)

Returns a list of workflow users who have been identified as assignees for the requested workflow step.


Method: List<Map> uncheckedAssignees(String stepName)

Returns a list of workflow users who have the correct location within an organisation tree but have not yet been identified as assignees for the requested workflow step, i.e: there permissions have not been validated.


Method: syncAssignees(Closure itemNotifier)

Will synchronise all open and active workflow tasks and transactions with the current XML workflow step definition assignees.

This is useful when a large number of workflow tasks exist and new assignee team members are added/removed. Otherwise, active workflow task visibility rules will not reflect the current organisational structure.

The itemNotifier closure is optional but allows display of per item transactions and the pacing of the sync process. This closure should return true. Returning anything else will terminate the sync process.

Note

Pacing can be performed by inserting a sleep() statement of the desired duration within the supplied closure.

Note

If the calculated assignees have not changed since the method was called previously, this method will do nothing.

Step Ids

Transformer generated workflow steps will be skipped by this process. Please use syncInlineAssignees() instead.


Method: syncInlineAssignees(Closure itemNotifier)

Will synchronise all open and active workflow tasks and transactions with the workflow task embedded (inline) XML workflow step definition assignees. This method will enumerate all open and active workflow tasks, parsing the embedded workflow step XML and resolving the assignee definition in each. The new assignee(s) will be used to replace current assignees in the workflow task and linked transaction. Unlike the syncAssignees() method call, each call to this method will reevaluate all workflow tasks every time.

Note

This method can result in a lot of processing as all serialized step definitions must be re-evaluated.

Examples

def statusMap = p6.workflow.localeText stepXml, "StatusLabels/Label[@name=REVIEWED']"
p6.pipeline.put "ReviewedStatus", statusMap, "application/p6core.i18n"
p6.workflow.stepNames().each() {
    def stepName = "${it}" 

    println stepName 

    p6.workflow.assignees(stepName).each() {
        println "${it}" 
    }

    p6.workflow.uncheckedAssignees(stepName).each() {
        println "${it}" 
    }
}

p6.workflow.syncInlineAssignees(){id, msg ->
    println "----> Syncing work item: " + id + ", Message: " + msg
    true
}