Parsware
All articles

Model-driven apps

The Organisation app

Every Parsware environment comes with an Organisation app. It holds your units as a chart, the people in each one, and who does which kind of work where, which is what processes route work by and what "my unit and below" access is measured against.

The Organisation app in dark mode: a unit chart with Head Office, Northern and Southern Regions and four branches, one person placed in Vali-asr Branch, next to the title "The Organisation app"

A business process that says "send this to the branch manager" needs to know which branch, and who manages it. A security rule that says "people see records in their own unit and below" needs a tree of units to measure against. In Parsware both come from one place: the Organisation app.

You don't install it. Every environment is created with the organisation tables and the app. It lives in each environment rather than tenant-wide, so you can rehearse a reorganisation in Test before it's true in Production.

We used a Test environment, which arrives with a sample organisation already in it. Every picture is the real product.

Four pages

Open Organisation from the apps list in the Platform Shell. The rail has four pages:

  • Units: the organisation chart.
  • Users: the environment's people, and which unit each one sits in.
  • Teams: named groups a record can belong to, each in a unit.
  • Process Roles: who does which kind of work, in which unit.

Units is a chart, not a list

Units opens as a tree. Each unit sits under the one above it, so you read the shape of the organisation rather than a column of parent names:

The Units page as a tree: Head Office, with Northern Region (Enghelab Branch, Vali-asr Branch) and Southern Region (Isfahan Branch, Shiraz Branch) beneath it, and Platform Administrator under Vali-asr Branch

Open a unit with its chevron or the keyboard: right opens, left closes, and left again moves up to the parent. Only what you open is loaded, so a chart with thousands of units opens as fast as this one.

Click a unit and its form opens beside the chart. It's the table's own form, saved the same as on the record's page, and the chart stays where it is:

Enghelab Branch selected in the chart, and its form beside it: Name Enghelab Branch, Parent Unit Northern Region, Manager Platform Administrator, Unit Type Branch, Disabled unticked

Three fields place a unit in the organisation:

  • Parent Unit: the unit above it. Leave it empty at the top; two legal entities can mean two tops.
  • Manager: who heads it.
  • Unit Type: your own words for your levels, such as Region, Branch, Province or Hospital. It's text, not a list we ship.

People are in the chart too

Under each unit, below its sub-units, are the people who sit in it. Select one and you get a card, not a form, because a chart is where you read an organisation rather than edit an employee:

Platform Administrator selected under Vali-asr Branch, and a card beside the chart: Email admin@parsware.local, Disabled No, Organisational Unit Vali-asr Branch

While writing this we found the card showed every column the record came back with, including housekeeping such as the row version and two owner columns labelled by their database names. With no card layout of its own, a card now shows the table's own fields, in order, and leaves the title field out because it's already the heading.

Find a unit

The box above the chart searches unit names. Matches appear under the units they sit in, so two branches with the same name are told apart by what's above them:

Searching for branch: the four branches in bold, each shown under its region and Head Office

Choose a result to go back to the chart with that unit selected. Escape returns the chart with whatever you had open still open.

Show one branch

Select a unit and press Show only this branch (the crosshair beside the search box). The chart shows that part of the organisation, and a trail above it says where you are:

The chart focused on Southern Region: a trail reading All / Head Office / Southern Region, and Isfahan Branch and Shiraz Branch below

Select a step in the trail to climb back out, or All for the whole organisation. The focus is in the page address, so a link you send opens on the same branch.

Put people in units

Open Users, open someone, and set their Organisational Unit. A person sits in one unit:

The Users page: Platform Administrator, admin@parsware.local, Organisational Unit Vali-asr Branch, Disabled No

Users are your tenant's people. They appear in an environment's Users list once they've done something in it, which is why this Test environment shows one.

Say who does what, where

Process Roles is what business processes route work by. Each row is a user, a unit and a role, read as "this person does this kind of work in this unit":

The Process Role Assignments list: Budget holder, CIG member, Capital requester and Employee, each for Platform Administrator in Vali-asr Branch

The unit doesn't have to be the person's own. A regional approver who sits at head office is one row. When a process step goes to a role, the engine asks who holds that role in the unit the run is for. If nobody does, it climbs the Parent Unit chain until it finds someone, or reaches the unit type the process says to stop at. If there's no row at all, the task waits on nobody: the process is fine, the organisation just isn't described yet.

