CreateBaseVirtualPosition
Changed on:
8 Apr 2025
Overview
Creates a base virtual position and sends the event
`{eventName}`
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 a base virtual position and sends the event {eventName}
Accepts
- VIRTUAL_CATALOGUE
Actions
- This rule produces a MutationAction to create a new virtual position and a SendEventAction that forwards the incoming event as an inline event with the given name to the virtual position which has been created. The
`{eventName}`
of the generated event is VIRTUAL_POSITION and the`{entityType}`
is BASE.`{entitySubtype}`
Rule parameters
Parameter | Data Type | Description |
eventName | String | The name of the event to be triggered |
Event attributes
Parameter | Description | Data Type | Required? |
productRef | The product ref to load inventory positions | String | Required |
locationRef | The location ref of this virtual position | String | Required |
inventoryPositionRef | Inventory position ref | String | Optional |
targetVirtualPositionRef | The virtual position ref to be created | String | Required |
virtualCatalogueRef | The ref of virtual catalog | String | Required |
virtualCatalogueInventoryCatalogueRef | The inventory catalog ref of the virtual catalog | String | Required |
virtualCatalogueProductCatalogueRef | The product catalog ref of the virtual catalog | String | Required |
virtualCatalogueControlGroupRef | The control group ref of the virtual catalog | String | Optional |
Exceptions
- If is not provided, the rule retrieves the corresponding inventory position using the reference
`inventoryPositionRef`
and`{productRef}:{locationRef}:DEFAULT`
as the inventory catalog ref. If the retrieved inventory position lacks a product ref or location ref, an IllegalArgumentException is thrown.`{virtualCatalogueInventoryCatalogueRef}`
- An IllegalArgumentException is also thrown if the incoming event does not contain .
`{entityRef}`
- If any required event attributes are missing, an EventAttributeNotFoundException is thrown.
Configuration example
1{
2 "name": "[[account.id]].globalinventory.CreateBaseVirtualPosition",
3 "props": {
4 "eventName": "CREATE"
5 }
6}
Language: json
Detailed Technical Description
Virtual Position Creation and Quantity Calculation
Inventory Position Retrieval & Validation
- The rule first retrieves the corresponding inventory position for the virtual position being created. It uses the event attribute (as the inventory catalog reference) and constructs the inventory position reference based on the following convention:
`{virtualCatalogueInventoryCatalogueRef}`
- If is not provided, the reference follows the format:
`inventoryPositionRef`
`{productRef}:{locationRef}:DEFAULT`
- If
- Once the inventory position is retrieved, the rule validates its fields. If any issues are detected, an exception is thrown, as outlined in the Exceptions section.
Effective Quantity Calculation
- To create a virtual position, the system calculates its effective quantity—the final quantity after applying relevant buffer values to the on-hand inventory quantity. (See Quantity Calculation section for details.)
- After determining the effective quantity, the virtual position is created with:
- as the virtual position reference
`{targetVirtualPositionRef}`
- as the virtual catalog reference
`{virtualCatalogueRef}`
- as the virtual position type
`BASE`
- Finally, the rule generates an inline event with the following attributes:
- =
`{entityRef}`
`{targetVirtualPositionRef}`
- =
`{entityType}`
`VIRTUAL_POSITION`
- =
`{entitySubtype}`
`BASE`
Quantity Calculation
The effective quantity of a virtual position (type
`BASE`
- Exclusion Buffer Check
- The rule checks if an exclusion buffer applies to the virtual position.
- If an active exclusion buffer is found, the effective quantity is immediately set to 0, and the calculation stops. (See Exclusion Control Buffer Calculation for details.)
- Quantity Buffer Check
- If no exclusion buffers are found, the rule calculates the quantity buffer.
- The buffer value is added to the on-hand inventory quantity to determine the effective quantity.
- If the resulting value is negative, the effective quantity is set to 0.
- The final quantity is assigned to the new virtual position. (See Quantity Buffer Calculation for details.)
- No Controls Applied
- If no controls are present, the effective quantity is equal to the on-hand value of the inventory position.
Exclusion Control Buffer Calculation
- The rule retrieves all product categories using and
`{productRef}`
event attributes.`{virtualCatalogueProductCatalogueRef}`
- It generates potential exclusion control references based on ,
`{virtualCatalogueControlGroupRef}`
, and category references:`{productRef}`
`{virtualCatalogueControlGroupRef}:EXCLUSION:{productRef}`
- (for each category)
`{virtualCatalogueControlGroupRef}:EXCLUSION:{category_ref}`
- The rule attempts to fetch ACTIVE controls using these references.
- If at least one active exclusion control is found, the effective quantity is set to 0, and the process stops.
- If no exclusion controls are found, the rule proceeds to Quantity Buffer Calculation.
Quantity Buffer Calculation
- The rule retrieves product categories using and
`{productRef}`
event attributes.`{virtualCatalogueProductCatalogueRef}`
- It generates quantity buffer control references using ,
`{virtualCatalogueControlGroupRef}`
,`{locationRef}`
, and category references:`{productRef}`
`{virtualCatalogueControlGroupRef}:QUANTITY_BUFFER:{productRef}:{locationRef}`
`{virtualCatalogueControlGroupRef}:QUANTITY_BUFFER:{productRef}`
`{virtualCatalogueControlGroupRef}:QUANTITY_BUFFER:{locationRef}`
- (for each category)
`{virtualCatalogueControlGroupRef}:QUANTITY_BUFFER:{category_ref}`
- The rule attempts to fetch ACTIVE controls using these references.
- If controls are found, they are sorted in ascending order by their .
`executionOrder`
- The rule selects the lowest executionOrder control with a valid buffer value.
- This value is added to the on-hand inventory quantity to determine the effective quantity.
- If no valid buffer controls exist, the effective quantity defaults to the on-hand inventory value.
- If controls are found, they are sorted in ascending order by their
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.
v2.0.0
Refers to the plugin