UpdateBaseVirtualPosition
Changed on:
8 Apr 2025
Overview
Updates a base virtual position
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
Updates a base virtual position
Accepts
- VIRTUAL_POSITION
Actions
- This rule produces a MutationAction to update the virtual position effective quantity. The effective quantity is the value after adding relevant buffer values to the on-hand quantity of the corresponding inventory position.
Rule parameters
There are no Input Parameters for this rule
Event attributes
Parameter | Description | Data Type | Required? |
inventoryPositionRef | Inventory position ref | String | Optional |
virtualPositionProductRef | The product ref of this virtual position | String | Required |
virtualPositionRef | The ref of this virtual position | String | Required |
virtualPositionGroupRef | The group ref of the virtual position | String | Required |
virtualCatalogueRef | The ref of the virtual catalogue | String | Required |
virtualCatalogueInventoryCatalogueRef | The inventory catalog ref this virtual catalog is made of | String | Required |
virtualCatalogueProductCatalogueRef | The product catalog ref this virtual catalog is made of | String | Required |
virtualCatalogueControlGroupRef | The control group ref this virtual catalog is made of | String | Optional |
Exceptions
- This Rule throws an when the required Event attribute(s) is not provided.
`EventAttributeNotFoundException`
Configuration example
1{
2 "name": "[[account.id]].globalinventory.UpdateBaseVirtualPosition"
3}
Language: json
Detailed Technical Description
Virtual Position Update and Quantity Calculation
Inventory Position Retrieval & Validation
- The rule first retrieves the corresponding inventory position for the virtual position to be updated using the following logic:
- The event attribute is used to determine the inventory catalog reference.
`{virtualCatalogueInventoryCatalogueRef}`
- If is provided in the event attributes, it is used directly to load the inventory position.
`inventoryPositionRef`
- If is not provided, it is generated using the convention
`inventoryPositionRef`
.`{productRef}:{locationRef}:DEFAULT`
- The
- Once the inventory position is retrieved, its fields are validated. If any validation issues are found, an exception is raised.
Effective Quantity Calculation
- To update the virtual position, the rule calculates its effective quantity. This represents the final quantity after applying buffer adjustments to the on-hand quantity of the corresponding inventory position (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 plugin