Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

  • you You can create as many RRs as you needneeded.

  • most Most RR’s fields (e.g. customer, product, validity, inputs) are populated automatically with a copy of when copying data from the Line Itemif line item.

  • If you need to setup set up the RR with values different from than the automatically assigned ones, you can specify their values by the 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 set to "agreement". For those purposesthis purpose, the Rebate Line Item logic provides you with a binding variable:

  • rebateRecords which 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 Rebate Records in the objects there. ONLY in the Calculation Context "rebateRecord" the object allows you to add new records for the line item.

Note

there 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.

...

This is the simplest code to add one Rebate Record with default settings. Create : it creates a new RR for the RBA line item. Such code must run only in an element with "the agreement" context only. This function will also copies copy many values of the line items fields to the new Rebate Record fields. So if you only need only a RR which "matches" the Line Itemline item, this code would be enough. This 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 Itemline item. The RR’s attributes will be empty.

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

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

Code to add This code adds a Rebate Record, while overriding some field values. Create 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, and 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’s 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 field fields populated by values of the agreement line item and other default values:

  • startDate, endDate, payoutDate

  • values of line item’s inputs

  • set = Default

Note

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