---
id: object/codeunit/5701
type: object
title: Codeunit 5701 "Item Subst."
summary: Codeunit 5701 "Item Subst." in Base Application (Microsoft.Inventory.Item.Substitution). 5 public procedures, 14 events. Present since at least BC23, still in BC30, changed in BC25-26, BC28-29.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "29"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 8aea130219f5738e347ddd04087524f32e49660237d920c18657c5b6c53fde6d
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Inventory/Item/Substitution/ItemSubst.Codeunit.al
    title: src/Layers/W1/BaseApp/Inventory/Item/Substitution/ItemSubst.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 5701
name: Item Subst.
namespace: Microsoft.Inventory.Item.Substitution
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "25"
  - "26"
  - "28"
  - "29"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 25
  events: 14
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 6
  called_by: 4
  implements: 0
---

# Codeunit 5701 "Item Subst."

> Codeunit 5701 "Item Subst." in Base Application (Microsoft.Inventory.Item.Substitution). 5 public procedures, 14 events. Present since at least BC23, still in BC30, changed in BC25-26, BC28-29.

Base Application · Microsoft.Inventory.Item.Substitution · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Inventory/Item/Substitution/ItemSubst.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Permissions | TableData "Item Substitution" = rimd |

## Events published

- `OnAfterItemSubstGet(var SalesLine: Record "Sales Line"; TempSalesLine: Record "Sales Line" temporary)` (integration)
- `OnBeforeSaveItemSalesUOM(var OldSalesUOM: Code[10]; Item: Record Item; var IsHandled: Boolean)` (integration)
- `OnCalcCustPriceOnAfterCalcQtyAvail(var Item: Record Item; SalesLine: Record "Sales Line"; var TempItemSubstitution: Record "Item Substitution" temporary)` (integration)
- `OnCalcCustPriceOnBeforeCalcQtyAvail(var Item: Record Item; SalesLine: Record "Sales Line"; var TempItemSubstitution: Record "Item Substitution" temporary; ItemSubstitution: Record "Item Substitution")` (integration)
- `OnAssemblyCalcCustPriceOnAfterCalcQtyAvail(var Item: Record Item; AssemblyLine: Record "Assembly Line"; var TempItemSubstitution: Record "Item Substitution" temporary)` (integration)
- `OnAssemblyCalcCustPriceOnBeforeCalcQtyAvail(var Item: Record Item; AssemblyLine: Record "Assembly Line"; var TempItemSubstitution: Record "Item Substitution" temporary)` (integration)
- `OnBeforeCalcCustPrice(var TempItemSubstitution: Record "Item Substitution" temporary; TempSalesLine: Record "Sales Line" temporary; var IsHandled: Boolean; Item: Record Item)` (integration)
- `OnBeforeItemSubstGetPopulateTempSalesLine(var TempSalesline: Record "Sales Line" temporary; var TempItemSubstitution: Record "Item Substitution" temporary; var IsHandled: Boolean; SaveItemNo: Code[20]; SaveVariantCode: Code[10])` (integration)
- `OnCreateSubstListOnAfterCalcQuantityAvailable(var Item: Record Item; var TempItemSubstitution: Record "Item Substitution" temporary)` (integration)
- `OnCreateSubstListOnBeforeCalcQuantityAvailable(var Item: Record Item; var TempItemSubstitution: Record "Item Substitution" temporary)` (integration)
- `OnItemSubstGetOnAfterSubstSalesLineItem(var SalesLine: Record "Sales Line"; var SourceSalesLine: Record "Sales Line"; var TempItemSubstitution: Record "Item Substitution" temporary)` (integration)
- `OnItemSubstGetOnAfterItemSubstitutionSetFilters(var ItemSubstitution: Record "Item Substitution")` (integration)
- `OnItemSubstGetOnAfterTempItemSubstitutionSetFilters(var TempItemSubstitution: Record "Item Substitution" temporary; var SalesLine: Record "Sales Line"; var TempSalesLine: Record "Sales Line" temporary; OldSalesUOM: Code[10]; var IsHandled: Boolean)` (integration)
- `OnCalcCustPriceOnBeforeTempItemSubstitutionInsert(var TempItemSubstitution: Record "Item Substitution" temporary; ItemSubstitution: Record "Item Substitution")` (integration)

## Procedures

- `ItemSubstGet(var SalesLine: Record "Sales Line"): Boolean`
- `CalcCustPrice(var TempItemSubstitutions: Record "Item Substitution" temporary; var ItemSubstitution: Record "Item Substitution"; var TempSalesLine: Record "Sales Line" temporary)`
- `FindItemSubstitutions(var TempItemSubstitutions: Record "Item Substitution" temporary; ItemNo: Code[20]; VariantCode: Code[10]; LocationCode: Code[10]; DemandDate: Date; CalcATP: Boolean; var GrossReq: Decimal; var SchedRcpt: Decimal): Boolean`
- `ErrorMessage(ItemNo: Code[20]; VariantCode: Code[10])`
- `ItemAssemblySubstGet(var AssemblyLine: Record "Assembly Line")`

Plus 6 local procedures.

## Triggers

OnRun

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 5790 "Available to Promise"](../codeunit/5790.md) (3 calls: `AssemblyCalcCustPrice → CalcQtyAvailableToPromise`, `CalcCustPrice → CalcQtyAvailableToPromise`, `CreateSubstList → CalcQtyAvailableToPromise`)
- [Codeunit 311 "Item-Check Avail."](../codeunit/311.md) (2 calls: `ItemAssemblySubstGet → AssemblyLineCheck`, `ItemSubstGet → SalesLineCheck`)
- [Page 5718 "Item Substitution Entries"](../page/5718.md) (2 calls: `ItemAssemblySubstGet → (object)`, `ItemSubstGet → (object)`)
- [Codeunit 5703 "Catalog Item Management"](../codeunit/5703.md) (1 call: `ItemSubstGet → CreateItemFromNonstock`)
- [Codeunit 926 "Assembly Line-Reserve"](../codeunit/926.md) (1 call: `ItemAssemblySubstGet → DeleteLine`)
- [Codeunit 99000832 "Sales Line-Reserve"](../codeunit/99000832.md) (1 call: `ItemSubstGet → DeleteLine`)

## Called by

- [Codeunit 5522 "Order Planning Mgt."](../codeunit/5522.md) (2 calls: `InsertAltSupplySubstitution → ErrorMessage`, `InsertAltSupplySubstitution → FindItemSubstitutions`)
- [Codeunit 99000898 "Mfg. Item Substitution"](../codeunit/99000898.md) (2 calls: `GetProdOrderCompSubst → ErrorMessage`, `GetProdOrderCompSubst → FindItemSubstitutions`)
- [Table 37 "Sales Line"](../table/37.md) (1 call: `ShowItemSub → ItemSubstGet`)
- [Table 901 "Assembly Line"](../table/901.md) (1 call: `ShowItemSub → ItemAssemblySubstGet`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC25-26, BC28-29

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Item Subst.")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
