...
Contracts
To set up a promotion, the end user must navigate to the contract detail page:
:Info |
---|
In Pricefx, promotions are set up in contracts. |
Tip |
---|
In Unity, the labels can be changed to display Promotions — instead of Contracts. |
Similarly to the quote, a contract consists of:
A Header section
An [Line] Items section
Contract Header
Information about the contract as a whole is stored in the header. Like the quote, the header has input parameters and output values; both of which are controlled by a header logic.
In Pricefx Studio, a header logic can be added by selecting the formula nature Contract Header. In most aspects, the contract header logic works like the quote header logic, but the document is traversed by utilizing the binding variable cProcessor
, which references the ContractBuilder.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
cProcessor.getContractView() |
To ensure that the header logic is used for new contracts, navigate to
, and set the Default Agreement & Promotion Header Logic.Contract Line Items
Unlike the quote, contract line items represent a broader set of contract pricing terms, not necessarily related to only one product.
Contract terms are an abstraction of the terms and conditions of a promotion.
When the end user adds a line item, he/she selects a Contract Term Type, which is an entity that determines how the line items will be calculated.
A line item has input parameters — which allow the end users to specify thresholds, discounts, product ranges, etc. — and element outputs — which typically contain estimations of the impact of the promotion.
Contract Term Types
The contract term type (Condition Type) references a contract calculation logic. This logic generates input parameters (during syntax checkinput generation) and calculates outputs during recalculation.
The contract term type also has attribute1..30 fields, which can be read by the calculation logic and used to parametrize the behavior of the logic.
Contract Calculation
When the end user clicks on Recalculate, or when he/she submits the document for approval, the contract is sent to the backend for calculation. There, for each line item, the associated calculation logic is invoked and the result is saved on the line item. Thus, a big difference between quotes and contracts is that the quote’s quote type applies to the entire document, while the contract’s contract term type applies to the line item.
Typically, the result of a contract calculation logic will be twofold:
Estimations of the impact of the promotion. An example of this can be to use transactional history to extrapolate future sales, and apply the promotion to obtain a simulated value.
Price records (created after approval), which are used to
Export the contract terms to external systems.
Query the contract terms in other Pricefx modules.
Accessing the Contract Term Type Within the Logic
Sometimes, it can be useful to access the contract term type from within the calculation logic. For example:
When there is information stored in attribute fields of the contract term.
When a single logic is shared between multiple contract term types; the logic behaves differently depending on the associated contract term type.
In a case like this, read the line item with api.currentItem()
and access the contract term type name with
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
String contractTermTypeName = api.currentItem().contractTermType |
To read the contract term type’s attribute field values, use api.find()
, with the type code CTT.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
api.find('CTT', 0, 1, null, Filter.equal('uniqueName', contractTermTypeName)) |
Price Records
When a promotion has been set up, it needs to be used somewhere else; either in other modules, or in some external systems. Therefore, when a contract is approved, a set of price records is generated.
Each contract line item results in the creation of one price record. The values of the line item inputs — and outputs — are mapped to those price record attribute fields where the name matches. For example:
These price records are of the same type as for quotes; meaning that contract price records are stored together with quote price records in the same physical table. The way to distinguish between the two is by looking at the Source ID field; for quotes, it starts with “P-” — and for contracts, it starts with “C-”.
The price records can be viewed on the PromotionManager Price Record page:
.Info |
---|
The Agreements & Promotions Price Record page only displays price records that originate from contracts. (Unity applies a filter on the Source ID field when it queries the Price Record table). |
...