Skip to content

Match Bank Payments: pass Payment Reference to DocumentMatching#8926

Open
JesperSchulz wants to merge 1 commit into
mainfrom
jesperschulz-match-bank-payments-payment-reference
Open

Match Bank Payments: pass Payment Reference to DocumentMatching#8926
JesperSchulz wants to merge 1 commit into
mainfrom
jesperschulz-match-bank-payments-payment-reference

Conversation

@JesperSchulz

@JesperSchulz JesperSchulz commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What & why

DocumentMatching in codeunit 1255 "Match Bank Payments" already accepts a PaymentReference parameter and contains the logic to match the bank rec line's Payment Reference No. against an open ledger entry's payment reference. The single W1 call site, however, hardcoded '' for that argument, so the match never fired (typical SEPA flow).

The buffer record Ledger Entry Matching Buffer already exposes the field and is populated for customer, vendor, and employee ledger entries (see InitializeCustomerLedgerEntriesMatchingBuffer, InitializeVendorLedgerEntriesMatchingBuffer, InitializeEmployeeLedgerEntriesMatchingBuffer).

The fix is one line: pass TempLedgerEntryMatchingBuffer."Payment Reference" instead of ''. Behavior is unchanged for buffers where the field is empty, since DocumentMatching early-exits when PaymentReference = ''.

A new test TestCustPaymentReferenceMatch is added to the W1/CH/DK/IT BankPmtApplAlgorithm test codeunits covering the SEPA scenario (no document number in the transaction text, so the payment reference is the only possible match).

Linked work

Fixes AB#640039

Ported from the internal NAV PR 249652 (originally microsoft/BusinessCentralApps#1912), as the internal NAV repo is closed for PRs.

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior.

What I tested and the outcome

New test TestCustPaymentReferenceMatch added to the bank payment application test codeunits (W1, CH, DK, IT) verifying that an open customer ledger entry is matched on Payment Reference when the document number is absent from the transaction text.

Risk & compatibility

Low. The only behavioral change is that a previously-suppressed match path (payment reference) now fires when the bank rec line carries a Payment Reference No.. Buffers with an empty payment reference are unaffected because DocumentMatching early-exits on an empty reference.

DocumentMatching in codeunit 1255 "Match Bank Payments" already accepts a PaymentReference parameter, but the W1 call site hardcoded '' so the bank rec line's Payment Reference No. was never matched against an open ledger entry's payment reference (typical SEPA flow). Pass TempLedgerEntryMatchingBuffer."Payment Reference" instead. Behavior is unchanged for empty references since DocumentMatching early-exits when PaymentReference = ''.

Ported from internal NAV PR 249652 (originally microsoft/BusinessCentralApps#1912).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JesperSchulz JesperSchulz requested a review from a team June 30, 2026 12:59
@github-actions github-actions Bot added this to the Version 29.0 milestone Jun 30, 2026
@JesperSchulz JesperSchulz added the Finance GitHub request for Finance area label Jun 30, 2026
@JesperSchulz JesperSchulz self-assigned this Jun 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 1 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630

Orchestrator pre-filter (13 file(s) excluded)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant