IfRelatedQuantitiesArePresent
Changed on:
5 Nov 2026
Overview
Conditionally sends an Event when Inventory Quantities of the specified types and statuses already exist for the same Fulfillment on the same Inventory Position.Use it in the`INVENTORY_QUANTITY` `CREATE` ruleset together with the IfRelatedQuantitiesAreNotPresent Rule, with the same Rule parameters. Every new Inventory Quantity then leaves `CREATED` through exactly one of the 2 Rules.| Plugin Name | Inventory Reference Module |
|---|---|
| Namespace | [[account.id]].globalinventory |
- Product Catalogue workflow
- Inventory Catalogue workflow
- Control Group workflow
- Virtual Catalogue workflow
UI Description
For a quantity of types {quantityTypes}, send {eventName} if inventory quantities of types {relatedQuantityTypes} in statuses {relatedQuantityStatuses} already exist for the same fulfilment
Accepts
- INVENTORY_QUANTITY
Actions
- This Rule conditionally produces an inline SendEventAction
Rule parameters
| Name | Type | Description | Required |
`eventName` | `String` | The name of the Event to send when related Inventory Quantities exist | Yes |
`quantityTypes` | `List<String>` | The Inventory Quantity types this check applies to, for example `RESERVED`. Inventory Quantities of other types skip the check. If not provided, all types are checked. | No |
`relatedQuantityTypes` | `List<String>` | The Inventory Quantity types counted as related, for example `SALE`, `CORRECTION` | Yes |
`relatedQuantityStatuses` | `List<String>` | The Inventory Quantity statuses counted as related, for example `CREATED`, `ACTIVE` | Yes |
Event attributes
| Name | Type | Description | Required |
`inventoryPositionRef` | `String` | The Inventory Position Reference. If not provided, it is taken from the Inventory Quantity Reference. | No |
Exceptions
- This Rule throws a
`PropertyNotFoundException`when the Rule parameter(s) is not provided.
- This Rule throws a
`PropertyNotFoundException`when:`eventName`is not provided or is empty`relatedQuantityTypes`or`relatedQuantityStatuses`is not provided or is an empty list
- This Rule throws an
`InvalidPropertyTypeException`when`quantityTypes`,`relatedQuantityTypes`or`relatedQuantityStatuses`is not a list.
Configuration example
1{
2 "name": "[[account.id]].globalinventory.IfRelatedQuantitiesArePresent",
3 "props": {
4 "eventName": "DeactivateQuantity",
5 "quantityTypes": ["RESERVED"],
6 "relatedQuantityTypes": ["SALE", "CORRECTION"],
7 "relatedQuantityStatuses": ["CREATED", "ACTIVE"]
8 }
9}Detailed Technical Description
This Rule execution includes the following steps:- Validate that
`eventName`,`relatedQuantityTypes`and`relatedQuantityStatuses`have been provided - Skip the check (no Event is sent) when:
`quantityTypes`is provided and does not include the Inventory Quantity type- The Inventory Quantity type is one of the
`relatedQuantityTypes`, so a`CORRECTION`does not match its own`SALE`
- Resolve the Inventory Position Reference:
- From the
`inventoryPositionRef`Event attribute, when provided - Otherwise from the Inventory Quantity Reference, which must follow
`{inventoryPositionRef}:{quantityType}:{fulfilmentId}`
- From the
- Retrieve the Inventory Quantity from its Inventory Position
- Find related Inventory Quantities on the same Inventory Position, of the
`relatedQuantityTypes`and in the`relatedQuantityStatuses`:- When the Inventory Quantity has
`associationType`=`FULFILMENT`(case-insensitive) and an`associationRef`: match Inventory Quantities with the same`associationType`and`associationRef` - Otherwise: match by Reference. For example, for
`PRDREF:LOCREF:DEFAULT:RESERVED:12345`with the`relatedQuantityTypes``SALE`and`CORRECTION`, the Rule looks for`PRDREF:LOCREF:DEFAULT:SALE:12345`and`PRDREF:LOCREF:DEFAULT:CORRECTION:12345`
- When the Inventory Quantity has
- When related Inventory Quantities are found, send
`eventName`inline with the following attributes added to the incoming Event attributes:`inventoryPositionRef`,`inventoryPositionType`,`inventoryPositionStatus`,`inventoryPositionOnHand``inventoryQuantityRef``inventoryQuantityExists`(`true`)`inventoryQuantityTypes`: the distinct types of the related Inventory Quantities found