This example shows how to implement a basic project in Promotion Managerthe Agreements & Promotions module. We will create a promotional campaign, in which we want to offer to restaurants a volume discount on lamb meat and a net fixed price for all lamb meatballs.
To build a new project in PromotionManagerAgreements & Promotions, we will take the following steps:
- Create a contract an Agreements & Promotions calculation logic for each of the two line items in the contractPromotion.
- Create a contract term typeCondition Type for each of the calculation logics.
- Set up Price Records – map contract attributes to Price Record fields.
- Create a calculation logic for accessing the Price Records.
- Typically, you will also to set up an approval workflow logic in Workflow Logics (of Contract of Agreement & Promotion type).
...
Create Agreements & Promotions Calculation Logics
We will create two contract calculation logics that define user inputs and pass the entered values on to Price Records. To start, go to Configuration Administration > Calculation Logic > Contracts Logics > Agreements & Promotions and click 'Add 'logic.
Volume Discount Calculation Logic
The volume discount logic will include the following elements:
- User input field for selecting a customer group.
- User input field for selecting a product group.
- Contract term type Condition Type – returns the reference to the contract term type Condition Type of the line.
- User input field for selecting the start and end date of the campaign (if you want to give the user the option to modify the dates inherited from contract the document level).
- A multi-tier user input field for entering the volume discount ranges.
Element Name | Label | Formula Expression |
---|---|---|
CustomerGroup | Customer Group | api.customerGroupEntry() |
ProductGroup | Product Group | api.productGroupEntry() |
ContractTermTypeConditionType | Contract Term Condition Type |
|
ValidFrom | Valid From |
|
ValidTo | Valid To |
|
VolumeDiscount | Volume Discount |
|
Net Price Calculation Logic
The net price logic will include the following elements:
- User input field for selecting a customer group.
- User input field for selecting a product group.
- Contract term type – returns Condition Type – returns the reference to the contract term type Condition Type of the line.
- User input field for selecting the start and end date of the campaign (if you want to give the user the option to modify the dates inherited from contract the document level).
- User input field for the net price value.
Element Name | Label | Formula Expression |
---|---|---|
CustomerGroup | Customer Group | api.customerGroupEntry() |
ProductGroup | Product Group | api.productGroupEntry() |
ContractTermTypeConditionType | Contract Term Condition Type |
|
ValidFrom | Valid From |
|
ValidTo | Valid To |
|
NetPrice | Net Price | return api.userEntry("Net Price")?:0 |
Create
...
Condition Types
A Contract term type Condition Type represents an item in the promotional offer. We will create two contract term typesCondition Types, one for the volume discount and one for the net price promotion. We will assign the previously created calculation logics to them.
- Go to 'PromotionManager' > 'Contract Term Types'to Agreements & Promotions > Condition Types.
- Click 'Add ' Condition Type and enter the name and label.
- Select the corresponding Pricing pricing logic.
- (Optional) Define the value of the Waterfall Element and other attributes.
In the Waterfall Element, you can indicate which field (of the Quote or Datamart) is influenced by this contract condition. This can be used, for example, when the Quote Line searches for the appropriate Price Record (which was generated from the Contract Term Condition Type).
Set Up Price Records
Price Records are created automatically from the Contract Promotion lines but you can influence the content of the resulting fields. In our case most of the things go automatically, we only need an additional "VolumeDiscount" element.
...
For more details see /wiki/spaces/KB/pages/99570364.
Create Logic to Access the Price Records
This example shows how to find an appropriate Price Record on the Quote Line Item.
Code Block | ||
---|---|---|
| ||
def productFilter = api.productToRelatedObjectsFilter("PR", api.product("sku")) def customerFilter = api.customerToRelatedObjectsFilter("PR", api.customer("customerId")) def dateFromFilter = Filter.lessOrEqual("validAfter",api.targetDate()) def dateToFilter = Filter.greaterOrEqual("expiryDate",api.targetDate()) def prs = api.find("PR", productFilter, customerFilter, dateFromFilter, dateToFilter) for (pr in prs) { //........... } |
See also Searching Relevant Price Records.