Draft Document Configuration

Draft document rules let you control when a document should require review before final release.

In the web portal, this is configured under Configuration > Billing > Draft Document.

The rules are based on JSONata expressions and evaluate document data from the invoice structure of the Document API.

📘

Draft documents cannot be created directly via the Document API — they only come into existence through the draft document rules described on this page. The content of a draft cannot be edited either: a draft is reviewed and then released or rejected as it is.

When to use draft document rules

Draft document rules are useful when certain documents should be reviewed before they are finalized.

Typical examples include:

  • high invoice amounts
  • specific currencies
  • specific billing groups
  • country-specific checks

Where to find the configuration

In the web portal, navigate to:

Configuration > Billing > Draft Document

On this page, you can:

  • create a new rule
  • edit an existing rule
  • delete a rule
  • view the configured JSONata expression and description

Create a draft document rule

When creating or editing a rule, the following fields are available:

Description

Use this field to document the purpose of the rule.

Example:

Create draft documents for invoices above 10,000 EUR

JSONata Rule

Define the condition that determines whether a document should be created as a draft.

Example:

currency = "EUR" and documentTotals.totalNetSum > 10000

If the expression evaluates to true, the document is created as a draft.

If the expression is invalid, the UI displays a validation error.

How rule evaluation works

You can configure multiple draft document rules per tenant.

Rules are evaluated with OR logic:
• if at least one rule evaluates to true, the document is created as a draft
• if no rule evaluates to true, the document is processed without draft enforcement

Rejecting a draft document

A draft document is either released or rejected. When a draft is rejected, instellix cleans up automatically: the billable items behind the rejected draft are set to an error state, and voucher redemptions that were applied to the draft are rolled back automatically. No manual cleanup is required.

JSONata examples

  1. Create a draft for all documents with a net amount above 10,000 EUR
    currency = "EUR" and documentTotals.totalNetSum > 10000
  2. Create a draft for all documents in a specific billing group
    billingGroupIdent = "xy"
  3. Create a draft for all CHF documents with a net amount above 5,000 CHF
    currency = "CHF" and documentTotals.totalNetSum > 5000
  4. Create a draft for all documents with invoice country Romania
    customerDetail.invoiceAddress.country = "RO"

Configure draft rules

In the web portal, draft rules are managed on the Draft Document Configurations page. To open it, navigate to: Configuration > Billing > Draft Documents.

The page lists all configured rules with their JSONata-Rule and Description. To add a rule, create a new draft document configuration: enter a Description that documents the purpose of the rule, and the JSONata-Rule that is evaluated against the document data. For example:

documentTotals.totalNetSum > 3141592 and currency = "EUR"

This rule holds every EUR document with a net total above 3,141,592 as a draft for review before it is finalized.

Review and release draft documents

Draft documents are reviewed and released in the webportal: navigate to Billing > Draft Documents. The overview lists all documents currently held as drafts — use the Actions of a draft to release it, so it becomes a finalized document.


Did this page help you?