code change · fixInventoryofficial - Microsoftreviewed - checked by Opus

#10254 Fix 644744: Undo subcontracting receipt keys Item Entry Relation with Capacity Ledger Entry No.

Subcontracting purchase receipt undo now uses the correct Output Item Ledger Entry instead of the Capacity Ledger Entry No. when recording item entry relations, preventing data corruption and duplicate key errors for tracked items.

Pull request · merged into main (BC30) on 2026-08-20 by alexei-dobriansky · 3 files (+198 -6), 1 AL · fix · tier official · reviewed (checked by Opus)

What changed

  • Undo of tracked subcontracting receipts now keys item entry relations from the actual posted Output Item Ledger Entry, not the capacity entry number
  • Fixes silent corruption and duplicate key errors in Item Entry Relation table for multi-output or tracked subcontracting undo
  • Normal items and single-line capacity-only undo paths remain unaffected
  • New tests verify the fix handles tracked undo correctly and guards against non-last-operation scenarios
  • Previously disabled test for undo with lot tracking re-enabled
  • Behaviour changes for users or extensions.

AL objects touched

Context

  • Work items: AB#644744
  • Labels: AL: Apps (W1), Subcontracting, Team: SCM
  • Systems: inventory

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