Skip to content

Tutorial: an approval workflow for purchase orders

Tutorial40 minPractitioner

Before you start

You will build the approval workflow that most buying teams ask for first. A purchase order above 50,000 goes to a manager. A smaller one is approved at once. If the manager rejects an order, the buyer gets an email. You finish by checking each run in the debugger. It has 9 steps and takes about 40 minutes.

  1. PO created
  2. Amount over 50,000?
  3. Manager approves
  4. Status updated
  5. Buyer emailed
  • A Purchase Orders module with the fields Vendor (Text), Amount (Currency), Buyer email (Text) and Status (Lookup). Give the Status lookup the values Pending approval, Approved and Rejected. The form and the Table view should show them, as in the Quickstart.
  • A role called Procurement managers, with you or a colleague in it. See Create roles and assign people.
  • An application that contains the module, so you can open it in App space.
  1. In the Designer, open Modules, choose Purchase Orders, and click Automation in the top bar.
  2. Click New workflow.
  3. Type Approve purchase order as the Name. Under Description, type Orders over 50,000 need a manager. Smaller ones are approved at once.
  4. Under When should it run?, choose A record is created. Under Timing, keep After the record is saved (POST). Leave Order at 0.
  5. Leave On switched on, then click Save. The toast says “Workflow created”.
  6. In the list, click Open in designer on the new workflow.

The canvas opens with a Trigger card and a starter that asks What should happen next? The trigger needs nothing from you. You set it a moment ago.

  1. In the starter, click Check something first. A Decision step appears, and its settings open on the right.
  2. In the panel header, type Amount over 50,000? over the step’s name.
  3. Under Every one of these must be true, click Add a condition.
  4. For Field, choose Amount. For Check, choose is greater than. For Value, type 50000.
The Decision panel with one condition, Amount is greater than 50000, and an In plain words line reading Goes down Yes when Amount is greater than 50000, otherwise No.
    In plain words repeats the rule as a sentence. Read it before you move on.
    The condition has a Field, a Check and a Value.
    Where it goes names the first step on Yes and No. Both end here for now.

The canvas now shows two paths, No on the left and Yes on the right. Each ends in an End marker with a +.

  1. On the Yes path, click the + on the End marker. In the picker, under Records, choose Approval task.
  2. Type Manager approval as the step’s name.
  3. Under The task, type Approve purchase order as the Title people will see. Add a Description, such as A purchase order over 50,000 needs your approval.
  4. Set Priority to High. Type 2 in Overdue after.
  5. Open Who decides?, click A role, and under Add a role… choose Procurement managers.

Open While it waits. It says that the workflow pauses here, and that it continues on Approved or Rejected with a fresh copy of the record. Both paths show “ends here”. Next, you give each one a job.

Checkpoint. Your canvas has a Trigger, a Decision, and an Approval task on the Yes path. The No path and both approval paths are still empty. That is as it should be.

Use a Record manager step to change the record after an approval decision.

  1. On the Approved path, click the + on the End marker. Under Records, choose Record manager. Name it Mark as Approved.
  2. Choose Update. Set On which module? to Purchase Orders.
  3. Click Add a field and choose Status. Choose Pick a value, then Approved.
  4. On the Rejected path, add another Record manager and name it Mark as Rejected. Choose Update and Purchase Orders, add Status, and pick Rejected.

Updating the record that started the workflow needs no key. The step finds it for you.

  1. Under Mark as Rejected, click the + on the End marker. Under Communicate, choose Send email. Name it Tell the buyer.
  2. In From and to, leave From on Beezr Notifications.
  3. Click in To, click Insert data, and choose Buyer email.
  4. Type Purchase order rejected as the Subject. Write a short message under Message.

If you prefer your own mail server, choose it in From.

A small order needs the same result as an approved one: its status becomes Approved. Instead of building the step twice, you join the paths.

  1. On the No path, click the + on the End marker.
  2. Under Join an existing step, choose Mark as Approved.

The Mark as Approved card now shows a “2 paths” badge. It is one step that runs for whichever path arrives.

A shared step is shared. If you change Mark as Approved later, the change applies to small orders and approved ones alike. Open the step and look under Reached from to see its paths.

  1. Click Check. A tick means nothing needs attention. If you see a number, click Check to open Before you save, then click each item to jump to its step.
  2. Click Save. The status beside the name changes to All changes saved.

Fix the errors Check lists, so the active workflow saves. Click an item in the list to jump to the step to complete.

  1. Click the App switch in the top bar to open App space, and open Purchase Orders.
  2. Click New. Fill in a Vendor, an Amount of 20000, your own address in Buyer email, and Pending approval as the Status. Click Save.
  3. Reload the list. The status is Approved. The workflow ran the No path.
  4. Create a second order with an Amount of 80000. Its status stays Pending approval.
  5. As a member of Procurement managers, click Tasks in the top bar. The task Approve purchase order is under Your Open Tasks.
  6. Click Go to request, then Approve. Reload the order. Its status is now Approved.
  7. Create a third order for 90000, open its task, click Reject, and type a reason. The status becomes Rejected, and the buyer’s address gets the email.

You decided as a role member. In the inbox you can also tick tasks and approve or reject several at once. Go to request opens the record, where Approve, Reject and Request Clarification wait in a banner.

  1. Back in the Designer, open Automation and find Approve purchase order. It shows 3 runs.
  2. Click Runs.
  3. Click the run for the 80,000 order, then the Steps tab.
  4. Click the Amount over 50,000? step. Its message says which path it took and which conditions it checked.
The run debugger with the selected run's steps drawn as a timeline, each step with its duration.
    The Steps tab lists every step the run took.
    Each bar shows when the step started and how long it took.
    Failed shows only runs that stopped on an error.

When someone decides a task, the workflow resumes in the same run, so the steps below the approval appear there too. Find out why a workflow failed shows what to do when a run is red.

You have a trigger, a Decision, an Approval task for a role, a shared step, an email on rejection, and a way to see every run. The same shape fits leave requests, contract sign-off and invoice approval.

Try one change next. Add a second Approval task after the first for orders above 200,000, with a different role. Then read Approvals and tasks to configure the approval step.

  • Nothing happens when I save an order. Open Automation, find the workflow, and check that its switch is on.
  • Every order is approved at once. Open the Decision step and read In plain words. Check that the amount field is Amount.
  • No task appears. Check that you are in the Procurement managers role. Tasks for a role show in Your Open Tasks with a Claim button.
  • The status does not change after approval. Check that the Approved path has the Record manager step, and that On which module? is Purchase Orders.
  • The buyer gets no email. Open the run, click the Tell the buyer step, and read its message. A missing address fails the step.

Check yourself

In this workflow, which path does a purchase order for exactly 50,000 take?
Show the answer

No, so it is approved at once. The check is "is greater than", which is strict. 50,000 is not greater than 50,000, so the Decision takes the No path.

The manager approves a purchase order, but its Status stays Pending approval. What is missing?
Show the answer

A Record manager step on the Approved path. The Approval task records the decision and continues. A Record manager step changes the record.

Nour changes the Mark as Approved step. Which purchase orders does the change affect?
Show the answer

Both, because two paths share the step. The step is shared. It runs for whichever path arrives, so a change applies to every path.

What's next

Last checked