← All guides

Web Service Stock Lookup: Giving Other Systems a Real-Time Inventory Answer

Data, integrations & replication · 8 min read · By Dex Carter · Published 2026-10-26 · Last updated 2026-10-26

Three magnifying glasses in blue, orange and pink examining plain boxes on store shelves, flat illustration
Three different answers to one stock question, the integrator's job is picking which one to trust.

An external system, a web store, a marketplace feed, a customer-order promise screen, asks LS Central one question: how many of this item are at this store? LS Central holds three different answers to that question, plus a fourth prepared for Commerce channels. They disagree by design. Each is calculated differently, refreshed on a different trigger, and wrong in a different way. Choosing the wrong one does not produce an error. It produces a confident number that a channel then promises to a customer.

The question behind the question: which stock number do you owe the channel?

The three answers are the Item Ledger figure, Aggregated Inventory’s Actual Inventory, and the precomputed Inventory Lookup Table figure. The Commerce Service adds a scheduled variant of the lookup idea. None of them is “the inventory.” Each is a calculation with a freshness window, and the window, not the arithmetic, is what an integrator is really choosing. A channel that promises same-day pickup needs a different window from a channel that publishes a daily availability feed. Start from the promise, then pick the answer whose window fits inside it.

One boundary up front: LS Retail’s public help names the pieces below but does not publish a ready-made request-and-response contract for an external stock lookup. The contract, what the caller sends, what comes back, how staleness is signalled, is the integrator’s to design. The sections after the three answers cover that design.

Answer 1: the Item Ledger figure and its posting lag

The default is the simplest. POS inventory look-up uses the Item Ledger only, unless Aggregated Inventory is in play. The figure is exactly what has been posted: receipts in, sales out, adjustments applied. Its weakness is built into the word posted. A sale at the till is not a ledger entry until it is posted, and the gap between the two has a name in LS Central: Qty. Sold not Posted, the quantity already sold at the POS but not yet posted into the Item Ledger.

So the raw ledger figure overstates availability by precisely the unposted sales. On a quiet morning that is zero and the number is honest. During a busy trading day it is the busiest number in the building, and it only ever errs in one direction: it says stock exists that has already been sold. Any external system reading the ledger directly inherits that one-way error, at full size, at the worst time of day.

Answer 2: Actual Inventory, the formula that subtracts sold-not-posted

Aggregated Inventory exists to correct that. Its headline figure, Actual Inventory, is a four-term formula:

Actual Inventory = Inventory (Item Ledger Entries) + Aggr. Inventory (Store Location) − Aggr. Inventory (Aggr. Location) − Qty. Sold not Posted

Read the terms in order. The ledger supplies the posted base. The two Aggregated Inventory terms adjust for stock held against store and aggregated locations. The final term subtracts the unposted sales, the exact quantity Answer 1 ignores. Aggregated Inventory adds Aggregated Inventory Entries to the calculation; without it, the look-up stops at the ledger. The same formula drives the Retail Item Card’s availability pages, which show inventory per Location, Variant and Period, a useful reference point, because it means a human checking the card and a system consuming Actual Inventory are at least arguing about the same number.

The trade-off is moving parts. Actual Inventory is only as current as its least current input, and it depends on the aggregated entries being maintained. It is the most honest of the three answers at the moment it is calculated. It is not automatically the freshest answer an hour later.

Answer 3: the precomputed lookup table and Commerce preparation jobs

The third answer changes the architecture instead of the arithmetic. With TS Inventory Lookup, stock levels are calculated in a central location and put in the Inventory Lookup Table, then sent to stores so each POS can query its local database. No live calculation happens at query time; the till reads a table that was prepared earlier. That makes the query cheap and local, and makes freshness a scheduling question. The lookup table must be updated regularly, and at minimum each time a new item or store is added, either manually or from the Scheduler. Miss the new-item trigger and the newest products are the ones with no answer at all.

The Commerce Service path is the same idea aimed at web channels, and it is worth naming precisely because it is so often described as live. It is not. The COMMERCE_INVENTORY job, running codeunit 10012871, calculates inventory status for items in product groups marked POS Inventory Lookup where the store is marked Web Store.

