Spanish Total.js
English
Documentation For AI agents
Contents

Approve purchases by their amount

A purchase request that goes to one manager or to two people of the management, by its amount.

.md Website
On this page

This recipe builds a purchase request: a request up to 1000 EUR needs the approval of any one manager, a bigger one the approval of two people of the management. Approved and rejected requests are closed with their result.

1. Create the process and the forms

1. Open Processes, select Create, enter the Name Purchase request and select SUBMIT. Open its designer.

2. Create a form Purchase request (see Forms) with a Form with two fields, Item (path item, required) and Amount (EUR) (path amount, type number, required), the button SEND, and a Flow Output Send for the submit of the form.

3. Create a form Approval with two Form components:

  • one with the field Comment (path comment) and the button APPROVE, with a Flow Output Approve for its submit,
  • one with the field Reason (path comment) and the button REJECT, with a Flow Output Reject for its submit.

4. Install the Switch component. See Conditions.

2. Draw the process

Drag these nodes onto the canvas and connect them. The form Approval is on the canvas twice.

FromOutputToInput
StartStartPurchase requestNo data
Purchase requestSendSwitchInput
SwitchOver 1000Approval (management)No data
SwitchUp to 1000Approval (manager)No data
both Approval nodesApproveClose ApprovedPayload
both Approval nodesRejectClose RejectedPayload

The purchase request process in the designer

3. Configure the nodes

NodeSettings
StartName Purchase request, Permissions staff
Purchase requestWorkflow action Create, Workflow name Request, Permissions staff, Template name Purchase: {{ value.item }}, Template subject {{ value.amount }} EUR
SwitchMessage data, path amount; conditions > Number 1000 named Over 1000, and <= Number 1000 named Up to 1000
Approval (management)Workflow action Step, Workflow name Management approval, Approval by several people All of them, Approvers mark@example.com, paul@example.com, Approve with the button Approve, Reject with the button Reject, Path of the comment comment
Approval (manager)Workflow action Step, Workflow name Manager approval, Approval by several people Any one of them, Approvers managers, the same buttons and path
CloseName Approved, Template result Approved
CloseName Rejected, Template result Rejected

Use the e-mails of your own people and your own permissions. Select APPLY in each settings window and in the toolbar. Then select Publish in the toolbar, write First version and select PUBLISH. See Approvals by several people and Process versions.

4. Try it

  1. In the Inbox, select Create > Purchase request, enter Laptops for the new team and 2400, and select SEND.
  2. The task waits at Management approval in the Inbox of both approvers. The first one assigns it, writes a comment and selects APPROVE. The task leaves their Inbox and waits for the second one.
  3. The second approver approves it too. The task is closed with the result Approved, and its history shows both decisions with their comments.
  4. A request of 300 goes to Manager approval, where one decision of any manager is enough.
Made in Europe