CreateBaseVirtualPositionIfNotPresent
Changed on:
29 Nov 2023
Overview
Checks if a Virtual Position does not exist, if the Virtual Position does not exist it will create a new Virtual Position with the matching attributes
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
Checks if a Virtual Position does not exist, if the Virtual Position does not exist it will create a new Virtual Position with the matching attributes
Accepts
- VIRTUAL_CATALOGUE
Actions
- If a corresponding base virtual position does not exist, this rule will produce a MutationAction to create a new virtual position. If a virtual position already exists, no action is triggered from this rule.
Rule parameters
Not required for this rule
Event attributes
Parameter | Description | Data Type | Required? |
productRef | The product ref of this virtual position | String | Required |
locationRef | The location ref of this virtual position | String | Required |
Exceptions
- An EventAttributeNotFoundException will be produced if either no attributes are defined, on the entity, or if or
`locationRef`
are not defined on the entity.`productRef`
Configuration example
1{
2 "name": "{{AccountID}}.globalinventory.CreateBaseVirtualPositionIfNotPresent"
3}
Language: json
Detailed Technical Description
- The rule will start by reading the and
`locationRef`
from the event attributes, and the`productRef`
as the entity ref. The`virtualCatalogueRef`
can be determined as the entity ref of the event target entity.`virtualCatalogueRef`
- The rule can then use these fields to determine the reference for the base VP this catalogue update targets:
`final String targetVirtualPositionRef = String.join(COLON, productRef, locationRef, BASE);`
- Once the VP ref is determined, we can check for the existence of a virtual position matching the event details:
`virtualService.getVirtualPositionAndVirtualCatalogueByRef(virtualCatalogueRef, targetVirtualPositionRef)`
The result of the above call can be examined to determine whether a virtual position exist or not
- If a virtual position exists, the rule stops processing with no actions
- If a virtual position does not exist, is called to create it
`virtualService.createVirtualPosition`
- ATS quantity does not need to be calculated here as the rule is responsible for setting this value on the position. For the create event, ATS can be set to 0.
`UpdateBaseVirtualPosition`
- ATS quantity does not need to be calculated here as the
Version History
v2.0.0
refers to plugin