Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Besides the common tasks including creation of input fields definitions, calculation of results, the line item logic also creates the Rebate Records.

  • You can create as many RRs as needed.

  • Most RR’s fields (e.g. customer, product, validity, inputs) are populated automatically when copying data from the Line Item.

  • If you need to set up the RR with values different than the automatically assigned ones, you can specify their values by the logic.

Rebate Record is created by the Rebate logic element with Calculation Context set to "agreement". For this purpose, the Rebate Line Item logic provides you with a binding variable:

  • rebateRecords which refers to the object RebateRecordManager.

    • Note: this binding variable exists also in the Calculation Contexts "agreement" and "read-only", but you can only read the rebate records in the objects there. ONLY in the Calculation Context "rebateRecord" the object allows you to add new records for the line item.

There are no Rebate Records created by default for the line, so you always have to use the function add() to add the Rebate Records, otherwise there will be no Rebate Record for the line item.

rebateRecords.add()

This is the simplest code to add one Rebate Record with default settings: it creates a new RR for the RBA line item. Such code must run only in an element with the "agreement" context. This function will also copy many values of the line items fields to the new Rebate Record fields. So if you only need a RR which "matches" the Line Item, this code is sufficient. It creates a RR and populates most RR’s fields (e.g. customer, product, validity, inputs) with a copy of data from the Line Item. The RR’s attributes will be empty.

rebateRecords.add(                   
    [
        attribute1 : out.Rebate,
        attribute2 : out.TotalSales,

        startDate  : "2016-01-01",   
        endDate    : "2016-03-31",
        payoutDate : "2016-04-15",
    ]
)

This code adds a Rebate Record, while overriding some field values. It creates a RR with pre-calculated results. Again, it is meaningful only in the "agreement" element type.

  • This creates a RR with most fields populated automatically, attribute fields are set by your logic.

  • You can store the calculated values to the RR already at the time of its creation, but it is usually done later via the Rebate Calculation task.

  • If you want to set some fields differently from the defaults, use the parameter map. You can also override the values of other RR’s fields, which would otherwise be setup automatically.

The new Rebate Record will get many fields populated by values of the agreement line item and other default values:

  • startDate, endDate, payoutDate

  • values of line item’s inputs

  • set = Default

The Rebate Records (created by the line item logic) will appear in the list of Rebate Records only after you save the Rebate Agreement.

  • No labels