You’re using Rebate Agreement Header is used logic when you need to:
create Create input fields onfor:
rebate Rebate agreement header
rebate Rebate agreement folders
rebate Rebate agreement items (not so common)
hide the Hide out-of-the-box header input fields
add Add or remove the rebate agreement items and folders - – e.g. modify the structure of the document
calculate Calculate results for:
the whole Whole rebate agreement - , e.g. summaries like grand total price or overall margin
the folders Folders (not so common) - , e.g. sub-summaries for the folders
the items Items (not so common) - , e.g. particular results of the line items
To understand , where the header logic fits to in the process, see Process of Rebate Agreement Recalculation.
Logic API
Logic Nature: rebateAgreementHeader
Logic Type: Calculation/Pricing
Execution Types:
Standard - standard execution of this header logic – It is done 2x, twice and the executions being are called phases. They have different purposepurposes, so you must distinguish those these executions in the code by checking , which execution it is right nowat the moment:
pre-phase - the first execution called pre-phase - to create – First execution. It creates input fields on header, folders or items, and to createcreates/remove removes the items/folders.
post-phase - and second execution is called post-phase - to calculate summary info of items and store them on – Second execution. It calculates summary info for items and stores them on the header, folder or items.
Information provided to the logic:
binding Binding variables:
raProcessor: RebateAgreementBuilder
CAUTION: when When using Classic or Unity non-React user interface, then during pre-phase , the
raProcessor.rebateAgreementView
will NOT contain outputs values of Outputs. The only exception are "overridable" outputs. This limitation is because of performance optimization of amount of data being sent to optimize performance when sending data between user interface and backend.
Expected logic execution outcome:
pre-phase execution:
definition Definition of input fields - – via the
raProcessor.addOrUpdateInput()
content Content of
api.global
created by the pre-phase header logic , will be persisted and available to the Rebate Item Logic, when calculating the line items
post-phase execution:
header Header calculation results - – via the
raProcessor.addOrUpdateOutput()
Custom Header - – via the
raProcessor.addOrUpdateOutput()
set Set attributeX field values - – via
raProcessor.updateField("attribute1", "value")
hide Hide out-of-the-box buttons - – via
raProcessor.setRenderInfo()
raise critical Alert - if Raise critical alert – If the logic creates at least one critical alert, it’s it is considered as an exception , and the process (e.g. submission) will stop.
Note , that the results of the logic elements are not stored nor or displayed anywhere (with exception when of testing the logic in Studio).
in In general, the logic is expected to use the provided RebateAgreementBuilder object to manipulate the content of the document. For a list of allowed manipulations, see the description of the object CalculableLineItemCollectionBuilder.
Setup
As you can have potentially it is possible to have more rebate agreement header logics, you must select the one , which will be used , when the user is working with rebate agreement documentdocuments.
This selection is done in Advanced Configuration Option called defaultRAHeaderFormula, ; the content of this option is the name of the header logic to be used.
The Theis option can also be also set up on page in , via setting Default RA Header logic, and then fetched to the project as a configuration file.
Code
sampleSample
We do not have a specific rebate agreement specific sample , but you can review samples for quotes and contracts. The principles principle used in those samples are is exactly the same as those in the rebate header.
Groovy API
There are some commonly used functions for header logics:
read the Read data of the rebate agreement header and items:
raProcessor. getRebateAgreementView()
check, Check for which phase is the logic being is executed now:
raProcessor. isPrePhase()
raProcessor. isPostPhase()
create Create input fields on either the header, folder or item:
raProcessor. addOrUpdateInput()
create Create outputs/results on either the header, folder or item:
raProcessor. addOrUpdateOutput