Teams in BAW (8.5.5+) have two extension points, both implemented as service flows selected on the team artifact:
- Team retrieval service - replaces the static membership: input the team definition, output a team whose members are computed (from a database, an LDAP query, a REST call). Used when the members are not known at design time (e.g. "all users with the SAP role X").
- Team filter service - narrows the team per task: input the team (already resolved) plus the task's / instance's data mapped from the activity, output the filtered team. Used for "same region", "not the previous approver", "customer's account manager".
// team filter service "Reviewers of region" - inputs: team (Team), region (String, mapped from the BPD activity: tw.local.request.region); output: filteredTeam (Team)
var out = new tw.object.Team(); out.name = tw.local.team.name; out.members = new tw.object.listOf.String();
for (var i = 0; i < tw.local.team.members.listLength; i++) {
var u = tw.system.org.findUserByName(tw.local.team.members[i]);
if (u != null && u.attributes.get("Region") == tw.local.region) out.members.insertIntoList(out.members.listLength, u.name);
}
if (out.members.listLength == 0) out.members.insertIntoList(0, tw.env.fallbackUser); // never return an empty team - the task would be unassignable
tw.local.filteredTeam = out;
// account manager of the customer: a team of one user, computed per task
// team retrieval / filter: out.members = [ lookupAccountManager(tw.local.customerId) ]Where to set them: open the Team artifact > Team retrieval service / Team filter service; on the BPD activity, the Assignments tab selects the team and maps the filter's inputs from the process data. The engine runs the filter when the task is created (and again on reassignment / when the task list is refreshed for some views); results are cached briefly, so keep the services fast (no LDAP call per member - read cached attributes, question on LDAP attributes).
Alternatives for simpler cases: the activity's Assign to options - last user of a previous activity, a user from a variable (tw.local.approver), Lane default team; and team managers for escalation. Four-eyes and separation of duties are filter services that exclude users recorded in variables.
References