Rebate Record Group Logic

Since version 12.0

Logic API

  • Logic Nature: rebateRecordGroup

    • Logic Type: Calculation/Pricing

  • Execution Types:

    • Input Generation - to define input fields needed for this group

    • Standard – Calculation is performed based on the underlying Rebate Records. For example, it can aggregate data from associated Rebate Records and provide a summary. This summary can then be used by the manager to approve the records at once.

  • Information provided to the logic:

    • api.currentItem() - (Map) The content, including fields and their values, of the currently calculated Rebate Record Group object. Note that you cannot modify the content of the Rebate Record Group here; for that, utilize the rebateRecordGroup binding variable.

    • Binding variables

      • groupRebateRecords - (ArrayList) List of Rebate Record objects from the currently calculated group.

      • rebateRecordGroup - (IRebateRecordGroupManager) Object with various methods useful during the processing. For example, you can set values to the fields and attributes (i.e. attribute extensions) of the Rebate Record Group being calculated. Note that the modifications are allowed only during standard execution, not in the Input Generation execution.

  • Expected logic execution outcome:

    • From Input Generation execution:

      • definitions of the input fields in the logic context, done in the same way as in any other generic/default nature of logics.

    • From Standard mode execution:

      • The Rebate Record Group Logic is allowed to store calculated values into the fields attribute1..100 or eventually into the attributeExtension fields. These attribute fields will then be presented to the user on the Record section of the Rebate Record Group detail page.

      • Results from logic elements with the Display Mode set to "Everywhere" will be stored in the Rebate Record Group object field named calculationResults. These results will then be presented to the user on the Calculation section of the Rebate Record Group detail page.

      • Warnings and Alerts - will be displayed to the user on the Rebate Record Group detail page. Note, that Critical Alert is treated as successful finish of the calculation, not as a failure.

      • Exception - when the logic raises an exception, it’s treated as a failure.

Configuration

The logic must be registered/configured in Rebate Condition Type (formerly Rebate Type) in the field rebateRecordGroupFormulaName.

Logic Resolution

The actual logic to be used for calculation of the Rebate Record Group is found in the RebateType field rebateRecordGroupFormulaName.

Code Sample

def avgPayout = groupRebateRecords.sum { rebateRecord -> rebateRecord.attribute2 as BigDecimal } / groupRebateRecords.size() rebateRecordGroup.set(["attribute2": avgPayout]) if (avgPayout < 20) { api.redAlert("The average is less than 20.") } return avgPayout

Found an issue in documentation? Write to us.