CreateBaseVirtualPositionIfNotPresent
Changed on:
29 Nov 2023
Overview
Checks if a does not exist, if the does not exist it will create a new with the matching attributes
Plugin Name | Inventory 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
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
Event attributes
Parameter | Description | Data Type | Required? |
productRef | The product ref of this | String | Required |
locationRef | The ref of this | String | Required |
Exceptions
- An EventAttributeNotFoundException will be produced if either no attributes are defined, on the entity, or if
`locationRef`
or`productRef`
are not defined on the entity.
Configuration example
1{
2 "name": "{{AccountID}}.globalinventory.CreateBaseVirtualPositionIfNotPresent"
3}
Detailed Technical Description
- The rule will start by reading the
`locationRef`
and`productRef`
from the event attributes, and the`virtualCatalogueRef`
as the entity ref. The`virtualCatalogueRef`
can be determined as the entity ref of the event target entity. - 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 exist or not
- If a virtual position exists, the rule stops processing with no actions
- If a virtual position does not exist,
`virtualService.createVirtualPosition`
is called to create it- ATS quantity does not need to be calculated here as the
`UpdateBaseVirtualPosition`
rule is responsible for setting this value on the position. For the create event, ATS can be set to 0.
- ATS quantity does not need to be calculated here as the
Version History
v2.0.0
refers to