...
Logic API
Logic Nature: default
Logic Type: Calculation/Pricing
Execution Types:
Syntax Check 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 Syntax Check 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 Syntax Check 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).
Common Logic Structure
Build input field definitions.
Abort on syntax checkinput generation.
Calculate prices and other values.
...