> For the complete documentation index, see [llms.txt](https://docs.jetadmin.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jetadmin.io/ai-app-builder/practical-guides/build-an-approval-app.md).

# Build an approval app

Build a purchase-request app with a manager decision queue.

## Prepare data

Use PurchaseRequests with a unique ID, Requester, Amount, Reason, Status, Decision reason, Decided by, and Decided at. Map these proposed fields to your actual schema. Prepare a staff user and a manager user.

## Build the first version

1. Select the source.
2. Adapt this prompt:

> Build a purchase-request app using PurchaseRequests. Staff can submit a request with Amount and Reason and see the requests they are allowed to access. Managers have a queue of Pending requests. Start with the lists and detail views before adding decision actions.

3. Check the records visible to each role.

## Add the decision flow

> Add Approve and Reject actions for managers on a Pending request. Require a reason for rejection. Record the decision, decision maker, and timestamp. Prevent a completed request from being decided again.

Configure the action permissions and inspect the generated update logic. Use the [approval workflow guide](/workflow/practical-guides/create-an-approval-process.md) when the decision belongs in a workflow.

## Test both outcomes

* Approve one Pending test request and verify its stored status and decision fields.
* Reject a different request and verify its reason.
* Try to decide a completed request again.
* Try the manager action as a staff user and confirm it is denied.

Add notifications only after the decision flow works, and test them with designated recipients.

Next: [Test and publish](/ai-app-builder/test-and-publish.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.jetadmin.io/ai-app-builder/practical-guides/build-an-approval-app.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
