---
id: change/bcapps/10509
type: change
title: "#10509 [IRS Forms] Performance optimization"
summary: IRS 1099 form box calculation now queries detailed vendor ledger entries with a current key matching its equality filters and can filter payments by vendor. Profiling had shown one query taking most of a roughly 10-minute run; calculation results are unchanged.
tier: official
language: en
tags:
  - performance
  - main
  - bc30
  - codeunit irs 1099 form box calc. impl.
system: finance
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:07:44.267Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 38826aabb0a81845cbf84b5bf271a9544f77ce79
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/10509
    title: "microsoft/BCApps#10509: [IRS Forms] Performance optimization"
    date: "2026-08-24"
    commit: 38826aabb0a81845cbf84b5bf271a9544f77ce79
    t: null
    quote: Aligning the current key with those equality filters lets the optimizer satisfy the ordering with a selective index seek instead of a broad scan.
links:
  learn: []
  objects:
    - object/codeunit/10041-us
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 10509
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/10509
kind: pr
base_branch: main
major: "30"
merged_at: "2026-08-24T13:25:20Z"
author: dcenic
author_type: User
community_contribution: false
labels:
  - "Team: Finance"
change_class: code
change_kind: performance
behavior_change: false
breaking: false
files:
  count: 1
  additions: 5
  deletions: 3
  al: 1
apps:
  - IRSForms
objects_touched:
  - key: codeunit/10041
    page: codeunit/10041-us
    type: codeunit
    id: 10041
    name: IRS 1099 Form Box Calc. Impl.
    app: IRSForms
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 647491
systems:
  - finance
quote: Aligning the current key with those equality filters lets the optimizer satisfy the ordering with a selective index seek instead of a broad scan.
joined_against:
  major: "30"
  commit: a4406cfa9e57437fedc49c53c327a199a854491e
---

# #10509 [IRS Forms] Performance optimization

> IRS 1099 form box calculation now queries detailed vendor ledger entries with a current key matching its equality filters and can filter payments by vendor. Profiling had shown one query taking most of a roughly 10-minute run; calculation results are unchanged.

[Pull request](https://github.com/microsoft/BCApps/pull/10509) · merged into `main` (BC30) on 2026-08-24 by dcenic · 1 file (+5 -3), 1 AL · performance · tier official · reviewed (checked by Opus)

## What changed

- FindRelatedApplicationDetailedVendorLedgerEntries now uses the existing key Application No., Vendor No., Entry Type instead of Vendor Ledger Entry No., Entry Type
- FilterPaymentVendorLedgerEntries gets a VendorNo parameter and filters on Vendor No. when a specific vendor is requested
- No schema changes; existing keys are reused
- Single-vendor recalculations no longer enumerate payments for the whole period
- Performance gain still to be confirmed by re-profiling; existing tests cover the paths

## AL objects touched

- [Codeunit 10041 "IRS 1099 Form Box Calc. Impl."](../../objects/codeunit/10041-us.md), IRSForms (US layer): modified

## Context

- Work items: AB#647491
- Labels: Team: Finance
- Systems: finance
- From the description: "Aligning the current key with those equality filters lets the optimizer satisfy the ordering with a selective index seek instead of a broad scan."

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).
