Fluent Commerce Logo
Docs
Sign In

UpdateAggregateVirtualPosition

Rule

Changed on:

8 May 2025

Overview

Update an and calculate its Available-to-Sell (ATS) quantity.

ATS calculation is based on the associated Positions (SOH) quantities and the applied .

The associated Positions are defined with:

  • The given Product Reference
  • The list of Locations for the given Network (the first Network assigned to the Virtual Catalog)
  • The specified Inventory Position Statuses
Plugin NameInventory Reference Module
Namespace[[account.id]].globalinventory

The is the foundation for 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 Module includes the following areas:

  • Product Catalogue workflow
  • Inventory Catalogue workflow
  • Control Group workflow
  • Virtual Catalogue workflow

UI Description

Updates an aggregate virtual position including inventory positions in the given {statuses}.

Accepts

  • VIRTUAL_POSITION

Actions

  • This Rule produces a MutateAction that updates the target Aggregate Virtual Position ATS quantity.

Rule parameters

Name

Data Type

Description

statuses

List<String>

Statuses of the Positions to be used for ATS calculation

Event attributes

Parameter

Description

Data Type

Required?

virtualPositionRef

Reference

String

Required

virtualPositionProductRef

Product Reference of the

String

Required

virtualPositionGroupRef

Group Reference of the

String

Required

virtualCatalogueRef

Reference of the

String

Required

virtualCatalogueInventoryCatalogueRef

Reference of the Catalog associated with the

String

Required

virtualCatalogueProductCatalogueRef

Reference of the associated with the

String

Required

virtualCatalogueControlGroupRef

Reference of the Control Group associated with the

String

Optional

virtualCatalogueNetworkIds

IDs of the

List<String>

Required

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.

Configuration example

1{
2  "name": "[[account.id]].globalinventory.UpdateAggregateVirtualPosition",
3  "props": {
4    "statuses": [
5        "ACTIVE",
6        "AT_RISK",
7        "OUT_OF_STOCK"
8    ]
9  }
10}

Detailed Technical Description

This performs the following steps during execution:

  • Retrieve Contextual Data
    • The Rule extracts the Aggregate Virtual Position and associated Catalog data from the Event attributes.
  • Determine Relevant Inventory Positions
    • The Rule identifies Inventory Positions that contribute to the Aggregate Virtual Position being updated.
    • It loads a list of Location References from the Network linked to the specified Virtual Catalog. Only the first Network from the `virtualCatalogueNetworkIds` event attribute is considered.
    • It queries Inventory Positions using the following criteria:
      • The Inventory Catalog Reference from the `virtualCatalogueInventoryCatalogueRef` Event Attribute
      • The Product Reference from the `virtualPositionProductRef` Event Attribute
      • The list of Location References obtained in the previous step
      • The Inventory Position Statuses specified by the Rule's `statuses` parameter
  • Recalculate ATS Quantity
    • The Rule calculates the updated ATS (Available to Sell) quantity for the Aggregate Virtual Position.
    • This is based on the total SOH (Stock on Hand) from the matched Inventory Positions, applying any relevant Controls.
    • If no Controls are present, the ATS is simply the total on-hand quantity.
    • The calculation logic is identical to that used in the CreateAggregateVirtualPosition Rule and is described in the section below.
  • Update the Aggregate Virtual Position
    • The Rule produces a MutateAction to update the existing Aggregate Virtual Position with the newly calculated ATS quantity.

Version History

2025-04-14

v2.2.1

changes:

  • Now apply control-specific logic only if the event includes a Control Group reference.
  • Skip all control-related validation and logic if no such reference is present in the event payload.
2024-10-28

v.24.10.28

This has been optimized to load all the related (by Product, its Categories, and list of Locations) at once for efficient Available-to-Sell (ATS) calculations.

The Version refers to the Product Release Version.

2023-08-03

v2.0.0

refers to the plguin