Skip to content

Route a purchase request for approval

Use this workflow to submit an existing purchase request after any required review. This example requires approval for requests of 5,000 USD or more. Use the recorded amount from the purchasing system to make the decision.

Before you begin

Publish a purchasing approval process and configure Business Object functions to read and submit an existing purchase request. Create a top-level workflow for the Human Approval node.

Workflow flow

flowchart TD
    Start([Webhook receives requestId]) --> Read["Business Object Function · Read the purchase request"]
    Read --> Threshold{"If Condition · Amount is at least 5,000 USD?"}
    Threshold -->|Yes| Approval["Human Approval · Request a decision"]
    Threshold -->|No| Submit["Business Object Function · Submit the purchase request"]
    Approval --> Decision{"Approval outcome"}
    Decision -->|Approved| Submit
    Decision -->|Rejected| Rejected([Return the rejection result])
    Decision -->|Timeout or other outcome| Stop([Stop the submission path])
    Submit --> Result([Return the submission result])

Configure the workflow

  1. Webhook. Define a String input named requestId. Reject an empty ID before looking up the request.
  2. Read Purchase Request. Add a Business Object Function node with code GET_PURCHASE_REQUEST. Map the read operation's request ID to {{$context.$triggers.REST.$input.requestId}}. This example assumes the read result contains a numeric amountUsd at the output root. Validate that the read succeeded and returned an amount before continuing.
  3. If Condition. Evaluate {{$context.$nodes.GET_PURCHASE_REQUEST.$output.amountUsd >= 5000}}. Route the true path to review and the false path to submission.
  4. Human Approval. Select Approval Process as the Channel and choose the published process. Map the request ID and amount to the process payload. Disable feedback for this example.
  5. Approval decision. Give the approval node code APPROVE_PURCHASE_REQUEST. Check {{$context.$nodes.APPROVE_PURCHASE_REQUEST.$output.$actionPerformed == 'APPROVED'}} before submitting on the review path. For REJECTED, return the rejection result below. Route timeouts and other outcomes away from submission.
  6. Submit Purchase Request. Call the submission function with the same request ID on the direct and approved paths. Add a Return node for the submission result.

Run the example from a webhook

Create a purchase request for exactly 5,000 USD in a test environment. Invoke the published workflow with that request ID. Select Reject when the approval request arrives.

Sample request

{
  "invocationMode": "END_USER",
  "message": "Submit the purchase request.",
  "parameters": {
    "requestId": "REQ-1042"
  }
}

Sample workflow output after rejection

{
  "requestId": "REQ-1042",
  "status": "REJECTED"
}

To return this shape, construct the object on the rejection path using the webhook request ID and the rejection status, then map that object into Return Value.

Expected behavior

Scenario Expected behavior
Amount is 4,999 USD The workflow submits without creating a review.
Amount is 5,000 USD and the reviewer approves The workflow waits for the decision, then submits.
Amount is 5,000 USD and the reviewer rejects The workflow returns REJECTED and skips submission.
Approval times out The workflow follows the configured timeout or error path and skips submission.
The request or amount is unavailable The workflow reports the failed lookup or missing amount before routing to approval or submission.

Related guides
Human Approval · If Condition · Approval and feedback routing