Stock Calculation and Synchronization
How Business Central Inventory Syncs to BigCommerce
1. Overview
When inventory levels change in Business Central, the system automatically calculates available stock for each product and location, then sends it to BigCommerce. This document explains the four stock calculation policies, how inventory is determined, and the synchronization process.
Visual Flowcharts
Flowchart 1: Main Stock Synchronization Flow
graph TD
Start["Stock Sync Triggered"] --> GetLocations["Get All Locations"]
GetLocations --> FilterLoc{"Non-NoCalculation?"}
FilterLoc -->|NO| SkipLoc["Skip"]
FilterLoc -->|YES| GetProducts["Get Products"]
GetProducts --> ProcessProd["For Each Product"]
ProcessProd --> LoadPolicy["Load Policy"]
LoadPolicy --> CalcStock["Get Implementation"]
CalcStock --> Complete["Complete"]
Flowchart 2: Four Stock Calculation Policies
graph TD
Start["Calculate Stock"] --> SelectPolicy{"Policy?"}
SelectPolicy -->|0| NC["No Calculation"]
SelectPolicy -->|1| PAB["Projected Available"]
SelectPolicy -->|2| NR["Non-Reserved"]
SelectPolicy -->|3| IMO["Minus Outgoing"]
NC --> Done["Done"]
PAB --> Done
NR --> Done
IMO --> Done
2. Four Stock Calculation Policies
Policy 0: No Calculation
- No stock is calculated or sent to BigCommerce
- Inventory is not tracked
- Result: Empty; location is skipped
Policy 1: Projected Available Balance at Today
- Formula: Projected available balance up to today
- Use when: You want realistic available stock considering future commitments
Policy 2: Free Inventory (Non-Reserved)
- Formula: Inventory - Reserved Qty on Inventory
- Use when: You want inventory available for new orders
Policy 3: Inventory - Outgoing
- Formula: Inventory - (Sales + Purchase Returns + Service Orders)
- Use when: You want inventory excluding all commitments
3. Inventory Tracking Modes
Product-Level
- When: Product has no variants
- All inventory tracked as one quantity
Variant-Level
- When: Product has variants (sizes, colors, etc.)
- Each variant has its own stock level
4. BigCommerce to BC Field Mappings
BC Item Table (Source of Stock)
| BC Field | Used By | Description |
|---|---|---|
| No. | Product.ItemNo | Item identifier |
| Inventory | All Policies | Physical stock |
| Reserved Qty on Inventory | Policy 2 | Reserved quantities |
| Qty on Sales Orders | Policy 3 | Customer commitments |
| Qty on Purchase Return Orders | Policy 3 | Supplier returns |
| Qty on Service Orders | Policy 3 | Service commitments |
BigCommerce Inventory (Destination)
| Field | Source |
|---|---|
| product_id | Product.Id |
| variant_id | ProductVariant.VariantId |
| location_id | Location.Id |
| quantity | Calculated value |
5. Key Business Central Tables
- Item: Contains inventory items
- Item Ledger Entry: Logs inventory movements
- Reservation Entry: Tracks reserved quantities
- Sales Order: Customer orders (Policy 3)
- Purchase Return Order: Supplier returns (Policy 3)
- Service Order: Service work (Policy 3)
6. Key BigCommerce Extension Tables
ProductSXE
Stores BigCommerce product data (Id, ItemNo, ProductType)
ProductVariantSXE
Stores BigCommerce product variants (Id, VariantId, ProductId)
LocationSXE
Stores BigCommerce locations (Id, StockCalculationPolicy, LocationFilter)
InventorySXE
In-memory object for one inventory calculation result
InventoryCacheSXE
Buffers calculations and batches data (200 items per batch)
7. Example: Real Stock Calculation
Scenario: Sync T-Shirt Inventory
Setup:
- Product: T-Shirt (ID: 5001)
- Location: US Warehouse (Policy 2: Non-Reserved)
- BC Item: ITEM-100, Inventory: 150, Reserved: 20
Calculation:
- Policy: NonReservedInventory
- Tracking: Product-level
- Stock: 150 - 20 = 130 units
- Result: BigCommerce shows 130 units
8. Example: Variant-Level Tracking
Scenario: Multi-Variant Product
Setup:
- Product: T-Shirt with Small, Medium, Large variants
- Policy: Projected Available
Results:
- Small: 45 units
- Medium: 55 units
- Large: 40 units
9. Synchronization Triggers
| Event | Example |
|---|---|
| Item Ledger Entry created | Purchase receipt, Sales shipment |
| Reservation created | Pick operation, Order reservation |
| Sales Order released | SO released to warehouse |
| Purchase Return Order released | PR released |
| Service Order released | SO released |
End of Document
This stock calculation schema explains how Business Central inventory is calculated and synchronized to BigCommerce.