Understanding document type matching

Payment reference rules define how payment references are validated, matched, and processed in your system. These rules help automate reconciliation by identifying key elements in payment references—such as document numbers, amounts, or document type indicators.

You can set up document type matching as part of these rules to handle more advanced scenarios. Document type matching extracts and maps document type indicators (for example, INV for invoices or CM for credit memos) from payment references. This allows the system to more accurately match payments to their related documents, reducing manual effort and improving reconciliation accuracy.

Tipp

When you enable Match Document Type, link at least one document type mapping. Keep mappings up to date for all possible indicators, and always test your rule configuration before using it in production.

To create document type mappings

Set up mappings that define how document type indicators in payment references correspond to specific document types in Business Central.

  1. Search (Search) for and select Document Type Mappings.
  2. Add mappings for your document type indicators. Enter:
    • Code - a unique identifier for the mapping.
    • Description - a brief description of the mapping.
    • Document Type Indicator - for example, INV.
    • Document Type - for example, Invoice.

To create a payment reference rule for embedded document types

Use a payment reference rule to detect document type indicators that appear as part of payment references.

  1. Search (Search) for and select Payment Reference Rule.

  2. Click New.

  3. On the General FastTab, enter information for the fields marked with an asterisk:

    • Code
    • Payment Reference Search Template - for example, choose DESCTRANSACDETAILS.
  4. On the Validation FastTab, enter a pattern in the Validation Pattern Code field. For example, for a reference such as INV2024001, you could add the following regex: ^[A-Z]{2,3}\d{7}$

    PartMeaningExplanation
    ^Start of the stringEnsures the match begins at the start
    [A-Z]{2,3}2 to 3 uppercase lettersMatches prefixes such as IN, INV
    \d{7}Exactly 7 digitsMatches a 7-digit number such as INV2024001
    $End of the stringEnsures nothing comes after the digits
  5. On the Matching FastTab, enable Match Document Type and enter information for the following fields:

    • Match to Table - for example, select Cust. Ledger Entry.
    • Match to Field - for example, select Document Type.
    • Reference Start Position - for example, enter 4.
    • Reference Length - for example, enter 7.
    • Document Type Start Position: the position where the indicator begins in the payment reference. For the example INV2024001, enter 1.
    • Document Type Length: the number of characters in the indicator. For the example INV2024001, enter 3.
  6. On the action bar, click Related Document Types, and then link one or more mappings to the rule.

  7. Test the rule.

When the system processes a payment reference, it extracts the first three characters and matches them to a defined document type mapping. If no mapping exists for the indicator, the document type field remains blank.