Fluent Commerce Logo
Docs
Sign In

CreateAggregateVirtualPosition

Rule

Changed on:

24 Oct 2024

Overview

Create an Aggregate Virtual Position, calculate its Available-to-Sell (ATS) quantity, and send an event.

Aggregate Virtual Position ATS calculation is based on the associated Inventory Positions Stock on Hand (SOH) quantities and the applied Controls.

The associated Inventory Positions are defined with:

  • The given Product Reference
  • The list of Locations for the given Network (the first Network assigned to the Virtual Catalog)
  • The specified Inventory Position Statuses
Plugin NameInventory 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 an aggregate virtual position including inventory positions in statuses {statuses}. Sends event {eventName}.

Accepts

  • VIRTUAL_CATALOGUE

Actions

  • This Rule produces a MutateAction that creates a new Aggregate Virtual Position.
  • This Rule produces a SendEventAction that sends an inline event to the created Aggregate Virtual Position.

Rule parameters

Name

Type

Description

`eventName`

`String`

The name of the event to be triggered

`statuses`

`List<String>`

Statuses of the Inventory Positions to be used for Aggregate Virtual Position ATS calculation

Event attributes

Name

Type

Description

Required

`productRef`

`String`

Product Reference to load Inventory Positions

Required

`targetVirtualPositionRef`

`String`

Virtual Position Reference to be created

Required

`virtualCatalogueRef`

`String`

Reference of the Virtual Catalog

Required

`virtualCatalogueInventoryCatalogueRef`

`String`

Reference of the Inventory Catalog associated with the Virtual Catalog

Required

`virtualCatalogueProductCatalogueRef`

`String`

Reference of the Product Catalog associated with the Virtual Catalog

Required

`virtualCatalogueControlGroupRef`

`String`

Reference of the Control Group associated with the Virtual Catalog

Required

`virtualCatalogueNetworkIds`

`List<String>`

Network IDs of the Virtual Catalog

Required

Exceptions

  • This Rule throws a
    `PropertyNotFoundException`
    when the Rule parameter(s) is not provided.
  • This Rule throws an 
    `EventAttributeNotFoundException`
     when the required Event attribute(s) is not provided.

Configuration example

1{
2  "name": "[[account.id]].globalinventory.CreateAggregateVirtualPosition",
3  "props": {
4    "eventName": "CREATE",
5    "statuses": [
6        "ACTIVE",
7        "AT_RISK",
8        "OUT_OF_STOCK"
9    ]
10  }
11}

Language: json

Detailed Technical Description

This Rule execution includes the following steps:

  • The Rule determines the Inventory Positions associated with the Aggregate Virtual Position (to be created):
    • Load the list of Location References from the Network assigned to the given Virtual Catalog.
      Only the first Network from the
      `virtualCatalogueNetworkIds`
      Event attribute is considered.
    • Query Inventory Positions by:
      • The given Inventory Catalog Reference (
        `virtualCatalogueInventoryCatalogueRef`
         Event attribute)
      • The given Product Reference (
        `productRef`
        Event attribute)
      • The loaded (in the previous step) list of Location References
      • The specified Inventory Position Statuses (
        `statuses`
        Rule parameter)
  • The Rule calculates the Aggregate Virtual Position ATS quantity based on the determined Inventory Positions SOH quantities and the relevant Controls to be applied.
    The ATS calculation algorithm is described below.
  • The Rule produces a MutateAction that creates a new Aggregate Virtual Position with the calculated (point 2) ATS quantity.
  • The Rule produces a SendEventAction that sends an inline event with the specified name (
    `eventName`
    Rule parameter) to the created Aggregate Virtual Position.

Version History

2024-10-28

v.24.10.28

This Rule has been optimized to load all the related Controls (by Product, its Categories, and list of Locations) at once for efficient Aggregate Virtual Position Available-to-Sell (ATS) calculations.

The Rule Version refers to the Product Release Version.

2023-07-28

v2.0.0

refers to the plugin

Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.

Fluent Logo