Parsware
All articles

Running processes

Start a process from a record

A process can start by itself when a record is created, changed or deleted, or from a button on the record's form and list. Either way the run knows which record it's about. Running the sample as two people found a status that never changed and people named by their email address; both are fixed.

An expense claim, Train to the Leeds client visit, with Status Reviewing and Submit for approval on the command bar, next to the title "Start a process from a record"

Most processes are about a record: this expense claim, that leave request, this order. Nobody should have to start one by hand and then tell it which record it's for. Two things start a process from a record:

  • A record event. The process starts by itself when a record of a table is created, changed or deleted.
  • A button. A Start a process button on a form or a list starts it about the record you're looking at, or the rows you've ticked.

Either way the run knows which record it's about.

We used the A Record Starts a Process sample from samples/solutions/bpms-record-starts-a-process: an expense claim reviewed by a manager. We gave its Claimant role to Robin Park and Manager to Sam Taylor, in the Admin Control Center under Users → Manage roles, and each signed in again.

The process

Expense Review: Claim raised, then Decide the claim, then Mark approved or Mark rejected, then Decided, all in the Manager lane

The manager decides the claim. Mark approved or Mark rejected sets the claim's status, and the process finishes.

Starts by itself when

Select the process itself (its name at the top of the outline) and find Starts by itself when:

Starts by itself when: A record is created, on Expense claim, under the hint Leave this as Nobody and the process is started by a button, or from the maker portal

Two choices: the event (A record is created, changed or deleted) and the table. Leave the first at Nobody and the process only starts when somebody presses a button.

The trigger takes effect when the process is published. The sample's import publishes it for you.

There's no condition on the trigger, such as only claims over 500. A process that should only sometimes go ahead puts a Branch straight after its start and finishes early. That way the decision is in the drawing, where people look.

The record raises it

Robin opened the Expenses app, created a claim for a train ticket, and saved it. That was all. When the form reloaded, the claim's Status said Reviewing:

Robin's claim, Train to the Leeds client visit, 86.4, Status Reviewing, with Submit for approval on the command bar

The process started as the claim was saved, and its On start script set the status:

var claim = getRecordRef("record");
setVariable("claim_id", claim);
updateRecord("par_expenseclaim", claim, { "par_status": "Reviewing" });

getRecordRef("record") is the record the run is about: the claim that was just created. Every script in the process reads it the same way, and so does the manager's task, which opens that claim.

The manager decides

Sam had a task waiting, offered to the Manager role:

Sam's task list: Expense Review, Decide the claim, assigned to Manager (par_manager), arrived 03:07, Just now

It opened Robin's claim, read-only, with Decide at the bottom. Sam approved it with a note:

The claim open for Sam, and the Decide this claim panel with the note Fine. Standard class, booked in advance. and the buttons Cancel, Approve and Reject

Reject asks for a reason first. Back in Robin's list, the claim was approved:

Robin's Expense claims list: Train to the Leeds client visit, 86.4, Approved

The other way in: a button

The form and the list both have Submit for approval on their command bar. It's a command whose action is Start a process, set where the form's or view's commands are, and it starts the same process about the record on the screen.

On the list it starts one run for each row you've ticked. Robin ticked both his claims and pressed it:

The Expense claims list with both claims Reviewing, and the message 2 started.

Robin can press it although he's no maker and has no rights over processes. A start about a record is allowed if you can read that record. If you can open the claim, you can start its approval. The maker portal's own Start a run button names no record, so it stays with makers.

Nothing stops a second run of the same claim. Robin pressed the button on his train claim's form and then again from the list, so that claim now has two runs going. If that matters in your own process, hide the button once the status says it's under review.

The runs

Every run is listed on the process's Runs page in the maker portal:

The Runs list for Expense Review: four runs Running on version 2 waiting on Manager (par_manager), and one Completed

The list doesn't say which record each run is about yet, only when it started and where it's waiting. Open one to see what happened:

The first run's history: Run started, Task raised, Task completed Approve by Sam Taylor, Reached markapproved, and the run ending at Decided

Both starts, as the solution stores them

The trigger is one line at the top of the process document:

"trigger": { "event": "created", "table": "par_expenseclaim" }

and the button is a command on the form and the view, whose action names the process:

{ "id": "act-submit", "label": "Submit for approval", "icon": "upload", "kind": "button",
  "placement": "bar", "run": { "kind": "StartProcess", "process": "par_expensereview" } }

The sample has both, to show both. A real process usually picks one: a trigger when every record should go through it, a button when a person decides that this one is ready. Buttons that do something covers the other actions a command can take.

Created, changed or deleted

Event Starts a run Good for Watch out for
Created Once, when the record is first saved Every new claim is reviewed Drafts saved half-finished start a run too
Changed On every save of the record Reacting to an edit, such as a raised amount Every save, however small, starts one
Deleted When the record is deleted Telling somebody, tidying related records The record is gone; read what you need from it early

Changed is the one to handle with care. A trigger on every save starts a run each time anybody corrects a typo. Put a Branch straight after the start that asks whether the change matters, for example whether the amount went over a limit, and finish at once when it doesn't. The decision stays in the drawing, where people can see why most changes do nothing.

Rows from a solution don't start runs

When a solution brings demonstration or configuration rows with it, importing them does not start any process triggered on their table. A process triggered on creation is about the act of somebody creating a record; a seed row is a picture of a table as it was left. So importing a sample with thirty requests in it doesn't put thirty tasks in somebody's list. Seed data that travels with a solution explains the rule.

Records created any other way, on a form, through an import of a spreadsheet, through the API or by a script, do start the run.

Stopping a second run

As the sample shows, nothing stops two runs about the same claim. Three ways to prevent it, from simplest to strongest:

  1. Show the button only when it makes sense. A command can be limited to some of the record's states, so Submit for approval appears only on drafts. Tidy command bars shows the setting.
  2. Check in the process. A branch after the start that reads the record's status and finishes at once if it is already under review.
  3. Refuse on the server. A plugin step that refuses to move a claim back to Reviewing when it is already there, so nothing can start a second review in any way.

The first is usually enough for a button; the second for a trigger on changed.

Questions that come up

Does a run started by a trigger run as the person who saved? It is about their record and belongs to their part of the organisation, so assignment by unit works as if they had pressed the button.

Can one save start two processes? Yes, if two processes are triggered on the same table and event. Each gets its own run.

Can a trigger start a process on a related table? A trigger is about its own table. To react to an order line by working on the order, trigger on the line and read the order with getRecord in the process's On start.

What we fixed

  • A decided claim stayed Reviewing. The sample set the status in its two Finish shapes. A Finish only ends the route: the designer offers it no code and the engine runs none, so the status never changed. The sample now has a script step before one Finish: Mark approved or Mark rejected. A second sample made the same mistake and is fixed the same way.
  • People were named by their email address. The first time somebody writes a record in an environment, the platform adds them to that environment's list of users, under the name their sign-in carries. That was their email, so the run history read by robin.park@parsware.local. It's their display name now.
  • Nobody but an administrator could raise a claim. The sample's only role was Manager. It now also has Claimant, which can open the app, create a claim and read its own.

If you imported the sample before October 2026, import it again.

Try it

Import the sample, give yourself Claimant and Manager, sign in again, and create two claims. Approve one and reject the other, then open the process's Runs page and compare the two histories: one goes through Mark approved, the other through Mark rejected.

Next: routing a request by its amount, from a table finance can edit.