Auto Processing

The auto-processing system handles incoming Peppol e-documents (invoices, credit memos, orders) by automatically validating, importing, approving, and posting them in Business Central. It consists of four core codeunits and is controlled by configuration settings.

Architecture overview

flowchart TD
    JQ["Job Queue (every 5 min)"]
    JQ --> APJ["RSMSTAAutoProcessJobQueue\n<i>Find new docs</i>"]
    APJ --> APO["RSMSTAAutoProcessPO\n<i>Validate, import, send to approval</i>"]
    JQ --> POST["RSMSTAPostAutoprocessedDocs\n<i>Post approved docs</i>"]

    IMP["On Document Import"]
    IMP --> APA["RSMSTAAutoPostAndApprove\n<i>Immediate import + post for\nconfigured vendors/customers</i>"]

Core codeunits

1. RSMSTAAutoProcessJobQueue (CU 10058628)

Purpose: Job queue entry point that finds unprocessed vendor documents and feeds them to the processor.

  • Runs every 5 minutes
  • Filters IntegrationPeppolHeader for status = New or In Matching, account type = Vendor
  • For each record, calls RSMSTAAutoProcessPO
  • On failure: sets document status to Error and stores the error message

2. RSMSTAAutoProcessPO (CU 10058627)

Purpose: The main processing engine for purchase documents. Handles the full lifecycle of a single document.

Flow:

  1. Skips OCR-generated documents
  2. Checks for duplicate purchase documents (by vendor + document number across headers, posted invoices, and posted credit memos)
  3. Validates the document against RSMSTA Validation Setup rules (header fields + line items)
  4. If linked to an existing PO → updates the purchase order with invoice details
  5. If no PO → creates a new purchase header from the Peppol data
  6. Posts to receive (handles warehouse receipt creation if location requires it)
  7. Sends to approval workflow (sets RSMSTA Autoprocessed = true)
  8. Compares purchase order amounts with the incoming invoice

Integration events: OnBeforeValidateDocument, OnAfterValidateDocument, OnBeforeOnRun

3. RSMSTAPostAutoprocessedDocs (CU 10058611)

Purpose: Second job queue that posts documents that have been approved.

  • Runs every 5 minutes
  • Finds Purchase Orders where RSMSTA Autoprocessed = true and Status = Released
  • Posts them with both Receive and Invoice flags set to true
  • Updates the IntegrationPeppolHeader status to Error if posting fails

4. RSMSTAAutoPostAndApprove (CU 10058622)

Purpose: Triggered during document import for vendors/customers with specific auto-posting settings.

  • Purchase path: Checks vendor’s posting template for Automatic Appr. Post of Inv. → imports and posts immediately. If only Automatically Process Invoice is set → imports without posting.
  • Sales path: If AutoProcessOrderToSO → creates sales order. If Auto Post Order → also posts it.
  • Validates variance amount against configured threshold before posting.

Document status progression

flowchart LR
    A["New / In Matching"] --> B["In Approval"]
    B --> C["Released"]
    C --> D["Posted (Processed)"]
    A -. "failure" .-> E["Error"]
    D -. "failure" .-> E

Configuration settings

SettingLocationEffect
Enable Auto-Process InvoicesPurchases & Payables SetupMaster switch — enables/disables both job queues
Manual ApprovalsPurchases & Payables SetupPrevents automatic sending to approval workflow
Variance AmountPurchases & Payables / Sales & Receivables SetupThreshold % for amount variance validation
Auto Post to ReceivePurchases & Payables SetupControls warehouse-receipt posting during auto-processing — Disabled / Orders / Invoices / Both
Automatic Appr. Post of Inv.Vendor Posting TemplateAuto-posts vendor invoices on import
Automatically Process InvoiceVendor Posting TemplateAuto-imports vendor invoices (no post)
Auto Process Order to Sales OrderSales & Receivables SetupAuto-creates sales orders from Peppol orders
Auto Post Sales OrderSales & Receivables SetupAuto-posts created sales orders

Per-document-type rules

For finer control, the Centara Auto-Process Setup page (search for it in BC, or open from the Centara Setup menu) lets you define rules that decide whether a specific incoming document type is auto-processed at all — optionally narrowed to a single vendor.

FieldDescription
Receive E-Document ToThe incoming document type the rule applies to: Purchase Order, Purchase Invoice, Purchase Credit Memo, or Purchase Return Order
Vendor No.Optional — restricts the rule to a single vendor. Leave blank to apply to all vendors
Execute Auto-ProcessWhen off, matching documents are imported but parked in New status for manual handling instead of being pushed through the auto-process pipeline

A typical use case: turn off auto-processing for Purchase Return Orders globally while leaving it on for Invoices and Orders, so returns always get a manual review step.

Manual retry

Users can manually trigger auto-processing on error documents via the Auto Process Document action on both the Inbound Documents page and the Purchase Documents Review page. This runs the same RSMSTAAutoProcessPO codeunit.