Skip to main content

Defining Custom Business Logic and Rules

A first-time user introduction to Docupath's three-part business logic layer: Instruction Builds, Transformation Rules, and Rejection Rules. Explains what each tool does, when to use each, and how they work together in sequence

Docupath gives you three tools to embed your organisation's business logic directly into document processing: Instruction Builds, Transformation Rules, and Rejection Rules. Each tool plays a distinct role and they run in sequence — Instruction Builds guide how the AI reads documents, Transformations clean and reshape the extracted data, and Rejection Rules act as the final compliance gate that blocks non-conforming documents before they reach approval.

If you are new to Docupath, this article explains what each tool does, how they fit together, and which one to reach for first.


Why Custom Business Logic Matters

Docupath's AI extracts data from documents automatically but every organisation has rules that go beyond simple extraction. You might need to:

  • Validate purchase order numbers against a specific format

  • Default a missing currency field to USD for a particular trading partner

  • Automatically reject any invoice where the total is zero or the PO number is missing

Out of the box, Docupath handles common extraction patterns. Custom business logic lets you extend that with rules that are specific to your organisation, your trading partners, or the countries you operate in all without writing any code.


The Three Tools at a Glance

Think of the three tools as a pipeline that runs after a document is uploaded and processed by AI:

Document uploaded → AI extracts data    

[1] Instruction Builds → Guides how the AI reads and interprets the document

[2] Transformation Rules → Reshapes and standardises the extracted values

[3] Rejection Rules → Blocks documents that violate compliance conditions

Document ready for human review

Each layer builds on the one before it. Rejection Rules evaluate the final, transformed values so the accuracy of your Instruction Builds and the completeness of your Transformations directly affects how well your Rejection Rules perform.


Instruction Builds: Teaching the AI How to Read

Instruction Builds let you write plain-English rules that tell the AI how to extract, infer, and validate data from your documents. You do not need any coding or scripting knowledge you describe what you want in numbered steps, and the AI follows them.

What you can do with Instruction Builds:

  • Tell the AI to find a PO number in a specific format (e.g. "Find an 8-digit number starting with 29")

  • Infer missing fields from context (e.g. "If the invoice date is missing, use the document receipt date")

  • Validate extracted values against a reference list (e.g. "Match the cost centre against the approved list; if no match, leave the field empty")

  • Apply region-specific formatting rules (e.g. "Treat commas as thousands separators, not decimal separators")

Where to find it: Main Menu → Instruction Builds

Who can configure it: Admin users only

A simple example:

  1. Find the purchase order number. It is an 8-digit number starting with 29.

  1. Capture digits only — ignore any 'PO' prefix or whitespace.

  1. If no PO number is found, leave the field empty.


Transformation Rules: Cleaning and Standardising Data

Transformation Rules run after the AI has extracted data and after Instruction Builds have refined it. They are condition-based rules: if a field meets a certain condition, then apply an action to it.

Transformations are best for straightforward field adjustments setting default values, converting units, adjusting amounts, or looking up values from a reference table.

What you can do with Transformation Rules:

  • Set a default currency when the field is empty (SET currency = "USD" when currency IS_NULL)

  • Convert units (MULTIPLY qty BY 1000 when the unit is kilograms and you need grams)

  • Apply a VAT adjustment (INCREASE total BY 10% when country = "US")

  • Map values using a CSV lookup table (e.g. map country codes to country names)

Where to find it: Main Menu → Transformations

Who can configure it: Admin users only

A simple example:

Condition: currency IS_NULL

Action: SET currency = "USD"

This rule silently fills in the currency field for any document where the AI did not find a currency value.


Rejection Rules: Your Compliance Guardrail

Rejection Rules are the final checkpoint before a document reaches a human reviewer. If a document violates a condition you have defined, it is automatically moved to Rejected status with a logged reason and it does not proceed to approval.

Unlike Instruction Builds and Transformations, Rejection Rules are strictly deterministic: they do not correct or infer anything. If the condition is true, the document is rejected. This predictability is by design it makes rejection outcomes transparent and auditable.

What you can do with Rejection Rules:

  • Reject documents with missing required fields (po_number IS_NULL)

  • Reject documents with zero or negative totals (total <= 0)

  • Reject test documents (notes = "for testing only")

  • Reject documents where a field value is not in an approved CSV list (e.g. unapproved cost centres)

Where to find it: Main Menu → Rejections

Who can configure it: Admin users only

A simple example:

Condition: po_number IS_NULL

Rejection reason: "Missing PO number"

Any invoice without a purchase order number is automatically rejected and the reason is logged against the document.


Which Tool Should I Use?

A common question for new users is which tool to reach for first. Here is a simple way to think about it:

If you want to…

Use…

Change how the AI reads or interprets a field

Instruction Builds

Infer or fill in a missing value

Instruction Builds

Reformat, convert, or default a value after extraction

Transformation Rules

Apply a calculation or adjustment to a field

Transformation Rules

Block documents that are missing a required field

Rejection Rules

Block documents that contain invalid or non-compliant values

Rejection Rules

As a general rule: use Instruction Builds to teach the AI what to extract, use Transformations to polish the result, and use Rejection Rules to enforce the compliance boundary.


Getting Started: A Suggested First Configuration

If you are setting up business logic for the first time, here is a practical starting point:

  1. Start with a Global Rejection Rule for your most critical required field (e.g. reject if PO number is missing). This immediately catches the most common error without any complex setup.

  2. Add a Global Transformation Rule for any field that should always have a default value (e.g. set currency to USD when empty). This reduces the number of documents a reviewer needs to manually correct.

  3. Write an Organisation or Trading Party Instruction Build once you have identified a pattern where the AI is consistently misreading a specific document type or supplier format.

Start simple and narrow. A few precise rules applied at the right scope will outperform a large set of broad, overlapping rules.


Access and Governance

  • Only Admin users can create, edit, or delete Instruction Builds, Transformations, and Rejections.

  • All changes are recorded in Activity Logs with timestamps and the name of the user who made the change.

  • Always test new rules with sample documents before enabling them at scale — especially Rejection Rules, which can block documents immediately.

Did this answer your question?