Alongside it, the COMMERCE_INIT and COMMERCE_UPDATE jobs, codeunit 10012870, generate the prices, discounts and store hours for Commerce, and they must run regularly to keep that data up to date. So the number a web channel receives is a snapshot taken at the last job run. Its freshness is the job interval, plus run time, plus whatever delay sits between the job and the channel reading it.

Freshness vs load: picking the answer per consumer

AnswerHow it is producedWhat sets its freshnessKnown blind spot
Item Ledger figureRead directly from posted ledger entries; the default for POS look-upPosting cadenceCounts stock already sold but not yet posted
Actual InventoryFour-term Aggregated Inventory formula, subtracting Qty. Sold not PostedCurrency of the ledger and the aggregated entries feeding itOnly as current as its least current input
Inventory Lookup TableCalculated centrally, sent to stores, queried locally by each POSTable update schedule; new item or store additionsA new item can have no row until the table is refreshed
Commerce-prepared statusCOMMERCE_INVENTORY job (codeunit 10012871) for Web Store locationsJob interval for the scheduler jobsA snapshot, however recent, not a live read

The pattern in the table: every step away from the ledger buys query speed or channel reach, and pays in freshness. That trade is often worth making. It should be made on purpose, per consumer. The in-store till, the web store and a third-party feed do not need the same answer, and forcing one answer on all three usually means the fastest channel is throttled by the slowest one’s schedule, or the slowest channel is silently reading a number prepared for a different purpose. Aggregated Inventory itself is built to feed several consumers: it supports POS Inventory Look-up, Mobile Inventory, eCommerce and Customer Orders. The support is broad; the freshness decision is still yours, per channel.

Design the lookup contract: store scope, variants, stale-data signalling

Three design decisions matter more than the transport.

First, scope: the availability formula resolves per Location and per Variant, so the contract should too. A chain-level total hides the only thing a pickup promise depends on, whether this store has this variant.

Second, identity of the answer: the response should say which calculation produced the figure. A channel that knows it is reading a Commerce-prepared snapshot can soften its promise wording; a channel that cannot tell a live read from a snapshot will eventually promise snapshot data with live-read confidence.

Third, stale-data signalling: every response should carry the time the figure was calculated or the job that produced it last ran, and the channel should have an agreed age beyond which it stops showing a number rather than showing an old one. Zero and stale are different answers; a contract that cannot express the difference will present both as zero.

Checks when the channel swears the number was wrong

Work the disagreement in this order. Each step eliminates one term of the formula or one link in the preparation chain.

  1. Name the answer the channel consumed. Ledger read, Actual Inventory, lookup table, or Commerce-prepared status. Most disputes end here: two systems compared different answers and both were “right.”
  2. Recompute Actual Inventory by hand for the item, location and variant in dispute. Pull the four terms, ledger inventory, the two aggregated terms, Qty. Sold not Posted, and do the subtraction. A mismatch with the channel’s figure localises the fault to one term.
  3. Interrogate Qty. Sold not Posted first among the terms. Unposted POS sales are the documented difference between the ledger answer and the corrected one; a spike there explains a phantom-stock complaint without anything being broken.
  4. Check the preparation clocks. When did COMMERCE_INVENTORY last run for that Web Store, and when were COMMERCE_INIT and COMMERCE_UPDATE last run for prices and hours? When was the Inventory Lookup Table last updated, and has an item or store been added since, which requires an update on its own?
  5. Compare against the Retail Item Card availability page. It shows inventory per Location, Variant and Period from the same formula. If the card and the recomputation agree and the channel disagrees, the fault is in the channel’s consumption, not in LS Central’s arithmetic.

What success looks like: the dispute resolves to a named cause, an unposted-sales window, a job interval, a missed table refresh, and the channel’s promise is reworded or re-scheduled to match the freshness of the answer it actually consumes. A stock lookup is a promise made by arithmetic. The integrator’s job is to make sure the arithmetic and the promise describe the same moment in time.

, Dex Carter, Tech Writer

Keep readingNext: Stock lookup across stores: which number the POS shows, and when to trust it →