Parsware
All articles

Process design

Swimlanes and roles

A swimlane named Manager tells a reader who does the work. It tells the engine nothing until you give the lane a Role, picked from the environment's security roles. We set one on the leave-approval sample, added a lane, and followed a role from the designer to the people who hold it.

The Manager lane selected in the process designer, with its Role picker open and filtered by "man", showing Manager (new_manager), Manager (par_manager) and Senior Manager, next to the title "Swimlanes and roles"

The rows across a process drawing are swimlanes, one per role: Employee, Manager, HR. They're the reason a process diagram is worth drawing at all. You can see at a glance whose desk each step lands on, and where the work changes hands.

But the name on a lane is for people reading the drawing. Calling a lane "Manager" doesn't send anything to a manager. For that, the lane needs a Role.

We carried on with the Leave Approval sample from the tour. Import it from samples/solutions/bpms-leave-approval-process to follow along.

A lane's properties

Click the Manager lane's header, or its line in the outline:

The Manager lane selected, with its properties: Lane name Manager, Role "Each step decides for itself", a description, and Height, Fill and Stroke

  • Lane name: what the header says. Name it for the role, not a person. A process outlives whoever is doing the job this month.
  • Role: who this lane's steps go to. Empty, it reads Each step decides for itself.
  • Description, and the lane's Height, Fill and Stroke. You can also drag the lane's bottom edge to resize it, and double-click its header to rename it.

Picking the role

Click Role. It's a list of the security roles this environment has, not a box to type into:

The Role picker open over the lane's properties, listing Budget holder, CIG member, Capital requester, Change Approver and Change Reviewer, each with its logical name underneath

It used to be a text box. Type "Manger" and you had a lane whose work went to a role that doesn't exist, and nothing said so until a run stopped with nobody to give the task to. A list can't be misspelled.

Type to narrow it. The search matches the role's name and its logical name:

The Role picker filtered by "man": Manager (new_manager), Manager (par_manager) and Senior Manager (par_senior_manager)

Two roles here are both called Manager. One came with this sample (par_manager), the other is a development sample role (new_manager). That's why every line shows the logical name under the label: it's the one that's unique. We picked par_manager:

The Manager lane with Role set to Manager, and the help text: a step with an "Assigned to" expression of its own overrides this

Adding a lane

Click Lane in the palette. A new lane is added at the bottom, called New Lane, and appears in the outline, empty:

A fourth lane, New Lane, added below HR, and listed as empty in the outline

A step can decide for itself

The help text under Role says a step with its own Assigned to overrides the lane. This sample uses exactly that. Select Review Request, and under Code open Assigned to:

The script page for Review Request's Assigned to, with the expression role("par_manager")

role("par_manager")

That's why the sample's lanes have no Role: each user task says who gets it. The two ways aren't quite the same, and the difference matters:

  • A step's role("…") offers the task to everybody who holds that role, wherever they are.
  • A lane's Role is answered from the organisation: whoever holds the role in the unit the run belongs to. A leave request raised in Shiraz Branch goes to Shiraz's manager, not to every manager in the company.

Use the lane when the answer is "the person in this role here". Use a step's own expression for anything the lane can't say, such as one step in the Manager lane that needs a senior manager.

Who holds a role in a unit

For a lane's Role, the organisation has to say who holds it where. That's the Process Roles list in the Organisation app, one row per person, unit and role:

The Organisation app's Process Role Assignments filtered by "Manager": two Manager rows each for Robin Park in Enghelab Branch, Sam Taylor in Shiraz Branch and the administrator in Vali-asr Branch, then one Senior Manager row each

A development environment arrives with these filled in: every person placed in a branch and given every role there, so you can try a process on your own. Each branch has two Manager rows here, one for each of the two roles with that name, which is the same ambiguity the picker's logical names settle.

In a real environment you add these rows yourself. A lane whose role nobody holds in the run's unit is a task in nobody's list.

This article stays in the designer. Running the process and watching the task arrive comes later in the series.

A lane, as the process stores it

In the process document a lane is a short entry, and its role is one more line. The capital planning sample's lanes show all three ways a lane can be set up:

