code change · performanceInventoryofficial - Microsoftreviewed - checked by Opus

#13725 Reduce repeated ILE reads and JIT loads in average cost adjustment

Codeunit 5895 Inventory Adjustment reduces repeated database reads and JIT loads during average cost calculation by caching Item Ledger Entry data, loading required fields upfront, and removing ineffective LoadFields calls.

Pull request · merged into main (BC30) on 2026-11-06 by alexei-dobriansky · 3 files (+99 -33), 3 AL · performance · tier official · reviewed (checked by Opus)

What changed

  • Caches the immutable Positive field from Item Ledger Entry in a dictionary to eliminate repeated lookups
  • Loads all required chain fields upfront in ExcludeAvgCostOnValuationDate and IsAvgCostException to prevent JIT loads
  • Removes ineffective LoadFields calls in AvgValueEntriesToAdjustExist and CollectOpenValueEntries
  • Adds missing fields to load lists: Applied Entry to Adjust and Valuation Date
  • Improves performance for high-volume items where processing time grew quadratically with value entries

AL objects touched

Also merged into

  • #13800 into releases/29.x on 2026-11-13

Context

  • Work items: AB#658046
  • Labels: Ownership: Manual, Team: SCM
  • Systems: inventory

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

  • Design details - Average cost — possibly related: Documents average cost calculation and cost adjustment mechanism in inventory. (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).