Fluent Commerce Logo
Docs

SendEventOnFulfilmentInventoryUpdate

Rule

Changed on:

8 Dec 2025

Overview

Sends an event to inventory positions based on the fulfillment update type:
  • Reserve when inventory is reserved 
  • Cancel when inventory is unreserved
  • Confirm when a pick is confirmed 
Each event includes: 
  • The configured inventory quantity types (for example, `RESERVED`, `SALE`, `CORRECTION`)
  • The current on-hand value of the inventory position, so downstream workflows can accurately detect real stock changes
Plugin NameInventory Reference Module
Namespace[[account.id]].globalinventory
The Inventory Reference Module is the foundation for inventory related implementations. It provides reference Workflows for inventory ingestion and processing. Extensible by design, use this Module as a base to build a solution to the needs of your customers.The Inventory Module includes the following areas:
  • Product Catalogue workflow
  • Inventory Catalogue workflow
  • Control Group workflow
  • Virtual Catalogue workflow

UI Description

Send event {inventoryConfirmationEvent} if inventory is confirmed, or send {inventoryReserveEvent} if inventory is reserved, or {inventoryCancelEvent} if inventory is cancelled, to inventory position and include inventory quantities of type {inventoryQuantityTypes} in event attribute.

Accepts

  • INVENTORY_CATALOGUE

Actions

  • This rule produces multiple SendEventActions that forwards the incoming event as a scheduled event with the given name {inventoryConfirmationEvent}, {inventoryCancelEvent}, {inventoryReserveEvent} and following event attributes to the inventory position

Rule parameters

NameTypeDescription
`inventoryConfirmationEvent``String`The name of event to be triggered if inventory is confirmed
`inventoryCancelEvent``String`The name of event to be triggered if inventory is cancelled
`inventoryReserveEvent``String`The name of event to be triggered if inventory is reserved
`inventoryQuantityTypes``List<String>`Inventory quantity types

Event attributes

The incoming event must include an `items` list containing one or more fulfillment inventory update entries.
NameTypeDescriptionRequired?
`items``List<Item>`A list of items describing the inventory changes associated with a fulfillment updateYes
Item Object Sub-attributes
Each object within `items` has the following structure:
NameTypeDescriptionRequired?
`skuRef``String`The SKU associated with the inventory updateYes
`locationRef``String`The location where the update appliesYes
`fulfilmentId``String`The fulfillment identifier associated with this updateYes
`reserveQty``Integer`The quantity to reserveYes
`saleQty``Integer`The quantity to deduct for a saleNo
`correctionQty``Integer`The quantity used for stock correctionNo
`cancelQty``Integer`The quantity to unreserveNo

Exceptions

  • This Rule throws a `PropertyNotFoundException` when the Rule parameter(s) is not provided.
  • This rule throws a general `RubixException` (with code 500) when the `items` event attribute is empty.

Configuration example

1{
2  "name": "[[account.id]].globalinventory.SendEventOnFulfilmentInventoryUpdate",
3  "props": {
4    "inventoryConfirmationEvent": "inventoryConfirmationEvent",
5    "inventoryCancelEvent": "inventoryCancelEvent",
6    "inventoryReserveEvent": "inventoryReserveEvent",
7    "inventoryQuantityTypes": ["RESERVED", "SALE"]
8  }
9}

Detailed Technical Description

For each incoming event:1. The rule validates that the rule parameters are provided (`inventoryConfirmationEvent`, `inventoryReserveEvent`, `inventoryCancelEvent`, `inventoryQuantityTypes`)2. It reads the `items` attribute from the event. If `items` is empty or missing, the rule throws a `RubixException`3. For each item in `items`:
  • Load the inventory position within the inventory catalogue, matching:
    • `productRef` = `item.skuRef`
    • `locationRef` = `item.locationRef`
    • `inventoryCatalogueRef` = incoming event `entityRef`
  • If no inventory position is found, or more than one is found, the rule logs a warning and skips that item
4. When inventory position is found:
  • The rule reads:
    • The reference of the inventory position
    • The current on-hand value from the inventory position (allows downstream workflows (e.g., `ForwardIfOnHandChanged` rule) to compare the previous on-hand value with a newly calculated on-hand value and only forward events when a real stock change occurs)
  • It builds a list of `inventoryQuantities`:
    • Always adds a `RESERVED` quantity using `item.reserveQty`. The quantity may be zero, but is always part of the `inventoryQuantities` list.
    • Optionally adds:
      • a `SALE` quantity if `item.saleQty` != 0 and `SALE` is configured in `inventoryQuantityTypes`
      • a `CORRECTION` quantity if `item.correctionQty` != 0 and `CORRECTION` is configured in `inventoryQuantityTypes`
  • Each quantity entry includes a unique `ref` in the format: `inventoryPositionRef:TYPE:fulfilmentId`
5. The rule then builds the outgoing event attributes:
1{
2  "inventoryPositionOnHand": 12,                           // on-hand value from IP
3
4  "inventoryPosition": {
5    "ref": "SKU02300:5170:DEFAULT",                        // inventoryPositionRef
6    "type": "DEFAULT",                                     // catalogueType
7    "productRef": "SKU02300",                              // item.skuRef
8    "locationRef": "5170",                                 // item.locationRef
9
10    "inventoryQuantities": [
11      {
12        "type": "RESERVED",
13        "quantity": -5,                                    // item.getReserveQty()
14        "ref": "SKU02300:5170:DEFAULT:RESERVED:56937"      // inventoryPositionRef : RESERVED : fulfilmentId
15      }
16    ]
17  }
18}
6. Based on the quantities on the item, exactly one event is sent per item:
  • If `reserveQty` != 0 and `RESERVED` is included in `inventoryQuantityTypes` → send `inventoryReserveEvent`
  • Else if `cancelQty` != 0 and `RESERVED` is included in `inventoryQuantityTypes` → send `inventoryCancelEvent`
  • Else if `saleQty` != 0 or `correctionQty` != 0 → send `inventoryConfirmationEvent`, including all relevant quantities

Version History

2025-12-11

v25.12.11

This rule now includes the current `inventoryPositionOnHand` value in the outgoing event produced for each fulfillment update item.As a result, downstream workflows that rely on accurate on-hand evaluation can determine real stock changes consistently across fulfillment, batch, and delta inventory flows.The rule version refers to the product release version.
2023-11-02

v2.0.0

refers to the plugin