"lanes": [
  { "id": "lane-requester", "name": "Requester", "order": 0, "role": "par_capital_requester",
    "description": "Whoever raised it. They do nothing here — the process starts when their request does." },
  { "id": "lane-budget", "name": "Approver", "order": 1,
    "description": "Whoever the band names: the budget holder for the department band, the finance director above it." },
  { "id": "lane-cig", "name": "Capital Investment Group", "order": 2, "role": "par_cig_member",
    "description": "Reads a report of the request and decides. No form, deliberately." },
  { "id": "lane-system", "name": "System", "order": 3,
    "description": "The writes nobody presses a button for: the status, and a row of approval history." }
]
  • Requester and Capital Investment Group have a role, so their user tasks go to whoever holds it in the run's unit.
  • Approver has none, because who approves depends on the amount. Its one task says it for itself, with role(getVariable("approver")): the role an earlier step chose from the approval bands.
  • System has none, and needs none: it holds only service steps, which the platform does by itself.

The descriptions are worth copying too. Each says, in a sentence, who the lane is and why it is set up the way it is, which is exactly what the next maker needs when they open the drawing.

How the lane finds its person

What decides the climb. A lane's Role on its own looks only in the run's unit: it expands to one rule, whoever holds this role in this unit. Moving up the organisation when nobody does is a rule of its own (escalateUp), which a process can carry in its file, as the two-step approval sample's second lane does; the designer doesn't show it yet. Without it, a unit where nobody holds the role leaves the task in nobody's list. The steps below describe a process that has that rule.

A lane's Role is answered from the organisation, and the answer can climb. For a run that belongs to Shiraz Branch, with a lane whose Role is Manager:

  1. Somebody holds Manager in Shiraz Branch? The task goes to them.
  2. If not, the engine looks in the unit above, Southern Region.
  3. Then Head Office, and so on, until somebody holds the role or there are no units left.

So a small organisation can name one manager at head office and every branch's requests reach them. As the organisation is filled in, branches start answering for themselves, with no change to the process. The Organisation app shows where the rows are added. Several people holding the role in the same unit all see the task, and whoever opens it first takes it.

Which unit does a run belong to?

Usually the unit of whoever started it: a leave request raised by somebody in Shiraz runs for Shiraz. That is what makes a single process serve every branch. A script on a step can read it with instanceOrgUnit(), when a step needs to know which part of the organisation the work is for.

Lanes for common processes

A lane per role whose work appears in the process, in the order the work moves:

Process Lanes
Leave request Employee, Manager, HR
Purchase order Requester, Budget holder, Purchasing, System
Supplier onboarding Buyer, Compliance, Finance
Support escalation First line, Second line, Team lead
Expense claim Claimant, Manager, Finance, System

A System lane, for the service steps that write records and send messages, keeps the people's lanes about people. It is a convention rather than a rule, but a drawing where the automatic steps sit together is easier to read.

Lane, step, or both?

You want Set Example
The person in this role, here The lane's Role The branch's manager decides
Everybody in this role, anywhere The step's role("…") Any reviewer may pick it up
Somebody worked out during the run The step's expression role(getVariable("approver"))
Whoever started the run The step's expression instanceStartedBy()

A step's own Assigned to always wins over its lane. Assignment: who gets the task goes through every expression a step can use.

Questions that come up

Does a lane give people permission to see the record? No. A lane decides who is sent the work; their security roles decide what they may see and change. The manager needs both: a process role to receive the task, and a security role that lets them read leave requests.

Can one person be in two lanes? Yes. Somebody who is both a budget holder and a member of the investment group receives tasks from both lanes, each for its own step.

What happens if I rename a lane? Nothing changes for runs: a lane's name is for people reading the drawing. Its Role is what sends work.

Try it

Set the HR lane's Role the same way, then select Deduct Balance in that lane. Its Type is Service, and its Code has On enter and On exit but no Assigned to: nobody is given a service step, because the platform does it by itself. A lane's Role only ever reaches its user tasks.

Next: the shapes: start, task, branch and finish.