Quote Header logic is used when you need to:
-
Create input fields on:
-
Quote header
-
Quote folders
-
Quote items (not so common)
-
-
Hide out-of-the-box header input fields.
-
Add or remove quote items and folders, e.g. modify the structure of the document.
-
Calculate results for:
-
Whole quote, 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 belongs in the process, see Process of Full Quote Recalculation.
Logic API
-
Logic Nature: quoteHeader
-
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 of items and stores them on the header, folder or items.
-
-
-
Information provided to the logic:
-
Binding variables:
-
quoteProcessor: QuoteBuilder
-
CAUTION: When using Classic or Unity non-React user interface, then during pre-phase, the
quoteProcessor.quoteView
will NOT contain values of outputs. The only exception are "overridable" outputs. This limitation is to optimize performance when sending data between the user interface and backend.
-
-
-
context:
-
commandName - info about which operation caused the execution of this logic, e.g. if it was Recalculate, Submit, etc. See api.currentContext() for details.
-
-
-
Expected logic execution outcome:
-
pre-phase execution:
-
Definition of input fields – via
quoteProcessor.addOrUpdateInput()
. -
Content of
api.global
created by the pre-phase header logic will be persisted and available to the Quote Item Logic when calculating the line items.
-
-
post-phase execution:
-
Header calculation results – via
quoteProcessor.addOrUpdateOutput()
. -
Custom header – via
quoteProcessor.addOrUpdateOutput()
. -
Set attributeX field values – via
quoteProcessor.updateField("attribute1", "value")
. -
Hide out-of-the-box buttons – via
quoteProcessor.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 QuoteBuilder object to manipulate the content of the document. For a list of allowed manipulations, see the description of the object CalculableLineItemCollectionBuilder.
-
Code Sample
See Quote_Header_Sample.
Groovy API
There are some commonly used functions for header logics:
-
Check for which phase the logic is executed:
-
quoteProcessor. isPrePhase()
-
quoteProcessor. isPostPhase()
-
-
Read the quote header/items data:
-
quoteProcessor. getQuoteView()
-
-
Create input fields on header, folder or item:
-
quoteProcessor. addOrUpdateInput()
-
-
Create outputs/results on header, folder or item:
-
quoteProcessor. addOrUpdateOutput
-