Skip to end of metadata
Go to start of metadata

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

Compare with Current View Version History

« Previous Version 77 Next »

You’re using Rebate Agreement Header logic when you need to:

  • create input fields on

    • rebate agreement header

    • rebate agreement folders

    • rebate agreement items (not so common)

  • hide the out-of-the-box header input fields

  • add or remove the rebate agreement items and folders - e.g. modify the structure of the document

  • calculate results for

    • the whole rebate agreement - e.g. summaries like grand total price or overall margin

    • the folders (not so common) - e.g. sub-summaries for the folders

    • the items (not so common) - e.g. particular results of the line items

To understand, where the header logic fits to 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 is done 2x, the executions being called phases. They have different purpose, so you must distinguish those executions in the code by checking, which execution it is right now:

      • pre-phase - the first execution called pre-phase - to create input fields on header, folders or items, and to create/remove the items/folders

      • post-phase - and second execution is called post-phase - to calculate summary info of items and store them on header, folder or items

  • Information provided to the logic

    • binding variables:

      • raProcessor: RebateAgreementBuilder

        • CAUTION: when using Classic or Unity non-React user interface, then during pre-phase, the raProcessor.rebateAgreementView will NOT contain values of Outputs. The only exception are "overridable" outputs. This limitation is because of performance optimization of amount of data being sent between user interface and backend.

  • Expected logic execution outcome

    • pre-phase execution

      • definition of input fields - via the raProcessor.addOrUpdateInput()

      • content of api.global created by pre-phase header logic, will be persisted and available to the Rebate Item Logic, when calculating the line items

    • post-phase execution

      • header calculation results - via the raProcessor.addOrUpdateOutput()

      • Custom Header - via the raProcessor.addOrUpdateOutput()

      • set attributeX field values - via raProcessor.updateField("attribute1", "value")

      • hide out-of-the-box buttons - via raProcessor.setRenderInfo()

      • raise critical Alert - if the logic creates at least one critical alert, it’s considered as an exception, and the process (e.g. submission) will stop.

    • Note, that the results of the logic elements are not stored nor displayed anywhere (with exception when testing the logic in Studio)

    • in general, the logic is expected to use the provided RebateAgreementBuilder object to manipulate the content of the document. For list of allowed manipulations, see description of object CalculableLineItemCollectionBuilder

Setup

As you can have potentially more rebate agreement header logics, you must select the one, which will be used, when user is working with rebate agreement document.

This is done in Advanced Configuration Option called defaultRAHeaderFormula, the content of this option is the name of the header logic to be used.

The option can be also set up on page Administration  Logics  Header Logics  Rebate Agreements, via setting Default RA Header logic, and then fetched to the project as configuration file.

Code sample

We do not have a rebate agreement specific sample, but you can review samples for quotes and contracts. The principles used in those samples are exactly the same as those in rebate header.

Groovy API

There are some commonly used functions for header logics:

  • No labels