A process role is not a permission. It decides who gets sent the work; what they may see is still their security role's job.

The tables behind the app

The Organisation app is an ordinary model-driven app over four of the platform's standard tables. You can use them in your own apps, views, lookups and reports like any other table.

Table Logical name The fields that matter
Organisational Unit orgunit Name, Parent Unit (parentorgunit), Manager (manager, a user), Unit Type (type, text)
User systemuser Full name, email, Organisational Unit (orgunit), Disabled
Team team Name, Organisational Unit
Process Role Assignment processroleassignment User, Organisational Unit (orgunit), Role (role)

Parent Unit is the table's parent field, which is why Units opens as a tree. It is the same mechanism as Category trees, set up by the platform, with people hanging under their unit instead of products under their category. And the same rule applies: a unit can't be moved inside its own branch, so the chart can never loop.

Because these are standard tables, a solution can extend them. A hospital that needs a Cost centre code on each unit adds a field to orgunit in its own solution, with its own prefix, and uninstalling that solution later returns the table to exactly how it was. Managed layers and clean uninstalls explains how.

How a task 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.

The Process Roles page is the one most worth understanding, because it is what turns a process's send this to the branch manager into a name. Take a leave request raised by somebody in Shiraz Branch, whose process sends it to the role Leave approver.

  1. The engine looks for a row with role Leave approver and unit Shiraz Branch. If there is one, the task goes to that person.
  2. If not, it moves up one level, to Southern Region, and looks again.
  3. If not, it moves up again, to Head Office.
  4. It stops when it finds somebody, or when it reaches the unit type the process said to stop at, or when it runs out of units.

So a small organisation can start with one row, Leave approver at Head Office, and every request in every branch reaches that person. As branches grow, add a row per branch, and those branches' requests stop climbing. Nothing about the process changes; only the organisation is described in more detail.

Several people can hold the same role in one unit. The task then goes to all of them as a shared task, and whoever opens it first takes it. Assignment: who gets the task covers the choices a process step has, including whoever started it and not the person who asked.

The organisation and security

The other half of the organisation's job is deciding who sees what. A security role can grant access by unit as well as for the whole environment:

  • Records I own: only the records a person owns.
  • My unit: records owned in their unit.
  • My unit and below: their unit and every unit under it.
  • My unit and above, and My whole branch, for people who look upwards or across a branch.
  • Every record: the whole environment.

My unit and below is the one most organisations actually want for managers. A regional manager in Southern Region sees what Isfahan and Shiraz create, and nothing from the north. Move a branch under another region, and who can see its records moves with it, with no role edited. Set up your organisation builds exactly that, and Record access: whose records you see explains the levels.

A process role and a security role are different things, and it is worth keeping them apart in your head. A process role says who is sent work. A security role says what a person may see and change. A leave approver needs both: the process role to receive the request, and a security role that lets them read leave requests.

Designing your organisation

  • Draw the units that make decisions. A unit earns its place when work is routed to it or records are seen by it. A unit that only exists on the paper chart can wait.
  • Keep Unit Type to a few words. Head office, Region, Branch. Processes can stop at a type, so consistent words matter.
  • Use teams for groups that cut across units. A Weekend duty group drawn from three branches is a team, not a unit. Teams explains.
  • Rehearse changes in Test. Because the organisation lives in each environment, you can reshape Test first, run a few processes through it, and only then make the change in Production.

Reading the organisation from a script

A rule that needs the organisation reads it like any table. This server rule refuses a leave request from somebody whose user record has no unit, because the approval process would have nowhere to start:

var me = getRecord('systemuser', userId());
if (isEmpty(me) || isEmpty(me.orgunit)) {
  throwValidationError('You are not in a unit yet. Ask your administrator to place you in the organisation.');
}

For routing itself you rarely need a script: the climb up the Parent Unit chain is what the process engine does already, in-process, with no extra call. A script is the escape hatch for routing the chart can't express. Code on a task shows where it goes.

Sample data only where it helps

A development environment created with sample data arrives with an organisation like this one, so a process can run the minute the environment exists. Rename it, reshape it or delete it. Production environments never get one.

Next: delete a table safely.