Besides the common tasks - like creation of input fields definitions, calculation of results - the line item logic also creates the Rebate Records.
you can create as many RRs as you need
most RR’s fields (e.g. customer, product, validity, inputs) are populated automatically with a copy of data from the Line Item
if you need to setup the RR with values different from the automatically assigned ones, you can specify their values by logic
the list of RRs associated with the line item is provided in binding variable
rebateRecords
this variable is available ONLY in the elements with "agreement" calculation context
Rebate record is created by the Rebate logic element with Calculation Context "agreement". For those purposes, the Rebate Line Item logic provides you with a binding variable:
rebateRecords which refers 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. Create new RR for the RBA line item. Such code must run only in element with "agreement" context only. This function will also copies many values of line items fields to the new Rebate Record fields. So if you need only a RR which "matches" the Line Item, this code would be enough. This 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", ] )
Code to add a Rebate Record, overriding some field values. Create RR with pre-calculated results. Again, meaningful only in "agreement" element type.
This creates RR with most fields populated automatically, and attribute fields set by your logic.
You can store the calculated values to the RR already at the time of its creation, but it’s 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 field 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 line item logic) will appear in the list of Rebate Records only after you SAVE the Rebate Agreement.