Workflow
Purpose¶
Access and control of Workflow Steps service behaviour.
Methods¶
Binding name: p6.workflow
localeText¶
Reads a workflow step i18n format into a Map.
Syntax
Map p6.workflow.localeText(String stepXml, String configXpath)
Parameter: configXpath
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.
<WorkflowTaskEnhancer script="AwfWorkflowTaskEnhancer"/>
Example
def statusMap = p6.workflow.localeText stepXml, "StatusLabels/Label[@name=REVIEWED']"
p6.pipeline.put "ReviewedStatus", statusMap, "application/p6core.i18n"
stepNames¶
Returns a list of all workflow step names.
Syntax
List<String> p6.workflow.stepNames()
Example
p6.workflow.stepNames().each() {
def stepName = "${it}"
}
assignees¶
Returns a list of workflow users who have been identified as assignees for the requested workflow step.
Syntax
List<Map> p6.workflow.assignees(String stepName)
Example
p6.workflow.stepNames().each() {
def stepName = "${it}"
p6.workflow.assignees(stepName).each() {
println "${it}"
}
}
isAssignee¶
Returns true
if the supplied email address resolves as a workflow assignee
Syntax
boolean p6.workflow.isAssignee(String userEmail)
Warning
Forces the examination of all current workflow tasks.
Example
if(p6.workflow.isAssignee("user@amalto.com")){
println("User is an assignee")
}
syncAssignees¶
Will synchronize all open and active workflow tasks and transactions with the workflow task embedded (inline) XML workflow step definition assignees.
Syntax
void p6.workflow.syncAssignees(Closure itemNotifier)
Info
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.
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.
If the calculated assignees have not changed since the method was called previously, this method will do nothing.
Warning
This method can result in a lot of processing as all serialized step definitions must be re-evaluated.
Tip
Pacing can be performed by inserting a sleep()
statement of the desired duration within the supplied closure.
Example
p6.workflow.syncAssignees(){ id, msg ->
println "----> Syncing work item: " + id + ", Message: " + msg
true
}