Fluent Commerce Logo
Docs

UpsertInventoryQuantity

Rule

Changed on:

19 Mar 2026

Overview

Create or Update an Inventory Quantity.
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

Create or update an Inventory Quantity of Type {" + PROP_DEFAULT_TYPE + "} using Event attributes.

Accepts

  • INVENTORY_POSITION

Actions

  • This Rule produces a MutationAction that will create or update an Inventory Quantity

Rule parameters

NameTypeDescription
`defaultType``String`The Fallback Type for an Inventory Quantity to be created/updated

Event attributes

NameTypeDescriptionRequired
`inventoryPositionRef``String`The associated Inventory Position ReferenceYes
`qty``Integer`The quantity value of the Inventory QuantityYes
`condition``String`The condition of the Inventory QuantityNo
`expectedOn``Date (ISO-8601 format)`The date when the Inventory Quantity is expected to be availableNo
`storageAreaRef``String`The Reference of the storage area where the Inventory Quantity will be locatedNo
`inventoryQuantity``InventoryQuantityUpdate`The Object that contains the Inventory Quantity specific data. See the Sub-attributes below.No
InventoryQuantityUpdate Object Sub-attributes
NameTypeDescriptionRequired
`ref``String`The Reference of the Inventory QuantityNo
`qty``Integer`The quantity value of the Inventory QuantityNo
`type``String`The Type of the Inventory QuantityNo
`status``String`The Status of the Inventory QuantityNote: `inventoryQuantity.status` is accepted in the payload but is currently not used by this rule:
  • `UpsertInventoryQuantity` does not set or update Inventory Quantity status
  • New Inventory Quantities are created in `CREATED` status and then moved to `ACTIVE` by the `CREATE` ruleset (`SetState` rule)
  • Existing Inventory Quantities keep their current status unless another ruleset/rule changes it
No
`attributes``Map<String, Object>`The following attributes are supported:
  • `associationType`
  • `associationRef`
  • `parentRef`
  • `expectedOn`
  • `expiresOn`
  • `condition`
  • `storageAreaRef`
  • `supplier`
  • `manufacturer`
  • `manufacturerBatchNumber`
  • `countryOfOrigin`
  • `channel`
  • `segment1`
  • `segment2`
  • `segment3`
No

Exceptions

  • This Rule throws a `PropertyNotFoundException` when the Rule parameter(s) is not provided.
  • This Rule throws an `EventAttributeNotFoundException` when the required Event attribute(s) is not provided.
  • This Rule throws an `InvalidAttributeTypeException` when the provided:
    • `qty` attribute value is not `Integer`
    • `expectedOn` attribute value type can not be identified
    • `expiresOn` attribute value type can not be identified
  • This Rule throws an `InvalidAttributeValueException` when the provided:
    • `expectedOn` attribute value can not be parsed to a valid date (or null)
    • `expiresOn` attribute value can not be parsed to a valid date (or null)

Configuration example

1{
2  "name": "[[account.id]].globalinventory.UpsertInventoryQuantity",
3  "props": {
4    "defaultType": "LAST_ON_HAND"
5  }
6}

Detailed Technical Description

This Rule execution includes the following steps: 
  • Validate that:
    • The `defaultType` Rule parameter has been provided
    • The mandatory Event attributes have been provided:
      • `qty`
      • `inventoryPositionRef`
    • The `qty` attribute value is an `Integer`
  • Build the base Inventory Quantity using the provided:
    • `inventoryPositionRef`
    • `qty`
    • `condition`
    • `expectedOn`
    • `storageAreaRef`
    • `defaultType`
  • (When `inventoryQuantity.ref` is not provided) Generate the Inventory Quantity Reference using the following pattern: the Inventory Position Reference, a colon, and the Inventory Quantity Type. For example:
    • If the `inventoryPositionRef` Event attribute is `PRDREF:LOCREF:DEFAULT`
    • And the Inventory Quantity Type is `LAST_ON_HAND`:
      • `inventoryQuantity.type` Sub-attribute value, when provided
      • Otherwise, `defaultType` Rule parameter value
    • The generated Inventory Quantity Reference will be: `PRDREF:LOCREF:DEFAULT:LAST_ON_HAND`
  • Apply `inventoryQuantity` overrides when the `inventoryQuantity` Event attribute is provided:
    • `inventoryQuantity.ref`
    • `inventoryQuantity.type`
    • `inventoryQuantity.qty`
  • Apply supported `inventoryQuantity.attributes` values:
    • `associationType`
    • `associationRef`
    • `parentRef`
    • `expectedOn`
    • `expiresOn`
    • `condition`
    • `storageAreaRef`
    • `supplier`
    • `manufacturer`
    • `manufacturerBatchNumber`
    • `countryOfOrigin`
    • `channel`
    • `segment1`
    • `segment2`
    • `segment3`
  • Retrieve the Inventory Position and its Inventory Quantity(ies) based on the provided:
    • Inventory Catalog Reference
    • Inventory Position Reference
    • Inventory Quantity Reference
  • Execute a `MutationAction` to:
    • Update the Inventory Quantity with the provided attributes when it exists
    • Otherwise, create a new Inventory Quantity with the provided attributes

Version History

2026-04-16

v26.4.16

Key changes:
  • Added support for additional Inventory Quantity attributes provided through `inventoryQuantity.attributes`, including `expiresOn`, `associationType`, `associationRef`, `countryOfOrigin`, `channel`, `manufacturer`, `manufacturerBatchNumber`, `supplier`, `segment1`, `segment2`, `segment3`, and `parentRef`
  • Improved handling of `inventoryQuantity.attributes` so that existing event-level values (`expectedOn`, `condition`, `storageAreaRef`) are preserved when these attributes are not provided in the update payload
  • Added parsing and validation support for the `expiresOn` attribute
The Rule Version refers to the Product Release Version.
2025-02-18

v25.2.18

Refers to the Product Release Version.