...
Logic Selection
When a price list item is about to be calculated, the engine selects a logic based on certain criteria. Besides the standard factors (if the logic is active and valid for a target date), there are also the following rules. (If more logics satisfy the criteria, the first one available is used.)
Product specific logic
If the product has a logic defined (in the Product table), it is used. Using this type of logic can be switched off by Advanced Configuration Option doNotUsePerProductFormulasInLists.
Logic selected in the price list definition
This logic can be pre-filled from the Price List Type (if it was used by user).
It can be also set by a user.
Default price list 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:
Input Generation – Defines the input fields for the price list (i.e. NOT on the item).
Standard – Calculates the results (e.g. prices) and provides warnings and alerts for each item.
Information provided to the logic:
In the Input Generation mode:
SKU in the logic context
In the Standard mode:
SKU in the logic context - available via
api.product("sku")
Values of all inputs provided by the user - available via
input["inputName"]
api.currentItem()
provides PricelistItem as Map, BUT ONLY in the 2nd (and next) passes of the multi-pass calculation. I.e. in normal calculation, it will NOT contain it.api.previousContext()
- when calculating a revision of a pricelist, this gives you data of the previous version of the PLI line (from the previous pricelist version)api.global
– Contains data placed to api.global by previous execution of this logic for the another line (within one price list calculation process).
Expected logic execution outcome:
From Input Generation mode:
Input field definitions (stored in logic context)
From Standard mode execution:
Calculation result values must be provided via output of logic elements which are set as visible (either Display Mode Pricelist or Everywhere). Formatting is provided via setting of the logic element. The result value could be of many types, e.g. number, text, ResultMatrix, Chart (either Analyzer chart or Highchart).
Warnings
Alerts
api.global
– Data stored here will persist until the next execution of this logic for another line (but only within one price list calculation process within one node).
...
Mapping of Logic Results to Price List Item (PLI)
The mapping is set during the setup of the Pricelist (i.e. done partially by the business user)
During the process of pricelist calculation, the system will take an SKU to calculate, puts it to the context and runs the logic. When the logic finishes the calculation, the system does various mappings:
it takes values of some fields from Products table and puts them to the PLI
it takes the values of visible logic elements (but only those allowed by user during pricelist setup) and maps and copies them to the fields of the PLI object.
if the pricelist setup also has some additional mappings (Result Price, Currency, Unit Of Measure), the system will do those mappings too.
Output Elements Mapped to Attribute# Fields
The business user selects which visible elements they want to map to PLI – when creating a new price list (step Parameters, section Output Elements).
If you need to enforce that certain elements are always mapped (i.e. the user cannot unselect them), use the Advanced Configuration Option mandatoryPLElements.
Mapping of selected element results to the PLI 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
In the New Price List Definition dialog in the Set Parameters step, 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
Warnings Mapping
The warnings collected from the output elements, will be stored in Warnings field of the PLI.
...