Fluent Commerce Logo
Docs
Sign In

CalculateOnHand

Rule

Changed on:

13 Nov 2023

Overview

Calculates the onHand value of an inventory position using inventory quantities filtered by statuses {filterStatuses} and types {filterTypes}, and then send the event {eventName}

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

Calculates the onHand value of an inventory position using inventory quantities filtered by statuses {filterStatuses} and types {filterTypes}, and then send the event {eventName}

Accepts

  • INVENTORY_POSITION

Actions

  • This rule produces a SendEventAction that will send an inline event with the attribute inventoryPositionOnHandCalculated set to True

Rule parameters

Parameter

Description

eventName

The name of event to be triggered after calculating the on-hand

filterTypes

List of inventory quantity types that should be updated

filterStatuses

List of inventory quantity statuses that should be updated

Event attributes

Not Applicable for this rule.

Exceptions

If 

`eventName`
 rule property is not set in the workflow, a PropertyNotFoundException will be thrown. If the 
`filterStatuses`
 and 
`filterTypes`
 cannot be converted to a valid list of Strings InvalidPropertyTypeException exception will be thrown.

Configuration example

1{
2  "name": "FLUENTRETAIL.globalinventory.CalculateOnHand",
3  "props": {
4    "filterTypes": ["SALE","CORRECTION"],
5    "eventName": "on_hand_calculated",
6    "filterStatuses": ["CREATED","ACTIVE"]
7  }
8}

Language: json

Detailed Technical Description

Using the Inventory Quantity types 

`{filterTypes}`
 and Inventory Quantity statuses 
`{filterStatuses}`
 configured through workflow, this rule calculates the current stock on hand 
`{onHand}`
 value for a given inventory position. This calculation is done by summing all the Inventory Quantities returned by the query where the Quantities match both of the filtered statuses and the filtered types. Inventory position ref and inventory catalogue ref are taken from the incoming event. After the on-hand value is calculated, this rule sets the on-hand value as an attribute of the generated event, which is an inline event. The attribute name is called 
`inventoryPositionOnHandCalculated`
. The name of the event generated by this rule is taken from the rule attributes configured through workflow 
`{eventName}`
.

Version History

2023-08-02

v2.0.0

refers to 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