CreateAggregateVirtualPosition
Changed on:
8 Apr 2025
Overview
Create an Aggregate Virtual Position, calculate its Available-to-Sell (ATS) quantity, and send an event.
Aggregate Virtual Position ATS calculation is based on the associated Inventory Positions Stock on Hand (SOH) quantities and the applied Controls.
The associated Inventory 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 Name | Inventory 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
Creates an aggregate virtual position including inventory positions in statuses {statuses}. Sends event {eventName}.
Accepts
- VIRTUAL_CATALOGUE
Actions
- This Rule produces a MutateAction that creates a new Aggregate Virtual Position.
- This Rule produces a SendEventAction that sends an inline event to the created Aggregate Virtual Position.
Rule parameters
Name | Data Type | Description |
eventName | String | The name of the event to be triggered |
statuses | List<String> | Statuses of the Inventory Positions to be used for Aggregate Virtual Position ATS calculation |
Event attributes
Parameter | Description | Data Type | Required? |
productRef | Product Reference to load Inventory Positions | String | Required |
targetVirtualPositionRef | Virtual Position Reference to be created | String | Required |
virtualCatalogueRef | Reference of the Virtual Catalog | String | Required |
virtualCatalogueInventoryCatalogueRef | Reference of the Inventory Catalog associated with the Virtual Catalog | String | Required |
virtualCatalogueProductCatalogueRef | Reference of the Product Catalog associated with the Virtual Catalog | String | Required |
virtualCatalogueControlGroupRef | Reference of the Control Group associated with the Virtual Catalog | String | Optional |
virtualCatalogueNetworkIds | Network IDs of the Virtual Catalog | List<String> | Required |
Exceptions
- This Rule throws a when the Rule parameter(s) is not provided.
`PropertyNotFoundException`
- This Rule throws an when the required Event attribute(s) is not provided.
`EventAttributeNotFoundException`
Configuration example
1{
2 "name": "[[account.id]].globalinventory.CreateAggregateVirtualPosition",
3 "props": {
4 "eventName": "CREATE",
5 "statuses": [
6 "ACTIVE",
7 "AT_RISK",
8 "OUT_OF_STOCK"
9 ]
10 }
11}
Language: json
Detailed Technical Description
This Rule performs the following steps during execution:
- Determine Relevant Inventory Positions
- The Rule identifies Inventory Positions that contribute to the creation of an Aggregate Virtual Position.
- It loads a list of Location References from the Network assigned to the specified Virtual Catalog. Only the first Network from the Event Attribute is considered.
`virtualCatalogueNetworkIds`
- It queries Inventory Positions using these criteria:
- The given Inventory Catalog Reference ( Event Attribute);
`virtualCatalogueInventoryCatalogueRef`
- The specified Product Reference ( Event Attribute);
`productRef`
- The list of Location References loaded in the previous step;
- The set of Inventory Position Statuses defined by the Rule’s parameter.
`statuses`
- The given Inventory Catalog Reference (
- Calculate ATS Quantity
- The Rule calculates the Aggregate Virtual Position’s Available to Sell (ATS) quantity.
- This is based on the sum of SOH (Stock on Hand) quantities from the determined Inventory Positions, after applying any relevant Controls.
- If no Controls are defined, the ATS is simply the total on-hand quantity.
- The specific calculation logic is described in the next section.
- Create the Aggregate Virtual Position
- The Rule generates a MutateAction to create the Aggregate Virtual Position, assigning it the ATS quantity calculated in the previous step.
- Send a Custom Event
- Finally, the Rule generates a SendEventAction to send an inline event (with the name provided by the Rule parameter) to the newly created Aggregate Virtual Position.
`eventName`
- Finally, the Rule generates a SendEventAction to send an inline event (with the name provided by the
Version History
v2.2.1
Rule 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.
v.24.10.28
This Rule has been optimized to load all the related Controls (by Product, its Categories, and list of Locations) at once for efficient Aggregate Virtual Position Available-to-Sell (ATS) calculations.
The Rule Version refers to the Product Release Version.
v2.0.0
refers to the plugin