Compensation Header Logic

Since version 9.0

Compensation Header logic is used when you need to:

  • Create input fields for:

    • Compensation Plan header

    • Compensation Plan folders

    • Compensation Plan items (not so common)

  • Hide out-of-the-box header input fields.

  • Add or remove the Compensation Plan items and folders, e.g. modify the structure of the document.

  • Calculate results for:

    • Whole compensation plan, e.g. summaries like grand total price or overall margin.

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

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

To understand where the header logic fits in the process, see Process of Compensation Plan Recalculation.

Logic API

  • Logic Nature: compensationHeader

    • Logic Type: Calculation/Pricing

  • Execution Types:

    • Standard – It is done twice and the executions are called phases. They have different purposes, so you must distinguish these executions in the code by checking which execution it is at the moment:

      • pre-phase – First execution. It creates input fields on the header, folders or items, and creates/removes the items/folders.

      • post-phase – Second execution. It calculates summary info for the items and stores them on the header, folder or items.

  • Information provided to the logic:

    • Binding variables:

      • coProcessor: CompensationBuilder

        • CAUTION: When using Pricefx non-React user interface, during pre-phase the coProcessor.compensationView will NOT contain outputs values. The only exception are "overridable" outputs. This limitation is to optimize performance when sending data between the user interface and backend.

  • Expected logic execution outcome:

    • pre-phase execution:

      • Definition of input fields – via coProcessor.addOrUpdateInput()

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

    • post-phase execution:

      • Header calculation results – via coProcessor.addOrUpdateOutput()

      • Custom Header – via coProcessor.addOrUpdateOutput()

      • Set attributeX field values – via coProcessor.updateField("attribute1", "value")

      • Hide out-of-the-box buttons – via coProcessor.setRenderInfo()

      • Raise critical alert – If the logic creates at least one critical alert, 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 or displayed anywhere (with the exception of testing the logic in Studio).

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

Setup

As it is possible to have more Compensation Plan header logics, you must select the one which will be used when the user is working with a Compensation Plan document.

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

Code Sample

We do not have a specific Compensation Plan sample but you can review samples for quotes and contracts. The principle used in those samples is exactly the same as in the compensation header.

Groovy API

There are some commonly used functions for header logics:

Found an issue in documentation? Write to us.

Â