Tutorial: an approval workflow for purchase orders
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.
- PO created
- Amount over 50,000?
- Manager approves
- Status updated
- Buyer emailed
What do I need before I start?
Section titled “What do I need before I start?”- 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,ApprovedandRejected. 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.
Step 1 of 9: Create the workflow
Section titled “Step 1 of 9: Create the workflow”- In the Designer, open Modules, choose Purchase Orders, and click Automation in the top bar.
- Click New workflow.
- Type
Approve purchase orderas the Name. Under Description, typeOrders over 50,000 need a manager. Smaller ones are approved at once. - Under When should it run?, choose A record is created. Under Timing, keep After the record is saved (POST). Leave Order at 0.
- Leave On switched on, then click Save. The toast says “Workflow created”.
- 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.
Step 2 of 9: Split on the amount
Section titled “Step 2 of 9: Split on the amount”- In the starter, click Check something first. A Decision step appears, and its settings open on the right.
- In the panel header, type
Amount over 50,000?over the step’s name. - Under Every one of these must be true, click Add a condition.
- For Field, choose Amount. For Check, choose is greater than. For Value, type
50000.
The canvas now shows two paths, No on the left and Yes on the right. Each ends in an End marker with a +.
Step 3 of 9: Ask a manager
Section titled “Step 3 of 9: Ask a manager”- On the Yes path, click the + on the End marker. In the picker, under Records, choose Approval task.
- Type
Manager approvalas the step’s name. - Under The task, type
Approve purchase orderas the Title people will see. Add a Description, such asA purchase order over 50,000 needs your approval. - Set Priority to High. Type
2in Overdue after. - 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.
Step 4 of 9: Set the status on each path
Section titled “Step 4 of 9: Set the status on each path”Use a Record manager step to change the record after an approval decision.
- On the Approved path, click the + on the End marker. Under Records, choose Record manager. Name it
Mark as Approved. - Choose Update. Set On which module? to Purchase Orders.
- Click Add a field and choose Status. Choose Pick a value, then Approved.
- 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.
Step 5 of 9: Tell the buyer
Section titled “Step 5 of 9: Tell the buyer”- Under Mark as Rejected, click the + on the End marker. Under Communicate, choose Send email. Name it
Tell the buyer. - In From and to, leave From on Beezr Notifications.
- Click in To, click Insert data, and choose Buyer email.
- Type
Purchase order rejectedas the Subject. Write a short message under Message.
If you prefer your own mail server, choose it in From.
Step 6 of 9: Let small orders through
Section titled “Step 6 of 9: Let small orders through”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.
- On the No path, click the + on the End marker.
- 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.
Step 7 of 9: Check and save
Section titled “Step 7 of 9: Check and save”- 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.
- 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.
Step 8 of 9: Try it in App space
Section titled “Step 8 of 9: Try it in App space”- Click the App switch in the top bar to open App space, and open Purchase Orders.
- Click New. Fill in a
Vendor, anAmountof20000, your own address in Buyer email, and Pending approval as the Status. Click Save. - Reload the list. The status is Approved. The workflow ran the No path.
- Create a second order with an Amount of
80000. Its status stays Pending approval. - As a member of Procurement managers, click Tasks in the top bar. The task Approve purchase order is under Your Open Tasks.
- Click Go to request, then Approve. Reload the order. Its status is now Approved.
- 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.
Step 9 of 9: Read the runs
Section titled “Step 9 of 9: Read the runs”- Back in the Designer, open Automation and find Approve purchase order. It shows 3 runs.
- Click Runs.
- Click the run for the 80,000 order, then the Steps tab.
- Click the Amount over 50,000? step. Its message says which path it took and which conditions it checked.
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 built a complete approval workflow
Section titled “You built a complete approval workflow”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.
Check your setup
Section titled “Check your setup”- 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
What's next
Last checked