Skip to content
D365 Reference

InventBatch

worksheet header

Batch master — one row per item and batch number, carrying expiry and manufacturing dates plus vendor batch details; the record behind the inventBatchId dimension

Module: InventoryCompany-partitioned (DataAreaId)
Notes

Keyed by itemId + inventBatchId (batch numbers are unique per item, not global). Pds* fields belong to Process manufacturing and are empty unless that module is used.

Fields

14 fields · 2 key

KeyFieldEDTDescriptionTypeLengthFlags
KeyinventBatchIdInventBatchIdThe batch number — unique within the item, referenced by InventDim.inventBatchIdstring
KeyitemIdItemIdItem the batch belongs to — batch numbers are scoped to an item, so joins need both columnsstring
descriptionFree-text description of the batchstring
expDateExpiration date of the batch; unset rows carry the 1900-01-01 sentineldate
prodDateManufacturing date of the batch; unset rows carry the 1900-01-01 sentineldate
PdsBestBeforeDateBest-before date (process manufacturing); unset rows carry the 1900-01-01 sentineldate
PdsShelfAdviceDateShelf-advice date (process manufacturing); unset rows carry the 1900-01-01 sentineldate
PdsDispositionCodeBatch disposition code controlling whether the batch is usable, blocked, or restrictedstring
PdsVendBatchIdThe vendor's own batch number for a purchased batchstring
PdsVendBatchDateVendor batch (manufacturing) date; unset rows carry the 1900-01-01 sentineldate
PdsVendExpiryDateVendor expiry date; unset rows carry the 1900-01-01 sentineldate
PdsCountryOfOrigin1Country of origin recorded for the batchstring
PdsFinishedGoodsDateTestedDate the finished-goods batch was tested; unset rows carry the 1900-01-01 sentineldate
ManufacturerIdRecIdRecId of the manufacturer's global-address-book party in DirPartyTableint64

Field provenance: hand-curated.

Boilerplate SQL

Starting point for reading InventBatchon Databricks — enums are decoded, 1900-01-01 dates are wrapped to NULL, and the DataAreaId anchor is in place. Set your Unity Catalog location, company, and filter values below; they’re substituted into the SQL and the copy button.

Query parameters
-- ============================================================
-- Table  : InventBatch Batch master — one row per item and batch number, carrying expiry and manufacturing dates plus vendor batch details; the record behind the inventBatchId dimension
-- Purpose: Column-selected read of InventBatch — auto-generated from field metadata
-- Grain  : One row per company (dataareaid) + inventBatchId + itemId
-- Notes  : Auto-generated skeleton for Synapse Link / Fabric Link-landed F&O data (lowercase column names). Enums decoded inline where verified; datetimes stored in UTC; 1900-01-01 dates are sentinels mapped to NULL. System/audit columns omitted — see the quirks guide.
-- ============================================================
SELECT
  i.inventbatchid AS "The batch number — unique within the item, referenced by InventDim.inventBatchId",
  i.itemid AS "Item the batch belongs to — batch numbers are scoped to an item, so joins need both columns",
  i.description AS "Free-text description of the batch",
  CASE WHEN CAST(i.expdate AS DATE) = DATE '1900-01-01' THEN NULL ELSE CAST(i.expdate AS DATE) END AS "Expiration date of the batch; unset rows carry the 1900-01-01 sentinel",  -- 1900-01-01 sentinel → NULL
  CASE WHEN CAST(i.proddate AS DATE) = DATE '1900-01-01' THEN NULL ELSE CAST(i.proddate AS DATE) END AS "Manufacturing date of the batch; unset rows carry the 1900-01-01 sentinel",  -- 1900-01-01 sentinel → NULL
  CASE WHEN CAST(i.pdsbestbeforedate AS DATE) = DATE '1900-01-01' THEN NULL ELSE CAST(i.pdsbestbeforedate AS DATE) END AS "Best-before date (process manufacturing); unset rows carry the 1900-01-01 sentinel",  -- 1900-01-01 sentinel → NULL
  CASE WHEN CAST(i.pdsshelfadvicedate AS DATE) = DATE '1900-01-01' THEN NULL ELSE CAST(i.pdsshelfadvicedate AS DATE) END AS "Shelf-advice date (process manufacturing); unset rows carry the 1900-01-01 sentinel",  -- 1900-01-01 sentinel → NULL
  i.pdsdispositioncode AS "Batch disposition code controlling whether the batch is usable, blocked, or restricted",
  i.pdsvendbatchid AS "The vendor's own batch number for a purchased batch",
  CASE WHEN CAST(i.pdsvendbatchdate AS DATE) = DATE '1900-01-01' THEN NULL ELSE CAST(i.pdsvendbatchdate AS DATE) END AS "Vendor batch (manufacturing) date; unset rows carry the 1900-01-01 sentinel",  -- 1900-01-01 sentinel → NULL
  CASE WHEN CAST(i.pdsvendexpirydate AS DATE) = DATE '1900-01-01' THEN NULL ELSE CAST(i.pdsvendexpirydate AS DATE) END AS "Vendor expiry date; unset rows carry the 1900-01-01 sentinel",  -- 1900-01-01 sentinel → NULL
  i.pdscountryoforigin1 AS "Country of origin recorded for the batch",
  CASE WHEN CAST(i.pdsfinishedgoodsdatetested AS DATE) = DATE '1900-01-01' THEN NULL ELSE CAST(i.pdsfinishedgoodsdatetested AS DATE) END AS "Date the finished-goods batch was tested; unset rows carry the 1900-01-01 sentinel",  -- 1900-01-01 sentinel → NULL
  i.manufacturerid AS "RecId of the manufacturer's global-address-book party in DirPartyTable"
FROM <catalog>.<schema>.inventbatch i
-- Resolve DirPartyTable (via ManufacturerId): uncomment to join on its RecId surrogate key
-- LEFT JOIN <catalog>.<schema>.dirpartytable dir ON dir.recid = i.manufacturerid
WHERE
  i.dataareaid = '<company>'
  -- AND i.itemid = '<ItemId>'
ORDER BY i.inventbatchid;

4 parameters not filled: <catalog>, <schema>, <company>, <ItemId>

Relationships

1-hop neighbors — click a table to navigate there. RecId and InventDim edges are highlighted; they’re the joins newcomers most often get wrong.

Join details

  • InventBatchInventTableforeign key · N:1
    ON inventbatch.itemid = inventtable.itemid
  • InventBatchDirPartyTableRecId ref · N:1
    ON inventbatch.manufacturerid = dirpartytable.recid
  • InventDimInventBatchforeign key · N:1
    ON inventdim.inventbatchid = inventbatch.inventbatchid

Data Entities That Expose This Table

No data-entity mappings populated for this table yet.