You’re using Pricelist logic when you need to:
-
build input field definitions for the price list
-
calculate results of the price list items
Mechanism of selection, which logic is used
When a pricelist item is about to be calculated, the engine will select the logic based on certain criteria. Besides standard things, like if the logic is active and valid for a target date, there are also following rules, which logic will be used (the first one available will be used)
-
product specific logic
-
if the product has a logic defined (in Product table), this one will be used. Using of this type of logic can be switched off by advanced configuration option doNotUsePerProductFormulasInLists
-
-
logic selected in Pricelist definition.
-
This logic can be pre-filled from the PricelistType (if it was used by user),
-
but could be also set by a user.
-
-
default Pricelist logic
-
see advanced configuration option defaultPLFormula
-
-
default generic logic
-
see advanced configuration option defaultFormula
-
Logic API
-
Logic Nature: default
-
Logic Type: Calculation/Pricing
-
-
Execution Types:
-
Syntax Check - to define the input fields for the Pricelist (i.e. NOT on the item)
-
Standard - to calculate the results (e.g. prices) and provide warnings and alerts for each item
-
-
Information provided to the logic
-
in the Syntax Check mode
-
sku in the logic context
-
-
in the Standard mode
-
sku in the logic context
-
values of all inputs provided by the user
-
currentItem has PricelistItem, but only in the 2nd (and next) passes of the multi-pass calculation. I.e. in normal calculation, it will have nothing.
-
api.global
- contains data placed to api.global by previous execution of this logic for the another line (within one pricelist calculation process)
-
-
-
Expected logic execution outcome
-
from Syntax Check mode - input field definitions
-
from Standard mode execution
-
result values (and formatting) of the visible logic elements will be copied by the system to the attributeX fields of the PricelistItem
-
api.global
- data stored here will persist until next execution of this logic for another line (within one pricelist calculation process within one node)
-
-
Common Logic Structure
-
build input field definitions
-
abort on syntax check
-
calculate the prices and other values
Mapping of logic results to Pricelist Item (PLI)
When the item logic finishes the calculation, the results of the elements are mapped and copied to the PLI.
To be able to use the logic result on the PLI:
-
the logic element must have Display Mode set to Everywhere (or to Pricelist)
Output Elements Mapped to Attribute# Fields
-
the business user selects which visible elements they want to map to PLI - when creating the Pricelist on the New Price list Definition dialog on step Parameters, in part Output Elements.
-
if you need to enforce certain elements to be always mapped (i.e. so the user cannot unselect them), use the advanced configuration option mandatoryPLElements
-
The mapping of selected element results to the PLI’s attribute# fields is done automatically, but if you need, you can set specific elements to be mapped to specific attributes - see advanced configuration option calculableObjectPreferredMapping
Special Logic Results Mapping
On the dialog New Price List Definition, step Set Parameters, the user can also specify, which element result will end up in PLI’s fields:
-
calculatedResultPrice - setting Result Price
-
unitOfMeasure - setting Dynamic UOM
-
currency - setting Dynamic currency