Use the Expression option to write a conditional expression for selecting task or notification-related roles. The expression can be based on the input data of a People activity. For example, if you are invoking a service to retrieve identities, you can pass them into the potential owners or administrators identities.
The expression can include a process variable or it can be composed using WS-HT custom XPath functions, described in
Custom Functions
.
To Add an Expression for a Task or Notification Role:
From the Outline View, select task or notification.
In the Assignment tab of the Properties view, select a role, such as
potential owners
.
In the Value column, click (
...
).
Select Expression as the Source, and then select
Expression Builder
.
In the Expression Builder, select a Human Task (WS-HT) custom function or other variable in creating an expression.
Select the users or groups for the role.
<htd:from expressionLanguage="anyURI"?>
expression
</htd:from>
Example: Expression for a Task’s Role Assignment
<htd:potentialOwners>
<htd:from>$voters/users/user[i]</htd:from>
</htd:potentialOwners>
The potential owners definition is contained within a For Each activity.
Example: Using a WS-HT Custom Function
:
<htd:potentialOwners>
<htd:from>
htd:getInput("part1")/approvers
</htd:from>
</htd:potentialOwners>
<htd:businessAdministrators>
<htd:from>
htd:except(htd:getInput("part1")/admins,
htd:getInput("part1")/globaladmins[0])
</htd:from>
</htd:businessAdministrators>
The WS-HT custom function
getInput
returns a list of potential owners defined as the child element
approvers
in
part1
of the task's input message. The business administrators group includes
globaladmins
and excludes
admins
.
Example: A Notification's Role Assignment
<htd:peopleAssignments>
<htd:recipients>
<htd:from>
htd:getPotentialOwners("ApproveClaim")
</htd:from>
</htd:recipients>
</htd:peopleAssignments>
<htd:potentialOwners>
<htd:from>
<htd:literal>
<ht:organizationalEntity
xmlns:ht='http://www.example.org/WS-HT'>
<ht:groups>
<ht:group>{data($creditInformation/loan:loanTypeGroup)}
</ht:group>
</ht:groups>
</ht:organizationalEntity>
</ht:literal>
</ht:from>
</ht:potentialOwners>