...
Logic API
Logic Nature: default
Logic Type: Calculation/Pricing
Execution Types:
Syntax Check – 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 Syntax Check 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 CurrentItem has PricelistItem, but only - 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 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 Syntax Check mode:
Input field definitions (stored in logic context)
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.
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 item logic finishes the calculation, the element results are mapped and copied system does various mappings:
it takes values of some fields from Products table and puts them 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 Price List).
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.