Build an approval workflow

Route purchase requests to the requester's manager and then to finance, with reminders, record locking and a notification when a decision is made.

Level
Intermediate
Estimated time
About 40 minutes
Uses
Approvals, Lifecycles, Notifications

What you will build

A two-level approval process on a Purchase request entity: level one resolved from the reporting manager, level two any two members of the Finance role.

Architecture

  1. Request
  2. Manager
  3. Finance
  4. Approved

Steps

  1. 1Turn on approvals for the entity

    Enable the approval feature on PurchaseRequest. While a request is under approval the platform locks the record against edits and deletes.

  2. 2Define the approval process

    Create an approval process with two sequential levels. Level one uses the Reporting manager strategy. Level two uses the Role strategy with the Finance role and an N of M quorum of 2. Set a reminder SLA on level two so pending approvers are reminded, then escalated.

  3. 3Route large amounts further

    Add an amount band so requests above your limit add a Department head level. Bands and matrices choose the route from the record's values.

  4. 4Notify the requester

    Approvals publish events for assignment, decision, reminder, escalation and settlement. Configure the requester notification with an email template that includes the amount and the decision.

  5. 5Record decisions

    Approvers decide from the inbox. From your own front end, decisions are inserts into the approval decision entity; the client SDK wraps this as workflow.decide.

    TypeScriptIllustrative: check the SDK types for the exact input fields
    import { inject } from '@angular/core';
    import { TAF_WORKFLOW } from 'taf-client-angular';
    
    const workflow = inject(TAF_WORKFLOW);
    
    // Record a decision on the approval step assigned to the current user
    await workflow.decide({ stepId, decision: 'Approve', comment: 'Within budget' });

Result

Every new purchase request goes to the requester's manager, then to two finance approvers, with reminders, escalation and a locked record until it is settled.

Screenshots

Step-by-step screenshots for this tutorial are coming soon.