---
id: change/bcapps/14224
type: change
title: "#14224 Fix duplicate expense vendor numbers during receipt submission"
summary: Expense vendor number assignment now skips occupied numbers and surfaces numbering errors during receipt submission, preventing duplicate vendor key failures.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit expense vendor matching
  - table expense vendor
system: copilot
review:
  state: reviewed
  by: opus
  at: "2026-11-21T00:56:57.544Z"
  flags: []
generated:
  at: "2026-12-01T00:17:57.990Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 845308af5bac808b0bd03f3a22ca63549001a2b6
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/14224
    title: "microsoft/BCApps#14224: Fix duplicate expense vendor numbers during receipt submission"
    date: "2026-11-20"
    commit: 845308af5bac808b0bd03f3a22ca63549001a2b6
    t: null
    quote: Prevent receipt submission from failing when the next expense vendor number already belongs to an existing record.
links:
  learn: []
  objects:
    - object/codeunit/6931
    - object/table/6937
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/expense-management/expense-agent
      title: Expense Agent Overview in Business Central
      label: possibly related
      why: Documents Expense Agent which automates expense processing including vendor matching during receipt submission.
      by: model
number: 14224
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/14224
kind: pr
base_branch: main
major: "30"
merged_at: "2026-11-20T13:09:42Z"
author: Alexander-Ya
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - ExpenseManagement
  - "Team: Finance"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 3
  additions: 162
  deletions: 21
  al: 2
apps:
  - ExpenseAgent
objects_touched:
  - key: codeunit/6931
    page: codeunit/6931
    type: codeunit
    id: 6931
    name: Expense Vendor Matching
    app: ExpenseAgent
    status: modified
  - key: table/6937
    page: table/6937
    type: table
    id: 6937
    name: Expense Vendor
    app: ExpenseAgent
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 659559
systems:
  - copilot
quote: Prevent receipt submission from failing when the next expense vendor number already belongs to an existing record.
joined_against:
  major: "30"
  commit: d2abc1d2ceae394331716c8183ef60e1534c2ce0
---

# #14224 Fix duplicate expense vendor numbers during receipt submission

> Expense vendor number assignment now skips occupied numbers and surfaces numbering errors during receipt submission, preventing duplicate vendor key failures.

[Pull request](https://github.com/microsoft/BCApps/pull/14224) · merged into `main` (BC30) on 2026-11-20 by Alexander-Ya · 3 files (+162 -21), 2 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Matched and unmatched expense vendor creation both use the table's insert trigger for consistent numbering logic
- Numbering follows the standard Vendor table pattern to skip already-occupied numbers
- Number-series errors and warnings are no longer suppressed, surfacing actionable errors
- Blank vendor keys from missing error handling are prevented
- Four regression test scenarios validate the fix for normal and sequence series
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 6931 "Expense Vendor Matching"](../../objects/codeunit/6931.md), ExpenseAgent: modified
- [Table 6937 "Expense Vendor"](../../objects/table/6937.md), ExpenseAgent: modified

## Context

- Work items: AB#659559
- Labels: AL: Apps (W1), ExpenseManagement, Team: Finance
- Systems: copilot
- From the description: "Prevent receipt submission from failing when the next expense vendor number already belongs to an existing record."

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Expense Agent Overview in Business Central](https://learn.microsoft.com/dynamics365/business-central/expense-management/expense-agent) — possibly related: Documents Expense Agent which automates expense processing including vendor matching during receipt submission. (model-linked)

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
