[go: up one dir, main page]

0% found this document useful (0 votes)
97 views150 pages

Advanced Pricing Exercise Guide2

Uploaded by

praveen.bonalu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views150 pages

Advanced Pricing Exercise Guide2

Uploaded by

praveen.bonalu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 150

Advanced Pricing

Exercise Guide
Version 1.0
Advanced Pricing
Exercise Guide

TABLE OF CONTENTS

Preface 5
Overview 5
What You Will Learn 5
Prerequisites 5

Advanced Pricing Overview 6

Exercise 9-1: Create Attribute-Based Pricing 8


Attribute-Based Pricing 9
Attribute-Based Pricing Expression Sets and Lookup Tables 11
Attribute-Based Pricing and Pricing Plans 13
Task 1: Review Salesforce Industries Process Library 14
Task 2: Configure post-install steps 15
Task 3: Validate Apex classes 18
Task 4: Set up AttributePricingMatrix 21
Task 5: Set up RangeAttributePricingMatrix 25
Task 6: Set up SourceTargetAttributePricingMatrix 28
Task 7: Set up AttributePricingProcedure Expression Set 31
Task 8: Set up RangeAttributePricingProcedure Expression Set 38
Task 9: Set up SourceTargetAttributePricingProcedure Expression Set 41
Task 10: Set up custom pricing steps 42
Task 11: Refresh the platform cache 49
Task 12: Add products to the Cart to initiate attribute-based pricing 50

Exercise 9-2: Create Loyalty Pricing 55


Loyalty Pricing 56
Creating Pricing Elements for Loyalty Pricing 56
Task 1: Enable loyalty pricing 58
Task 2: Create pricing elements for loyalty point charges 59
Task 3: Assign loyalty pricing to products 61
Task 4: Refresh the cache 63
Task 5: Create orders using loyalty pricing 64

Exercise 9-3: Work with Repricing 67

© Copyright 2022 Salesforce.com, inc. All rights reserved. 2


Advanced Pricing
Exercise Guide

Repricing 68
Task 1: Activate the RepricingElementServiceImplementation 69
Task 2: Reprice order line items to reflect a price effectivity change 70
Task 3: Reprice an asset to reflect a context rule condition for an account 77

Exercise 9-4: Create a Pricing Hook 83


What is an Event Hook? 84
How can I use an event hook in Industries CPQ? 84
How is the CpqAppHandlerHook invoked? 85
What do I need to look out for when using a hook? 86
Examples of using a hook 87
Task 1: Review the billing zip code custom field 88
Task 2: Create an attribute pricing matrix for billing zip code 89
Task 3: Create an attribute pricing procedure expression set for billing zip code 92
Task 4: Create a custom pricing plan step for billing zip code 95
Task 5: Create a new Apex class 97
Task 6: Create the CpqAppHandlerHookImplementation 99
Task 7: Add a new column to the Cart 101
Task 8: Add billing zip code as a custom field in the Cart 108
Task 9: Test in the Cart 110
Troubleshooting Guide 112
Modifying the Cart 113

Exercise 9-5: Create Usage Pricing 114


What is Usage Pricing? 115
Task 1: Enable usage pricing 118
Task 2: Create charge measurements and assign usage pricing to products 119
What is an attribute binding? 124
What is a Vlocity Object? 126
Task 3: Configure an attribute and an attribute binding for estimated usage quantity 127
Task 4: Test usage pricing in the Cart 133
Task 5: Configure attribute-based pricing for usage pricing 135
Task 6: Edit an order to use attribute-based pricing 143

Exercise 9-6: Extending Attribute-Based Pricing Challenge 145


Task 1: Review product attributes 146

© Copyright 2022 Salesforce.com, inc. All rights reserved. 3


Advanced Pricing
Exercise Guide

Task 2: Set up attribute-based pricing matrix 148


Task 3: Test attribute-based pricing in the Cart 149

© Copyright 2022 Salesforce.com, inc. All rights reserved. 4


Advanced Pricing
Exercise Guide

Preface
These training exercises are based on the Spring ’22 release of Salesforce Industries
Communications, Media, and Energy & Utilities Clouds. For additional information about
the topics covered in this module, see the documentation available in Vlocity Success
Community at https://success.vlocity.com.

Overview

This module includes concepts and exercises regarding:

● Attribute-based pricing
● Loyalty pricing
● Repricing orders and assets
● Event hooks
● Usage pricing

What You Will Learn


When you complete this training, you will be able to:

● Price products using product attributes.


● Price products using loyalty points.
● Create an event hook and explain when it is invoked.
● Explain how repricing works using multiple price list entries.
● Price energy commodities (products) based on estimated usage

Prerequisites

The prerequisites for this training include successful completion of the Pricing and EPC
modules from the Build Salesforce Industries Configure, Price, Quote (CPQ) Solutions
training course. In addition, a solid understanding of basic Salesforce concepts and
functionality is required. You should also have a working knowledge of telecommunications,
media, or energy and utilities industry business objectives.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 5


Advanced Pricing
Exercise Guide

Advanced Pricing Overview


In the Pricing module, we covered how Salesforce Industries’ pricing solution offers:

● A component-oriented system with reusable items.

● Types of pricing, such as penalties, charges, and adjustments to existing charges.

● Settings that determine the frequency that the charge occurs.

● Pricing components which live independently of products.

● Transitioning from older pricing to newer pricing for less expense and disruption.

Now, let’s dig a little deeper. Salesforce Industries CPQ provides standard and advanced
pricing capabilities for you to:

● Offer customers the option of paying with loyalty points.

● Change the price of a product automatically over time.

● Customize the pricing process by adding pricing plan steps or invoking an event
hook.

● Automatically reprice products, draft items in the Cart, and assets.

● Price energy commodities (products) based on estimated usage

As we progress through this module you will be exposed to advanced functionality. To


understand these features, we need to start with the underlying structure. The core of
Salesforce Industries open architecture is the interface and implementation paradigm. An
interface manages the application and its call out to business logic; an implementation is
that business logic. Salesforce Industries offers multiple implementations for each interface.
You can choose the implementation that best fits your needs, or you can create your own
implementation. When used judiciously, you can define interfaces once and deploy them
many times to consistently maintain and apply business logic.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 6


Advanced Pricing
Exercise Guide

Salesforce Industries provides a variety of interfaces and implementations that support


functionality across Salesforce Industries clouds and change the default behavior for
asset-based ordering, contracts, context rules, advanced rules, and pricing. For example, the
PricingInterface communicates with the system to ask, “How should I price this product?”
The implementation responds with the appropriate business logic to evaluate the
configuration, price lists, and rules and determine the correct price for the product.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 7


Advanced Pricing
Exercise Guide

Exercise 9-1: Create Attribute-Based Pricing


Scenario
Eliza Young, Infiwave’s Developer, is quickly learning that with all the products Infiwave
offers and the possible combinations of those products that the product catalog is going to
grow rapidly, increasing the time needed on maintenance and administration. She thinks to
herself, there must be a more efficient way to price the hundreds of products in the catalog.
In her search for a solution, she comes across Attribute-Based Pricing. Implementing
Attribute-Based Pricing allows Eliza to create a single product, a set of attributes and use a
matrix to price each combination of attributes. Hooray! Eliza is ecstatic that less time will be
spent on maintaining and administering the product catalog.

Goal
● Explain the concept of attribute-based pricing
● List the types of attribute-based pricing
● Set up attribute-based pricing using pricing plans
● Add data to lookup tables
● Create expression sets to price the line item in the Cart
● Add a new step to the default pricing plan

Tasks
1. Review Salesforce Industries Process Library
2. Configure post-install steps
3. Validate Apex classes
4. Set up AttributePricingMatrix
5. Set up RangeAttributePricingMatrix
6. Set up SourceTargetAttributePricingMatrix
7. Set up AttributePricingProcedure Expression Set
8. Set up RangeAttributePricingProcedure Expression Set
9. Set up SourceTargetAttributePricingProcedure Expression Set
10. Set up custom pricing steps
11. Refresh the platform cache
12. Add products to the Cart to initiate attribute-based pricing

Time: 25 mins

© Copyright 2022 Salesforce.com, inc. All rights reserved. 8


Advanced Pricing
Exercise Guide

ALERT:
If you’ve just received your training playground, add your email address
to the system administrator profile to ensure you receive all system
notifications. In the upper-right, click on the Avatar and select Settings.
Enter your email address in the Email field on the Personal Information
page and click Save.

Attribute-Based Pricing

Assigning attributes to products provides a powerful and flexible way to describe product
characteristics. Consider a smartwatch with two product attributes – case size and
connectivity. Without attribute-based pricing you would need to create four products for
each configuration so that each is priced correctly.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 9


Advanced Pricing
Exercise Guide

But, with attribute-based pricing you create a single product, a set of attributes and use a
matrix to price each combination of attributes.

Salesforce Industries provides three types of attribute-based pricing:

● Standard – prices a product using attributes.

● Source/Target – prices a product based on the attributes of another product.

● Range – prices a product when the value falls within the defined range for each
attribute and field in the matrix.

You can implement attribute-based pricing using pricing plans, expression sets, and lookup
tables.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 10


Advanced Pricing
Exercise Guide

Attribute-Based Pricing Expression Sets and Lookup Tables

In this exercise, you’ll use preconfigured lookup tables and create expression sets to execute
attribute-based pricing. There are two forms of lookup tables: a decision matrix or a
decision table. Decision matrices are exact-match based lookup tables that match your
inputs to values in a row, and return the row’s output. Decision tables are complex lookup
tables that match your inputs to values in multiple rows, if applicable, and return multiple
matching outputs. An expression set is a procedure that performs a series of calculations on
matrix lookups and user-defined variables and constants. Together, expression sets and
lookup tables comprise the Business Rules Engine.

NOTE:
Expression sets and lookup tables are similar in function to calculation
procedures and calculation matrices, and are part of Salesforce core in
Summer ‘22 and later releases. Calculation procedures and matrices are still
supported and included in Industries packages, though we recommend using
expression sets and lookup tables for advanced pricing scenarios.

Salesforce provides a DataPack that can be downloaded from the Salesforce Industries
Process Library. This DataPack includes preconfigured matrices to support attribute-based
pricing. The Attribute/Volume Based Pricing DataPack has already been installed in your
training playground, and it imported the following records.

Decision Matrix (Lookup Table) DataPack

AttributePricingMatrix AttributePricingDataPack.json

SourceTargetAttributePricingMatrix SourceTargetAttributePricingDataPack.json

RangeAttributePricingMatrix RangeAttributePricingDataPack.json

The preconfigured decision matrices contain the following columns:

© Copyright 2022 Salesforce.com, inc. All rights reserved. 11


Advanced Pricing
Exercise Guide

Header Name Header Type Data Type Description

SourceProductName Input Text Product Name

SourceProductCode Input Text Product Code is the key for the


matching algorithm used in the
PricingPlanHelper.cls.

CharacteristicName Input Text Attribute name associated with the


product. Specify multiple attributes
using a semi-colon delimited list.

CharacteristicValue Input Text Attribute value associated with the


product attribute. Specify multiple
attributes using a semi-colon
delimited list.

MRC Output Currency Recurring monthly charge. Does not


need to match an existing pricing
element value in the price list that is
used for the order.

NRC Output Currency Non-recurring charge or one-time


charge. Does not need to match an
existing pricing element value in the
price list that is used for the order.

Target Product Code Output Text Used only for Source/Target or


Range pricing. Specifies the target
output name to which the pricing
override is applied.

ALERT:
Do not change the header names of the columns in the decision
matrices. The PricingPlanHelper.cls expects these column names and
will fail if they are not found.

The Range Attribute Pricing matrix also includes a Text column type to store the Quantity
API field name.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 12


Advanced Pricing
Exercise Guide

Attribute-Based Pricing and Pricing Plans


You can invoke the expression sets and lookup tables from a pricing plan. A pricing plan is a
series of steps in sequence, and each step invokes a process, function, or procedure. Pricing
plans are defined in the Vlocity Product Console. You can use pricing plans to perform a
wide-variety of calculations such as promotion discounts, taxes, and more—including
attribute-based pricing.

When implementing attribute-based pricing using pricing plans, you need to create a new
step in the default pricing plan. This step will call an expression set and lookup table that
stores the product attributes and pricing information. At runtime, the PricingPlanService
implementation passes the cart line items to the calculation service and retrieves the
correct price.

Pricing plans are implemented by the PricingInterface and require the PricingPlanService
implementation.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 13


Advanced Pricing
Exercise Guide

RESOURCE:
To optimize performance for large lookup tables or pricing plans that have
many attribute-based pricing steps refer to the topic, Caching Calculation
Matrices for Performance, in documentation on Vlocity Success Community.

Task 1: Review Salesforce Industries Process Library

1. Navigate to the Salesforce Industries Process Library and select Communications.

2. In the Search Communications field, enter attribute and select


Attribute/Volume Based Pricing.

3. Notice under the Process Package Includes section the files that are included in the
DataPack.

NOTE:
These files are required to be downloaded and installed before implementing
attribute-based pricing. We’ve already installed this DataPack in your training
playground.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 14


Advanced Pricing
Exercise Guide

Task 2: Configure post-install steps

1. Verify the Default Pricing Plan is installed.

a. Using the Lightning App Launcher, click the Configure Price Quote (CPQ)
app.
b. Navigate to the Vlocity Product Console.
c. Next to Pricing Plan in the Pricing area, click the search icon .
d. In the Search Pricing Plan… dialog box, press the return or enter key to
display the Default Pricing Plan.

2. Verify the Parameters Field displays.

a. Click on the Default Pricing Plan.


b. Click on the Pricing Plan Steps facet.
c. Click on any step.
d. In the General Properties pane, verify the Parameters field displays.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 15


Advanced Pricing
Exercise Guide

3. Verify the DefaultPricingPlan custom setting has been created.

NOTE:
This custom setting is used to indicate the default pricing plan used in the org.

a. Using the Lightning App Launcher , click CME Admin.


b. Under Custom Settings, click CPQ Configuration Setup.
c. In the Search dialog box under CONFIGURATIONS, enter pricing.
d. The DefaultPricingPlan custom setting displays. Notice that the SETUP VALUE
is set to the pricing plan's code.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 16


Advanced Pricing
Exercise Guide

4. Review the PricingPlanService implementation.

NOTE:
The PricingPlanService implementation is required when using pricing plans. It
is the same implementation as the PricingElementServiceImplementation but
the PricingPlanService allows you to manage all of its pricing steps using a
pricing plan defined in Vlocity Product Console.

a. Click the Interface Implementations tab.


b. Change the List Views to All.
c. Click PricingInterface.
d. On the Related tab, verify the Active and Default boxes are checked for the
PricingPlanService.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 17


Advanced Pricing
Exercise Guide

Task 3: Validate Apex classes

1. Verify the PricingPlanHelper.cls Apex class from the DataPack is installed.

NOTE:
This Apex class is invoked by CustomPricingPlanStepImpl.cls which analyzes
the matrix and invokes the calculation procedure or expression set.

Due to code dependencies, when setting up these Apex classes they must be
created in the order demonstrated.

a. Click on the Setup icon and select Setup.


b. In the Quick Find search box, enter and select Apex Classes.
c. On the Apex Classes page, verify the View is set to Pricing Plan Classes.
d. Verify PricingPlanHelper displays in the Name column.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 18


Advanced Pricing
Exercise Guide

e. Right-click to open the PricingPlanHelper in a new tab to review the Apex


code.

f. Review lines 100-103. What is the name of the method that retrieves the
price from the expression set (calculation procedure)?

g. Review lines 375-422 and lines 441-492. What is the code doing?

h. Review lines 1329-1360, notice the code is invoking an expression set


(calculation procedure). We will explore this further.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 19


Advanced Pricing
Exercise Guide

i. Review lines 1015-1034, what is the name of the method that sets the price
to return to the pricing plan service?

j. Close the browser tab with the PricingPlanHelper Apex code.

2. Verify the CustomPricingPlanStepImpl.cls and CustomPricingPlanStepImplTest.cls


Apex classes from the DataPack are installed.

NOTE:
The CustomPricingPlanStepImpl.cls Apex class exposes the GetMatrix method
and invokes the PricingPlanHelper class. The
CustomPricingPlanStepImplTest.cls is an Apex test class.

a. Verify that the CustomPricingPlanStepImpl and


CustomPricingPlanStepImplTest display in the Name column.
b. Right-click to open the CustomPricingPlanStepImpl in a new tab to review
the Apex code.
c. Review line 8, notice the method name. We will explore this further.
d. Close the browser tabs with the Apex codes.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 20


Advanced Pricing
Exercise Guide

Task 4: Set up AttributePricingMatrix

1. Using the Lightning App Launcher, search for and select Lookup Tables.

2. Change the List Views to All Decision Matrices.

3. Click AttributePricingMatrix, which was installed from the DataPack.

4. Select the Related tab and click AttributePricingMatrix V1.

5. Click Clone in the AttributePricingMatrix V1 header.

6. Change the Name to AttributePricingMatrix V2 and change the Version


Number to 2.

7. Select Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 21


Advanced Pricing
Exercise Guide

8. On the Decision Matrix Version screen, notice the preconfigured columns showing
the Input and Output Data.

NOTE:
If more than one matrix version is enabled, the Rank field in the New Decision
Matrix Version configuration dialog determines which version to use. The
version with the higher number in the rank field will be used for calculation
procedures.

9. Click Add Row four times to add four rows to the matrix.

10. Enter the following information to populate the matrix rows.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 22


Advanced Pricing
Exercise Guide

ALERT:
Data must be entered exactly as displayed, including spacing and proper case.
These columns match the product and its attributes; therefore, they must be
exact.

SourcePro SourceProdu CharacteristicName CharacteristicValu MRC NRC


ductName ctCode (Text) e (Text) (Curre (Curre
(Text) (Text) ncy) ncy)

DSL C-DSL-001 Download 20 Mbps;2 Mbps 50.00 0


Service Speed;Upload Speed

DSL C-DSL-001 Download 20 Mbps;896 45.00 0


Service Speed;Upload Speed Kbps

DSL C-DSL-001 Download 40 Mbps;2 Mbps 55.00 0


Service Speed;Upload Speed

DSL C-DSL-001 Download 40 Mbps;896 45.00 0


Service Speed;Upload Speed Kbps

11. Select Save.

12. In the AttributePricingMatrix V2 header, select Edit.

13. Check the Enabled checkbox and select Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 23


Advanced Pricing
Exercise Guide

TIPS:
Notice a mistake in the matrix after enabling? Click Clone from the dropdown
arrow menu and correct the mistake in the new version of the matrix. Make
sure that the new version is Enabled once you’re done.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 24


Advanced Pricing
Exercise Guide

Task 5: Set up RangeAttributePricingMatrix

1. Navigate to the Lookup Tables tab. You may need to search for it again using the
Lightning App Launcher.

2. Click the RangeAttributePricingMatrix, which was installed from the DataPack.

3. Select the Related tab and click RangeAttributePricingMatrix V1.

4. Click Clone.

5. Change the Name to RangeAttributePricingMatrix V2 and change the


Version Number to 2.

6. Click Save.

7. On the Decision Matrix Version screen, click Add Row two times to add two rows to
the matrix.

8. Enter the following data in the new matrix rows:

SourceProductNa SourceProd Characteristic Characteristic Quantity MRC NRC


me (Text) uctCode Name (Text) Value (Text) (Text) (Curr (Curre
(Text) ency) ncy)

Home Hub C-MOD-002 Grade Best 1-4 0 65.00


Modem

Home Hub C-MOD-002 Grade Best 5-9 0 50.00


Modem

TIPS:
Notice that the Quantity column uses a Text column type instead of a Number
Range column type. While either format is acceptable, it’s recommended that
you use Text column types for numeric ranges because they’re easier to
manage and maintain consistency when using several ranges in a single
matrix.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 25


Advanced Pricing
Exercise Guide

9. Select Save.

10. In the RangeAttributePricingMatrix V2 header, click Edit.

11. Check the Enabled checkbox and select Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 26


Advanced Pricing
Exercise Guide

© Copyright 2022 Salesforce.com, inc. All rights reserved. 27


Advanced Pricing
Exercise Guide

Task 6: Set up SourceTargetAttributePricingMatrix

1. Navigate to the Lookup Tables tab. You may need to search for it again using the
Lightning App Launcher.

2. Click the SourceTargetAttributePricingMatrix, which was installed from the


DataPack.

3. Select the Related tab and click SourceTargetAttributePricingMatrix V1.

4. Click Clone.

5. Change the Name to SourceTargetAttributePricingMatrix V2 and change


the Version Number to 2.

6. Click Save.

7. On the Decision Matrix Version screen, click Add Row to add a row to the matrix.

8. Enter the following data in the new matrix rows:

SourceProduct SourcePro Characteristic Characteristic Target MRC NRC


Name (Text) ductCode Name (Text) Value (Text) Product (Curre (Curre
(Text) Name ncy) ncy)
(Text)

Installatio C-INS-00 Installatio Full Path1 0 0


n 1 n Type Service
Install

TIPS:
You can enter the Target Product Name simply using the product name, which
will then price all occurrences of that target product throughout the order.
However, if you want to only price a specific occurrence of a product within a
bundle, you can use a path parameter as shown in this example. The path
parameter is described in the next task.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 28


Advanced Pricing
Exercise Guide

9. Select Save.

10. In the SourceTargetAttributePricingMatrix V2 header, click Edit.

11. Check the Enabled checkbox and select Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 29


Advanced Pricing
Exercise Guide

NOTE:
Due to the way that a lookup table requires input data to be unique across all
rows in the matrix, it’s not currently possible to use source-target
attribute-based pricing to change more than one child product in a bundle.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 30


Advanced Pricing
Exercise Guide

Task 7: Set up AttributePricingProcedure Expression Set

Now that Eliza has set up the lookup table, she’ll create expression sets to perform
calculations using the data entered in the matrices.

1. Using the Lightning App Launcher, search for and select Expression Sets.

2. Change the List Views to All Expression Sets and pin it so that All Expression Sets
display instead of Recently Viewed.

3. Click New.

4. In the New Expression Set dialog box, enter AttributePricingProcedure in the


Name field and select Save.

5. Click the Related tab.

6. Select the dropdown arrow next to AttributePricingProcedure V1 and click Edit.

7. In the Rank field, enter 1 and click Save.

8. Click AttributePricingProcedure V1.

9. Click Open in Expression Set Builder in the top right of the


AttributePricingProcedure V1 header.

10. Create the Lookup Table element.

a. In the Expression Set Builder window, select the + symbol to open the Add
Element dialog box.
b. Select Lookup Table from the list below the Search box to add a Lookup
Table element to the expression set.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 31


Advanced Pricing
Exercise Guide

c. In the Lookup Table Details field, search for and select


AttributePricingMatrix.

d. With the Lookup Table element selected, click the Element Details tab in
the left panel, and check the Include in Output checkbox.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 32


Advanced Pricing
Exercise Guide

11. Create the recurring monthly standard price variable.

a. Click the Resource Manager tab and click Add Resource.


b. In the Add New Resource dialog, enter the following information to create
the recurring monthly standard price variable:

Field Entry

Resource Type Variable

Resource Name REC_MNTH_STD_PRC

Data Type Currency

Decimal 2

c. Click Done.

12. Create the one-time standard price variable.

a. Click Add Resource.


b. In the Add New Resource dialog, enter the following information to create
the recurring monthly standard price variable and click Done:

© Copyright 2022 Salesforce.com, inc. All rights reserved. 33


Advanced Pricing
Exercise Guide

Field Entry

Resource Type Variable

Resource Name OT_STD_PRC

Data Type Currency

Decimal 2

13. Create the recurring monthly standard price calculation element.

a. Under the Lookup Table element, click the + symbol to open the Add
Element dialog box, and select Calculation.
b. In the Formula field of the new Calculation element, search for and select
AttributePricingMatrix__MRC.
c. In the Output Variable field, search for and select REC_MNTH_STD_PRC.

d. With the new Calculation element selected, click the Element Details tab

in the left panel, and check the Include in Output checkbox.

14. Create the one-time standard price calculation element.

a. Under the Lookup Table element, click the + symbol to open the Add
Element dialog box, and select Calculation.
b. In the Formula field of the new Calculation element, search for and select
AttributePricingMatrix__NRC.
c. In the Output Variable field, search for and select OT_STD_PRC.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 34


Advanced Pricing
Exercise Guide

d. With the new Calculation element selected, click the Element Details tab

in the left panel, and check the Include in Output checkbox.

15. Select Save in the top right corner of the Expression Set Builder, and then click
Activate.

16. Simulate the expression set to test out the procedure.

a. Click Simulate.
b. Enter the following input variables into the fields:

Field Entry

Effective Date [tomorrow’s date]

CharacteristicName Download Speed;Upload


Speed

SourceProductCode C-DSL-001

SourceProductName DSL Service

CharacteristicValue 20 Mbps;2 Mbps

NOTE:
The sequence of the simulation parameters may be different in your org. Make
sure to insert the correct value for each field.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 35


Advanced Pricing
Exercise Guide

c. Click Simulate to run the expression set.

d. Notice the green check marks that indicate that each element executed
successfully. Also, notice the output of the REC_MNTH_STD_PRC calculation
step is $50.00. This price matches the value you entered in the 20 Mbps;2
Mbps row of the decision matrix.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 36


Advanced Pricing
Exercise Guide

17. Close the Expression Set Builder browser tab.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 37


Advanced Pricing
Exercise Guide

Task 8: Set up RangeAttributePricingProcedure Expression Set

1. Navigate to the Expression Sets tab. You may need to search for it again using the
Lightning App Launcher.

2. Click New.

3. Enter RangeAttributePricingProcedure for the Name and select Save.

4. On the Related tab, select the dropdown arrow next to


RangeAttributePricingProcedure V1 and click Edit.

5. In the Rank field, enter 1 and click Save.

6. Click RangeAttributePricingProcedure V1.

7. Select Open in Expression Set Builder from the header in the upper right.

8. In the Expression Set Builder window, click the plus + symbol and select Lookup
Table.

9. In the Lookup Table Details field, search for and select


RangeAttributePricingMatrix.

10. With the new Lookup Table element selected, click the Element Details tab in
the left panel, and check the Include in Output checkbox.

11. Click the Resource Manager tab and select Add Resource.

12. As you did in the last exercise, add the recurring monthly standard price and
one-time standard price variables:

© Copyright 2022 Salesforce.com, inc. All rights reserved. 38


Advanced Pricing
Exercise Guide

Recurring Monthly Standard Price

Field Entry

Resource Type Variable

Resource Name REC_MNTH_STD_PRC

Data Type Currency

Decimal 2

One-Time Standard Price Variable

Field Entry

Resource Type Variable

Resource Name OT_STD_PRC

Data Type Currency

Decimal 2

13. Add a new Calculation element and enter the following information:

Field Entry

Formula RangeAttributePricingMatrix__MRC

Output Variable REC_MNTH_STD_PRC

14. Add another Calculation element and enter the following information:

Field Entry

Formula RangeAttributePricingMatrix__NRC

Output Variable OT_STD_PRC

© Copyright 2022 Salesforce.com, inc. All rights reserved. 39


Advanced Pricing
Exercise Guide

15. For all three elements, make sure that the Include in Output checkbox is selected in

the Element Details tab.

16. Select Save and then click Activate.

TIPS:
To help troubleshoot any potential errors, try simulating the expression set by
clicking Simulate and entering corresponding values from the connected
decision matrix.

When simulating the RangeAttributePricingProcedure, you must enter the


literal range values from the Quantity field of the RangeAttributePricingMatrix
(e.g. “1-5”) to return an accurate calculation. This is because the
PricingPlanHelper.cls, which identifies the corresponding range based on the
Quantity entered, is not called from the expression set. You’ll test this
calculation in the Cart in a later exercise step.

17. Close the Expression Set Builder browser tab.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 40


Advanced Pricing
Exercise Guide

Task 9: Set up SourceTargetAttributePricingProcedure Expression Set

Now that you’ve got the hang of expression sets, create and configure the
SourceTargetAttributePricingProcedure to perform calculations using information from the
SourceTargetAttributePricingMatrix.

1. Create an expression set and name it


SourceTargetAttributePricingProcedure.

2. Enter 1 in the Rank field of the new version.

3. Open the expression set version in the Expression Set Builder.

4. Create a Lookup Table element to connect the SourceTargetAttributePricingMatrix.

5. Add the Recurring Standard Monthly Price (REC_MNTH_STD_PRC) and One-Time


Standard Price (OT_STD_PRC) currency variables in the Resource Manager as you did
in the last task.

6. Create a Calculation element to map the SourceTargetAttributePricingMatrix__MRC


formula to the REC_MNTH_STD_PRC output variable as you did in the last task.

7. Create a Calculation element to map the SourceTargetAttributePricingMatrix__NRC


formula to the OT_STD_PRC output variable as you did in the last task.

8. For all three elements, make sure that the Include in Output checkbox is selected.

9. Click Save and Activate.

10. Optional: Simulate the expression set and troubleshoot any errors that occur.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 41


Advanced Pricing
Exercise Guide

Task 10: Set up custom pricing steps

Eliza has created lookup tables and expression sets and she’ll now configure steps in the
Default Pricing Plan so that the attribute-based pricing calculations will display at runtime in
the Cart.

1. Navigate to the Vlocity Product Console.

2. Next to Pricing Plan in the Pricing area, click the search icon .

3. In the Search Pricing Plan… dialog box, press the return or enter key to display the
Default Pricing Plan.

4. Click on the Default Pricing Plan.

5. Click on the Pricing Plan Steps facet.

6. Review the sequence of steps. Refer below for a description of each Pricing Plan
Service Step.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 42


Advanced Pricing
Exercise Guide

7. Create the Attribute Based Pricing step.

a. Click New Item.


b. Enter the following data in the General Properties pane:

Field Entry

Name Calculate Attribute Based Pricing

Implementation Name CustomPricingPlanStepImpl

Method Name GetMatrixPrice

Sequence 5

Active ✔

ALERT:
All attribute pricing steps must occur before the Initialize Pricing Context step;
therefore, the sequence must be before 10.

c. Click the Edit icon to open the Parameters dialog box.


d. Click the plus + symbol to add the following parameters:

First Box Second Box

ProcedureName AttributePricingProcedure

MatrixName AttributePricingMatrix

DecisionMatrix true

© Copyright 2022 Salesforce.com, inc. All rights reserved. 43


Advanced Pricing
Exercise Guide

TIPS:
Click on the + multiple times to create blank rows avoiding the need to click
on the + each time a new row is needed.

e. Click Done.
f. Click Save in the General Properties pane.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 44


Advanced Pricing
Exercise Guide

8. Create a new pricing plan step for Source Target Attribute Pricing using the following
information.

a. Click New Item.


b. Enter the following information in the General Properties pane:

Field Entry

Name Calculate Source Target Attribute


Pricing

Implementation Name CustomPricingPlanStepImpl

Method Name GetMatrixPrice

Sequence 6

Active ✔

c. Click the plus + symbol to add the following parameters:

First Box Second Box

ProcedureName SourceTargetAttributePricingProcedure

MatrixName SourceTargetAttributePricingMatrix

Path1 Back to School Student Offer<Back to


School Backpack

DecisionMatrix true

TIPS:
When you identify a path, you are pricing a target product differently. It prices
the target product based on the bundle it is in. The target path must be
formatted as: [root product name]<[parent1 product name][parent2 product
name][…]<[product name].

In this example, Path1 corresponds to the Target Product Name in the


SourceTargetAttributePricingMatrix.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 45


Advanced Pricing
Exercise Guide

d. Click Done.
e. Click Save in the General Properties pane.

9. Create a new pricing plan step for Range Attribute Pricing.

a. Click New Item and enter the following information:

Field Entry

Name Calculate Range Attribute Pricing

Implementation Name CustomPricingPlanStepImpl

Method Name GetMatrixPrice

Sequence 7

Active ✔

© Copyright 2022 Salesforce.com, inc. All rights reserved. 46


Advanced Pricing
Exercise Guide

b. Add the following parameters to the step:

First Box Second Box

ProcedureName RangeAttributePricingProcedure

MatrixName RangeAttributePricingMatrix

RangeFields Quantity

DecisionMatrix true

IncludeAttrInfoInRangeKeys false

c. Click Done.
d. Click Save in the General Properties pane.

NOTE:
When you want to use range attribute pricing, you specify the API names of
fields or attributes using the RangeFields or RangeAttributes parameters. The
fields and attributes listed need to have corresponding columns in the
RangeAttributePricingMatrix.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 47


Advanced Pricing
Exercise Guide

NOTE:
The IncludeAttrInfoInRangeKeys parameter controls how the range column of
the decision matrix is handled based on the conditional attributes in the other
columns. In the range attribute matrix you created, the attributes are the
same across all of the rows, and the quantity fields alone control the price of
the product:
C-MOD-002 | Grade | Best | 1-4 | $65
C-MOD-002 | Grade | Best | 5-9 | $50

But what if you wanted to repeat the ranges and include another characteristic
value (e.g. “Good”) as a condition, as shown below?
C-MOD-002 | Grade | Best | 1-4 | $65
C-MOD-002 | Grade | Good | 1-4 | $50

In this case, you’d set the IncludeAttrInfoInRangeKeys parameter to ‘true’ in


the pricing plan step so that each attribute value is calculated along with the
repeated range.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 48


Advanced Pricing
Exercise Guide

Task 11: Refresh the platform cache

Pricing plan steps and/or parameters are cached in the platform cache after they are
executed for the first time in the Cart. Anytime you make changes to a pricing plan
step/parameter you are required to run the maintenance jobs Clear Managed Platform
Cache and Refresh Platform Cache. When the Cart is invoked, the platform cache will be
populated with the new pricing plan step and/or parameter data.

1. Navigate to the Vlocity CMT Administration tab. You may need to click the More
dropdown menu to expand for additional tabs.

2. Under Admin Console, click Maintenance Jobs.

3. For the job Clear Managed Platform Cache, click Start and OK.

4. For the job Refresh Platform Cache, click Start and OK.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 49


Advanced Pricing
Exercise Guide

Task 12: Add products to the Cart to initiate attribute-based pricing


1. Add products to the Cart.

a. Click the Orders tab and click New.


b. On the New Order dialog, enter the following:
Field Value

Order Name Attribute Based Pricing Order

Account Name White, Noah

Order Start Date [Today’s date]

Price List B2C Price List

c. Click Save.
d. Click on the Power Launcher’s search field and select Configure Order.
e. Search for the product Back to School.
f. Add the Back to School Student Offer and Back to School Backpack to the
Cart.
g. Expand the Messages information bar to expose the Take Me There icon
to address the required missing attributes.
h. For DSL Service, select 40 Mbps for the Download Speed and 2 Mbps for the
Upload Speed.
i. For Home Hub Modem, select Better for the Grade.
j. Click Close.
k. Search for the product Home Hub Modem and add it to the Cart.
l. Click the Take Me There icon to address the required missing attribute.
m. Select Best for the Grade and click Close.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 50


Advanced Pricing
Exercise Guide

2. Test the AttributePricingMatrix

a. In the Recurring Charge column for DSL Service, click on the charge and

select the Price Details icon.


b. Notice that the price returned is from the Attribute Pricing Procedure based
on the data entered in the matrix.

c. Click Close.
d. Change the Download and Upload Speeds to those identified in the matrix.
Does the recurring charge change according to the amounts entered in the
matrix?

© Copyright 2022 Salesforce.com, inc. All rights reserved. 51


Advanced Pricing
Exercise Guide

3. Test the RangeAttributePricingMatrix.

a. In the One Time Charge column for the Home Hub Modem, (not part of the
Back to School Student Offer bundle) notice the price.

b. Change the quantity to 5. Did the price change to the amount identified in
your Range Attribute Pricing Matrix from Task 5?
c. In the One Time Charge column, click on the charge and select the Price

Details icon.
d. Notice that the price returned is from the Range Attribute Pricing Procedure
based on the data entered in the matrix.

e. Click Close.

4. Test the SourceTargetAttributePricingMatrix.

a. Notice the price of the Back to School Backpack when added to the Cart not
as part of a bundle.
b. In the One Time Charge column for Back to School Backpack (part of the
Back to School Student Offer bundle), click on the charge and select the

Price Details icon.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 52


Advanced Pricing
Exercise Guide

c. Notice that the price returned is from the Source Target Attribute Pricing
Procedure based on the data entered in the matrix (Path1).

d. Click Close.
e. The custom pricing plan step parameter (Path1) and the target product
(Path1) in the matrix states that if the Back to School Student Offer is added
to the Cart with Full Service Install set as the Installation Type the Back to
School Backpack is $0.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 53


Advanced Pricing
Exercise Guide

Troubleshooting Guide
If you encountered issues while performing the simulation of an expression set, or aren’t
getting the intended results in the Cart after completing the above tasks, try the following.

Lookup Table (Decision Matrix)

● Check that all matrix row information and expression set variables are entered
correctly.

● Check that the matrix is enabled.

● Make sure that the MRC and NRC columns are configured as Currency and Output
column types.

Expression Set

● Make sure you’ve set the Rank of the expression set version to 1.

● Check that each expression set element has the Include in Output checkbox
selected in the Element Details tab in the Expression Set Builder.

● Make sure that the REC_MNTH_STD_PRC and OT_STD_PRC variables are configured
with the type Currency in the expression set.

● Check that the expression set is activated.

Pricing Plan Step

● Verify that all data input is spelled correctly and has proper spacing.

● Make sure each step is active.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 54


Advanced Pricing
Exercise Guide

Exercise 9-2: Create Loyalty Pricing


Scenario
The marketing manager realizes the importance of retaining existing customers, as well as
bringing in new customers, and wants to implement a customer loyalty program that
rewards purchasing behavior. By implementing a loyalty program, Infiwave wants to send a
message that they are interested in a relationship with their current and future customers.
Eliza needs to enable and set up loyalty pricing, so customers can pay for products with
loyalty points.

Goals
● Explain how to set up loyalty pricing
● Pay for a product using loyalty points

Tasks
1. Enable loyalty pricing
2. Create pricing elements for loyalty point charges
3. Assign loyalty pricing to products
4. Refresh the cache
5. Create orders using loyalty pricing

Time: 10 mins

© Copyright 2022 Salesforce.com, inc. All rights reserved. 55


Advanced Pricing
Exercise Guide

Loyalty Pricing

Loyalty pricing allows customers to pay for any product with loyalty points using their loyalty
credits. Once loyalty pricing is enabled, the following are available out of the box:

● One Time Loyalty pricing variable to set the one-time price type.

● Pricing variable with pricing variable bindings to ensure the correct calculation of
each line item in the Cart.

● Additional columns for the Cart to display the one-time loyalty price and one-time
loyalty total for each line item.

● Loyalty points total on the Cart’s total bar.

Industries CPQ provides the ability to pay for an item in currency or loyalty points.
Administering and managing point balances is handled by an external back office system.

Creating Pricing Elements for Loyalty Pricing

Pricing elements are stored within their respective price lists. When you create price list
entries for products that have charges in loyalty points, you must have existing pricing
elements that contain those charges.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 56


Advanced Pricing
Exercise Guide

© Copyright 2022 Salesforce.com, inc. All rights reserved. 57


Advanced Pricing
Exercise Guide

Task 1: Enable loyalty pricing

1. Navigate to the Vlocity CMT Administration tab. You may need to click the More
dropdown menu to expand for additional tabs.

2. Under Custom Settings, click Enable Features.

3. Next to Loyalty, click the button currently set to Disabled.

4. The Enable Loyalty dialog window opens, click Enable.

5. Click OK to the message that the feature has been enabled successfully.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 58


Advanced Pricing
Exercise Guide

Task 2: Create pricing elements for loyalty point charges

1. Navigate to the Vlocity Product Console.

2. Next to Price List in the Pricing area, click the search icon .

3. In the Search Price List… dialog box, enter B2C and click the search icon.

4. Click the Edit icon next to the B2C Price List.

5. Click on the Pricing Elements facet.

6. Click New.

7. Select the following data for the Pricing Variable fields:


Field Value

Charge Type One-time

Sub-Type Standard

8. Click Search and select One Time Loyalty.

9. Enter the following data for the General Properties fields:


Field Value

Name 500 OT

Code LP-500-OT

Display Text LP-500-OT

10. Enter the following data for the Loyalty Value fields:
Field Value

Loyalty Amount 500

Loyalty Code PTS

© Copyright 2022 Salesforce.com, inc. All rights reserved. 59


Advanced Pricing
Exercise Guide

11. Enter the following data for the Effectivity fields:


Field Value

Effective From [today’s date]

Active ✔

12. Click Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 60


Advanced Pricing
Exercise Guide

Task 3: Assign loyalty pricing to products

1. Navigate to the Vlocity Product Console.


2. Next to Product in the Product Management area, click the search icon .

3. In the Search Product… dialog box, enter Samsung and click the search icon.

4. Click the Edit icon next to the Samsung Fast Charge Wireless Charging Stand.

5. Click on the Pricing facet for the product.

6. Click New from the CHARGES tab.

7. Enter the following data for the General Properties fields:


Field Value

Price List B2C Price List

Display Text 500 LP

Base Price ✔

8. Select the following data for the Pricing Variable fields:


Field Value

Charge Type One-time

Sub-Type Standard

9. Click Search and select One Time Loyalty.

10. Select 500 OT for the Pricing Element.

11. Enter the following data for the Effectivity fields:


Field Value

Effective From [today’s date]

Active ✔

12. Click Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 61


Advanced Pricing
Exercise Guide

© Copyright 2022 Salesforce.com, inc. All rights reserved. 62


Advanced Pricing
Exercise Guide

NOTE:
This task is required as a one-time setup due to enabling the Loyalty Pricing
feature and creating price list entries for loyalty pricing in a new training
playground. Refreshing the platform cache will not be required when creating
additional price list entries to be used with loyalty pricing.

Task 4: Refresh the cache

1. Navigate to the Vlocity CMT Administration tab. You may need to click the More
dropdown menu to expand for additional tabs.

2. Under Admin Console, click Maintenance Jobs.

3. For the job Clear Managed Platform Cache, click Start and OK.

4. For the job Refresh Platform Cache, click Start and OK.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 63


Advanced Pricing
Exercise Guide

Task 5: Create orders using loyalty pricing

1. Navigate to the Orders tab and click New.

2. On the New Order, enter the following:


Field Value

Order Name Loyalty Pricing Order

Account Name White, Noah

Order Start Date [today’s date]

Price List B2C Price List

3. Click Save.

4. Click on the Power Launcher’s search field and select Configure Order.

5. Search for the product Samsung.

6. For the Samsung Fast Charge Wireless Charging Stand notice the List Price is now
$49.99 or 500 LP.

7. Change the Payment Choice in the header to Loyalty.

8. Add the Samsung Fast Charge Wireless Charging Stand to the Cart. Notice the One
Time Loyalty Price column is 500 PTS.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 64


Advanced Pricing
Exercise Guide

9. Click the One Time Loyalty Price link and select the Payment Type button to open
the Payment Choice dialog box.

10. Change the Payment Choice to Currency and click Apply.

11. Notice the One Time Loyalty Price is now 0 PTS and the One Time Charge is $49.99.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 65


Advanced Pricing
Exercise Guide

12. Change the Payment Choice back to Loyalty from the One Time Loyalty Price or One
Time Charge links and click Apply.

13. Click Submit Order.

14. Click Next.

15. Notice the asset is priced according to the loyalty points.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 66


Advanced Pricing
Exercise Guide

Exercise 9-3: Work with Repricing


Scenario
Infiwave needs the ability to reprice products based on competition, supply and demand,
market value and consumer interest. Eliza realizes the importance of staying competitive
with the competition and informs management about the automatic repricing feature. Eliza
knows that all Platinum customers are to receive special pricing on the Blast! Pro Internet
product but learns that Acme is no longer a Platinum customer. Eliza needs to reprice the
Blast! Pro Internet asset on Acme’s account.

Goal
● Describe how to use repricing to reprice order line items and assets
● Explain how repricing adheres to context rules and effectivity dates on price list
entries
● Explain how to invoke the repricing service

Tasks
1. Activate the RepricingElementServiceImplementation
2. Reprise order line items to reflect a price effectivity change
3. Reprice an asset to reflect a context rule condition for an account

Time: 20 mins

© Copyright 2022 Salesforce.com, inc. All rights reserved. 67


Advanced Pricing
Exercise Guide

Repricing

Repricing allows you to reprice line items in opportunities, orders, quotes, and assets as
needed by your business operations. You can use repricing to support products with prices
that fluctuate over time, like natural resources, or products that are priced based on usage
or currency exchange rates.

Repricing is done as a background process across one or more records. During repricing,
prices are evaluated to ensure that they still apply based upon the effectivity dates of the
price list entry for the product or the applied promotion. In addition, rules are re-run to
ensure that the line items still meet the criteria for any context rules applied to the price list
entry. Context rules for any manual adjustments can also be re-run to ensure that they are
still valid. If the manual adjustment is no longer valid, the pricing for that line item reverts
back to original pricing. Any price list entries that do not have a current effectivity date yields
no change when repricing is run.

There are two different implementations available in the RepricingInterface:

● DefaultRepricingImplementation: will not make any changes to the existing prices.

● RepricingElementServiceImplementation: will reprice line items or parent objects


of the line items (such as order line items or the order header) based on the price list
entry effectivity dates attached to the product or promotion at that point in time
when the repricing service is run.

There is also the RepricingManAdjEligibilityInterface, which must have the


RepricingManualAdjEligibilityService implementation active to support repricing using
context rules for pricing adjustments.

When repricing, set the RepricingInterface implementation to


RepricingElementServiceImplementation. Repricing large updates in real time could cause
performance degradation to occur if not run via a batch job. Consider repricing in batches
with input parameters such as batch size or reprice provided line items only.

ALERT:
Repricing utilizes the RepricingElementServiceImplementation whereas
attribute-based pricing utilizes the PriclngPlanService implementation.
Therefore, repricing does not support attribute-based pricing.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 68


Advanced Pricing
Exercise Guide

Task 1: Activate the RepricingElementServiceImplementation

1. Navigate to the Interface Implementations tab.

2. Change the List Views to All.

3. Click on RepricingInterface.

4. Using the dropdown menu for RepricingElementServiceImplementation, click Edit.

5. Check the Active and Default checkboxes and click Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 69


Advanced Pricing
Exercise Guide

Task 2: Reprice order line items to reflect a price effectivity change

Due to changes in market conditions, the marketing team decides to lower the price of the
4G LTE Data Plan product starting on a certain date, and they want this new price to be
available to any orders that are still pending and have not been submitted for fulfilment. To
accomplish this, create a new price list entry and end-date the existing price list entry. Once
the price list entries are created and updated, run the repricing service in order to reflect the
new pricing on existing orders to ensure customers can take advantage of this new pricing.

Product Price List Entry Effectivity Start Date Effectivity End Date

4G LTE Data Plan $44.99 RM Jan 1, 2018 Jan 14, 2018

4G LTE Data Plan $34.99 RM Jan 15, 2018

Product Order Date Price in cart

4G LTE Data Plan Jan 15, 2018 $44.99


$34.99

© Copyright 2022 Salesforce.com, inc. All rights reserved. 70


Advanced Pricing
Exercise Guide

1. Create a new price list entry and end-date an existing price list entry.

a. Navigate to the Vlocity Product Console.


b. Next to Product in the Product Management area, click the search icon .
c. In the Search Product… dialog box, press the return or enter key to display
the list of products.
d. Click on the 4G LTE Data Plan.
e. Click on the Pricing facet.
f. Click New on the CHARGES tab to create a new price list entry.
g. Enter the following data for the Price List Entry fields:
Field Value

Price List B2C Price List

Display Text $24.99

Base Price ✔

Charge Type Recurring

Frequency Monthly

Sub-Type Standard

h. Click Search and select Recurring Monthly Std Price.


i. Select $24.99 RM for the Pricing Element.
j. Enter the following data for the Effectivity fields:
Field Value

Effective From [today’s date]

Active ✔

© Copyright 2022 Salesforce.com, inc. All rights reserved. 71


Advanced Pricing
Exercise Guide

© Copyright 2022 Salesforce.com, inc. All rights reserved. 72


Advanced Pricing
Exercise Guide

k. Click Save. Notice the WARNING, you currently have two price list entries that
overlap.

l. Click the X to close the Warning message.

m. Click the Edit icon to modify the $34.99 RM price list entry.

n. Enter the following data for the Effectivity fields:


Field Value

Effective Until [yesterday’s date]

o. Click Save.
p. Notice the WARNING, you currently have two price list entries that overlap.
q. Click the X to close the Warning message.

2. Review an existing order for the 4G LTE Data Plan product.


a. Navigate to the Orders tab.
b. Change the List Views to All Orders.
c. Select the Adv Pricing Data Plan Order.
d. From the URL, copy the OrderId from after the Order/ and before /view and
paste it to a text editor. You will need this Id for the Apex code when repricing
the order.

e. Click on the Power Launcher’s search field and select Configure Order.

f. Notice the Recurring Charge is $34.99.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 73


Advanced Pricing
Exercise Guide

g. Run the repricing service on orders.

3. Navigate to the Setup icon and select Developer Console.

a. From the Developer Console, click Debug > Open Execute Anonymous
Window.
b. The following Apex code will be used to reprice the Adv Pricing Data Plan
Order. Copy this code and paste it in the Enter Apex Code box from the
Developer Console.
Apex Code

List<Order> a = [SELECT Id FROM Order WHERE Id


='8015A0000030vYvQAI'];
Map<String,Object> repricingInput = new
Map<String,Object>{'objectList' => a};
Map<String,Object> repricingOutput = new Map<String,Object>();
Map<String,Object> repricingOptions = new Map<String,Object>();
vlocity_cmt.VOIInvoker voi =
vlocity_cmt.VOIInvoker.getInstance();

© Copyright 2022 Salesforce.com, inc. All rights reserved. 74


Advanced Pricing
Exercise Guide

voi.invoke('Repricing', 'repriceLineItems', repricingInput,


repricingOutput, repricingOptions);

ALERT:
You will replace the OrderId in the Apex code with the OrderId from your
training playground. The OrderId used in this example will not be the same in
your environment.

c. Copy the OrderId from your text editor and paste it over the OrderId in the
Apex code in Line 1.

d. Select the code and click Execute Highlighted.


e. Verify the status is Success in the logs by clicking the Logs option in the
bottom window.

4. Review the repriced order.

a. Navigate back to the tab where the 4G LTE Data Plan is in the cart for the Adv
Pricing Data Plan Order.
b. Refresh the browser page.
c. Notice the Recurring Charge is now $24.99 from the new price list entry.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 75


Advanced Pricing
Exercise Guide

© Copyright 2022 Salesforce.com, inc. All rights reserved. 76


Advanced Pricing
Exercise Guide

Task 3: Reprice an asset to reflect a context rule condition for an


account

1. Review Blast! Pro Internet price list entries.

a. Navigate to the Vlocity Product Console.


b. Next to Product in the Product Management area, click the search icon .
c. In the Search Product… dialog box, enter Blast! and click the search icon.
d. Select the Blast! Pro Internet product and click on the Pricing facet.
e. Notice the pricing for both price list entries. The $20 RM price list has a
context rule attached to the price list entry giving Platinum account
customers a reduced price on the product.

2. Review Acme’s Platinum SLA account status.

a. Navigate to the Accounts tab.


b. Change the List Views to All Accounts.
c. Select Acme.
d. Click on the Details tab.
e. Notice the SLA is set to Platinum.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 77


Advanced Pricing
Exercise Guide

3. Review an existing asset that was discounted based on the account’s SLA status.

a. Using the Lightning App Launcher, select Assets and open in a new tab.
b. Change the List Views to All Assets.
c. Select Blast! Pro Internet for Acme.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 78


Advanced Pricing
Exercise Guide

d. On the Details tab notice the Recurring Charge for the asset is $20 according
to the context rule for platinum accounts.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 79


Advanced Pricing
Exercise Guide

4. Change Acme’s SLA status to Gold.

a. Navigate back to the open browser tab for Acme.


b. Click on the Edit icon to change the SLA to Gold.
c. Click Save.
d. From the URL, copy the Account Id from after the Account/ and before /view
and paste it to a text editor. You will need this Id for the Apex code for
repricing accounts.

5. Run the repricing service on assets.

a. Navigate to the Setup icon and select Developer Console.


b. From the Developer Console, click Debug > Open Execute Anonymous
Window.
c. The following Apex code will be used to reprice the Blast! Pro Internet asset
on Acme’s account. Copy the below Apex code and paste it in the Enter Apex
Code box from the Developer Console.
Apex Code

List<Account> a = [SELECT Id FROM Account WHERE


Id='0011I00000DBYUK'];
Map<String,Object> repricingInput = new
Map<String,Object>{'objectList' => a};
Map<String,Object> repricingOutput = new
Map<String,Object>();
Map<String,Object> repricingOptions = new
Map<String,Object>();
vlocity_cmt.VOIInvoker voi =
vlocity_cmt.VOIInvoker.getInstance();
voi.invoke('Repricing', 'repriceLineItems',
repricingInput, repricingOutput, repricingOptions);

d. In line 1, replace the Account Id currently in the code with the Account Id
copied from Acme’s account.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 80


Advanced Pricing
Exercise Guide

e. Select the code and click Execute Highlighted.


f. Verify the status is Success in the logs.

6. Review the repriced asset.

a. Navigate back to the open Asset browser tab.


b. Refresh the browser page.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 81


Advanced Pricing
Exercise Guide

c. Notice the Recurring Charge for the asset is now $25 according to the price
list entry for all customers other than Platinum.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 82


Advanced Pricing
Exercise Guide

Exercise 9-4: Create a Pricing Hook


Scenario
Management has come to Eliza with the requirement that they’d like the ability to price
products in the Cart based on a customer’s billing zip code. Eliza knows she can price
products based on their attributes using attribute-based pricing but using the customer’s
billing zip code has her stumped. Eliza scratches her head wondering how this can be
accomplished. In Eliza’s research, she comes across the topic in software development
called a hook. This is the answer to Eliza’s dilemma. Using a hook, she can modify the
pricing behavior in the cart without changing the underlying programming code. Eliza
saddles up to the challenge and starts by mapping out the steps required to fulfill
management’s request.

Goal
● Explain what a hook is used for
● Describe how to implement a pricing hook
● Explain how to modify the Cart to display a custom field

Tasks
1. Review the billing zip code custom field
2. Create an attribute pricing matrix for billing zip code
3. Create an attribute pricing procedure expression set for billing zip code
4. Create a custom pricing plan step for billing zip code
5. Create a new Apex class
6. Create the CpqAppHandlerHookImplementation
7. Add a new column to the Cart
8. Add billing zip code as a custom field in the Cart
9. Test in the Cart

Time: 60 mins

© Copyright 2022 Salesforce.com, inc. All rights reserved. 83


Advanced Pricing
Exercise Guide

What is an Event Hook?

In software development, hooking is a concept that allows you to modify the original
behavior of the application without changing your code. By intercepting the commands,
you can change the action that would have been performed originally. It is very useful in the
case of adding new functionality to applications, exposing additional fields in pricing
calculations or altering how products are priced, to name a few of its applications.

How can I use an event hook in Industries CPQ?

Industries CPQ allows you to write custom Pre-invoke and Post-invoke hooks for each
interface to implement custom logic. Pre-invoke hooks get executed before the actual
interface is executed whereas Post-invoke hooks get executed after the actual interface is
executed.

In Industries CPQ, CPQ functionality is managed by a global interface called


CpqAppHandler. It includes a wide range of methods to perform CPQ processes in the Cart.
(These methods are also available as a RESTful API, called the Cart-based APIs.) So, when
you need to change the default behavior or processing of a CPQ operation, you create a
custom implementation in CpqAppHandler’s hook interface, which is appropriately named
CpqAppHandlerHook.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 84


Advanced Pricing
Exercise Guide

The CpqAppHandlerHook can be used on inputs and outputs of the CPQ methods to:

● Add, change, or delete input parameters.


● Add, change, or delete output responses.
● Debug issues by verifying the input and output are correct.
● In some cases, provide a workaround when waiting for a patch for an issue.

In addition, you can add business logic such as:

● Conditional processing.
● Preload information that will be used further down the execution chain.
● Process custom fields.
● Implement custom functionality.
● Do callouts.

How is the CpqAppHandlerHook invoked?

The CpqAppHandlerHook is automatically invoked when the InvokeService is called. The


InvokeService simply appends a hook string, e.g., “Hook”, to the interface name and
determines if there is an active interface with that name. If there is, the InvokeService will
initiate the active implementation in the hook interface. Then, it will add a .preInvoke suffix
to the method name and invoke the PreInvoke method in the hook implementation. A
corresponding .postInvoke method is invoked on the hook implementation after the
hooked class method has completed its processing.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 85


Advanced Pricing
Exercise Guide

The graphic below provides an example of the sequence when using a


CpqAppHandlerHook.

What do I need to look out for when using a hook?

Injecting custom code is powerful when executed correctly, but you also need to be aware
of the ramifications if executed poorly. Salesforce recommends the following when
implementing a hook:

● Validate that a feature doesn’t already exist that addresses your need for a hook.

● Ensure the custom code in the hook does not cause the execution to exceed any
Apex governor limits.

● Put a try-catch around the hook code to catch any exceptions thrown by the custom
code.

● When unit testing the hook code, it may be possible to mock the inputs expected by
the hook code to minimize test setup and get better code coverage. Use
Test.isRunningTest() to extract the mock input from the inputMap or from a static
map.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 86


Advanced Pricing
Exercise Guide

Examples of using a hook

Let’s look at an example based on the following business requirement:

Users must not be allowed to order the same product more than once in the same order.
And, check to see if the product exists as an active asset on the account.

Solution using a hook:

● Implement a CpqAppHandlerHook to check before postCartsItems logic runs to see


if the product exists in other active line items or active assets.

● In the Preinvoke hook, if the product exists in active line items or assets, null the
items and create a new node that will be checked in the post-hook.

● In the Postinvoke hook, if the new node exists, display an error in the UI.

● When the user tries to add a duplicate product, they will get an error in the cart.

Let’s take a look at another example. Consider how pricing works in the Cart. You add an
iPhone X to the cart. It displays a one-time charge of $1000. That’s all good, but as a
customer I want to know the total price of the iPhone X, which includes the sales tax cost.
How can I display the cost of the iPhone X plus applicable taxes in the one-time charge
column in the Cart? You would do this by implementing a pricing hook to alter how the
pricing is calculated. Instead of calculating Quantity*Price and displaying the price in the
One Time Charge column, you would create a pricing hook to calculate the One Time
Charge as Quantity*Price*Sales Tax Rate. What if I didn’t want to include the sales tax in the
one-time charge column, but rather wanted to display it as a separate column? No problem,
you can modify the cart to display a custom field for the applicable sales tax.

In this exercise, we will price products using the account’s zip code. This would allow you to
vary pricing for each line item based on the customer’s location, such as the billing or
shipping location. To do this, we must add a custom field to store the zip code on each
order line item, and then use attribute-based pricing to calculate the price for each zip
code. However, the pricing service has no idea that this new field exists. So, we also must
use a pricing hook to alert the pricing service to the existence of this new field and ensure
that it is passed in the input map to attribute-based pricing. Then, as the icing on the cake,
we’ll also expose the custom field (Billing Zip Code) in the Cart, so the user can see the
values that affect the price of the line item.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 87


Advanced Pricing
Exercise Guide

Task 1: Review the billing zip code custom field


In your training playground we have created a custom field, Billing Zip Code, on the Order
Product. The Billing Zip Code field will be used throughout this exercise, so we need to be
familiar with its setup.

1. Go to Setup and click Object Manager.

2. In the Quick Find box, type Order Product.

3. Under Label, click Order Product.

4. Click Fields & Relationships from the navigation pane on the left.

5. Click Billing Zip Code.

Billing_Zip_Code__c
6. Make a notation of the API name, here ______________________________.

Value(Order.Account.BillingPostalCode)
7. Make a notation of the formula, here _________________________________.

8. Close the Setup browser tab.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 88


Advanced Pricing
Exercise Guide

Task 2: Create an attribute pricing matrix for billing zip code

In this task, Eliza needs to create an attribute pricing matrix for all US billing zip codes.

1. Using the Lightning App Launcher in the upper left, search for and click Files.

2. Locate the BillingZipCodeAttributePricingMatrix v2.csv file.

3. Click the drop-down menu on the BillingZipCodeAttributePricingMatrix v2 line and


select Download.

4. Navigate to the Lookup Tables tab. You may need to reopen it using the Lightning
App Launcher.

5. Click New.

6. Select Decision Matrix and click Next.

7. In the New Decision Matrix dialog box, type


BillingZipCodeAttributePricingMatrix for the Name.

8. Select Standard for the Type.

9. Click Save.

10. On the Related tab, select BillingZipCodeAttributePricingMatrix V1.

11. Click Upload CSV File.

12. In the dialog box that appears, select Upload Files.

13. Select the downloaded .csv file and click Open.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 89


Advanced Pricing
Exercise Guide

14. Edit the Header Information with the following and click Upload:

Column Header Data Type Header Type


SourceProductName Text Input

SourceProductCode Text Input

CharacteristicName Text Input

CharacteristicValue Text Input

Billing_Zip_Code__c Text Input

MRC Currency Output

NRC Currency Output

15. Click Done and wait for the file upload to process. Click Refresh, if necessary.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 90


Advanced Pricing
Exercise Guide

16. In the BillingZipCodeAttributePricing V1 header, click Edit.

17. Check the Enabled checkbox and select Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 91


Advanced Pricing
Exercise Guide

Task 3: Create an attribute pricing procedure expression set for billing


zip code

In this task, Eliza needs to create an attribute pricing procedure so that product pricing is
calculated based on the Billing Zip Code attribute pricing matrix.

1. Navigate to the Expression Sets tab. You may need to reopen it using the Lightning
App Launcher.

2. Click New.

3. Type BillingZipCodeAttributePricingProcedure for the Name.

4. Click Save.

5. Click the Related tab, and select Edit from the dropdown arrow next to
BillingZipCodeAttributePricingProcedure V1.

6. In the Rank field, enter 1 and click Save.

7. Click BillingZipCodeAttributePricingProcedure V1.

8. Select Open in Expression Set Builder in the upper right.

9. In the Expression Set Builder window, click the plus + sign.

10. In the Add Element dialog box, select Lookup Table.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 92


Advanced Pricing
Exercise Guide

11. In the Lookup Table Details field, search for and select
BillingZipCodeAttributePricingMatrix.

12. Click the Element Details tab and select the Include in Output checkbox.

13. Select the Resource Manager tab and click Add Resource.

14. Enter the following information to create the recurring monthly standard price
variable and click Done and New:

Field Entry

Resource Type Variable

Resource Name REC_MNTH_STD_PRC

Data Type Currency

Decimal 2

15. Enter the following information to create the one-time standard price variable and
click Done:

Field Entry

Resource Type Variable

Resource Name OT_STD_PRC

Data Type Currency

Decimal 2

16. Click the plus + sign and select Calculation from the Add Element dialog.

17. In the Formula field, search for and select


BillingZipCodeAttributePricingMatrix__MRC.

18. In the Output Variable field, search for and select REC_MNTH_STD_PRC.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 93


Advanced Pricing
Exercise Guide

19. With the Calculation element selected, click the Element Details tab and select
the Include in Output checkbox.

20. Click the plus + sign and select Calculation from the Add Element dialog.

21. In the Formula field, search for and select


BillingZipCodeAttributePricingMatrix__NRC.

22. In the Output Variable field, search for and select OT_STD_PRC.

23. With the Calculation element selected, click the Element Details tab and select
the Include in Output checkbox.

24. Click Save and then select Activate in the top menu.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 94


Advanced Pricing
Exercise Guide

Task 4: Create a custom pricing plan step for billing zip code

In this task, Eliza needs to add a pricing plan step to the Default Pricing Plan so that
products in the Cart are priced according to the Billing Zip Code Attribute Pricing Procedure
and Matrix.

1. Navigate to the Vlocity Product Console.


2. Next to Pricing Plan in the Pricing area, click the search icon .

3. In the Search Pricing Plan… dialog box, press the return or enter key to display the
Default Pricing Plan.

4. Click on the Default Pricing Plan.

5. Click on the Pricing Plan Steps facet.

6. Click New Item.

7. Enter the following data in the General Properties pane:

Field Entry

Name Calculate Billing Zip Code Attribute


Pricing

Implementation Name CustomPricingPlanStepImpl

Method Name GetMatrixPrice

Sequence 9

Active ✔

© Copyright 2022 Salesforce.com, inc. All rights reserved. 95


Advanced Pricing
Exercise Guide

8. Add the following parameters to the step:

First Box Second Box

ProcedureName BillingZipCodeAttributePricingP
rocedure

MatrixName BillingZipCodeAttributePricingM
atrix

RangeFields Billing_Zip_Code__c

DecisionMatrix true

IncludeAttrInfoInRangeKeys false

9. Select Done and then select Save.

10. Run the Clear Managed Platform Cache and Refresh Platform Cache maintenance
jobs in CMT Administration.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 96


Advanced Pricing
Exercise Guide

Task 5: Create a new Apex class

In this task, Eliza needs to create a new Apex class to inject logic for the new custom field –
Billing Zip Code. Without this logic the new custom field will not populate.

1. Using the Lightning App Launcher in the upper left, click Files.

2. Locate the CpqAppHandlerHookImplementation file by navigating to Libraries ->


Advanced CPQ -> Advanced Pricing.

NOTE:
The CpqAppHandlerHookImplementation is an Apex Class that has been
written for this lab exercise.

3. Click the drop-down menu on the CpqAppHandlerHookImplementation line and


select Download.

4. Navigate to the Setup icon and select Developer Console.

5. From the Developer Console, click File > New > Apex Class.

6. Name the Apex Class CpqAppHandlerHookImplementation and click OK.

7. Open the downloaded file and copy the Apex Class code.

8. Paste the code in the Enter Apex Code box. You will have 48 lines of code.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 97


Advanced Pricing
Exercise Guide

9. Click File > Save.

10. Review line 12. Note the String customFields API here, ____________________.

11. Close the Developer Console.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 98


Advanced Pricing
Exercise Guide

Task 6: Create the CpqAppHandlerHookImplementation

In this task, Eliza needs to create the interface implementation hook. The hook interface
provides a hook to the implementation method for pre-invoke and post-invoke handling.

1. Navigate to the Interface Implementations tab in the Configure Price Quote (CPQ)
app.

2. Click New.

3. In the Interface Name field, type CpqAppHandlerHook.

NOTE:
The maximum length for a hook interface name is 36 characters.

4. In the Active Implementation Class field, type


CpqAppHandlerHookImplementation.

5. Click Save.

6. From the Related tab, click New next to Interface Implementation Detail (0).

7. In the New Interface Implementation Detail window, type


CpqAppHandlerHookImplementation in the Available Implementation field.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 99


Advanced Pricing
Exercise Guide

8. Check the Active and Default box and click Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 100


Advanced Pricing
Exercise Guide

Task 7: Add a new column to the Cart

In this task, Eliza needs to modify the default CPQ product cart so that the new field –
Billing Zip Code – displays as a column in the Cart.

1. Using the Lightning App Launcher in the upper left, search for the Vlocity Cards app.
Two options appear. Choose the second Vlocity Cards app to open the Omnistudio
Layouts & Cards app. Verify you have opened the correct app by checking to see if
Omnistudio is listed in the header.

2. In the Find in page field, enter cpq-product.

3. Expand cpq-product-cart and select Version 4.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 101


Advanced Pricing
Exercise Guide

4. In the LAYOUT pane, scroll down to the DATA SOURCE section. Notice the selection
is Dual. This means that the API query will be performed using Apex when running
on a desktop, while a REST call will be performed while running on a mobile.

5. Notice the Remote Class, Remote Method and fields under the Desktop
ApexRemote Config section. The CPQ API CpqAppHandler.getCartItems returns all
products currently in the cart. The fields parameter controls which fields are returned
in the API for each product.

6. Scroll back to the top of the LAYOUT pane and click Clone.

7. In the CLONE LAYOUT window, change the Layout Author to your name. Do NOT
change the Layout Name or Layout Type.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 102


Advanced Pricing
Exercise Guide

8. Click Clone.

9. After cloning the card layout, it should contain an active card called
cpq-product-cart-item.

10. Open the active cpq-product-cart-item card. You can ignore any inactive versions of
this card that may also display.

11. Click the Activate button to deactivate it.

12. Click the Clone Card icon.

13. In the CLONE CARD window, type cpq-product-cart-item as the Card Name.

14. Type your name for the Card Author.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 103


Advanced Pricing
Exercise Guide

15. Click Clone.

16. On the LAYOUT pane, navigate to the fields parameter from the Input Map. This is a
comma-separated list of product fields that will be queried as part of the API call to
getCartItems( ). We need to append this list of fields to include the Billing Zip Code
custom field.

17. In the box next to fields, scroll to the end of the list to enter the following:
,Billing_Zip_Code__c. You must precede the custom field name with a comma.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 104


Advanced Pricing
Exercise Guide

18. On the LAYOUT pane, navigate to the Mobile Hybrid ApexRest Config Endpoint
field, expand the field, and type the following: ,Billing_Zip_Code__c.
Remember, you must precede the custom field name with a comma.

19. Remember, the DATA SOURCE field is Dual. If you want the new column to be
added to mobile versions of the CPQ cart you need to add the field to the Endpoint
under Mobile Hybrid ApexRest Config.

20. Make sure you have the correct cpq-product-cart-item card selected. It will be the
one with your name as the Author.

21. If you have enabled Loyalty Pricing, select


CustomView_CPQAdvancedPricingLoyalty in the STATES pane. Otherwise, select
CustomView_CPQAdvancedPricing.

22. In the blank Fields box, select <<Custom Field>> and click Add.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 105


Advanced Pricing
Exercise Guide

23. Delete <<Custom Field>> and replace it with the following:

Name Label

['Billing_Zip_Code__c']['value' ['Billing_Zip_Code__c']['label'
] ]

ALERT:
Do not perform a copy/paste fro­m the exercise guide. The Name and Label
field input must be entered exactly as displayed using straight quotes and no
spaces between brackets.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 106


Advanced Pricing
Exercise Guide

24. Click the Activate button on the CARDS and LAYOUT pane.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 107


Advanced Pricing
Exercise Guide

Task 8: Add billing zip code as a custom field in the Cart

In this task, Eliza needs to create a Field Setting so that getCartsItems (called when the cart
is loaded) and postCartsItems (called when you click Add to Cart) APIs return the Billing Zip
Code field and it displays in the Cart.

1. Go to Setup.

2. In the Quick Find box, type Custom Settings.

3. Click Custom Settings.

4. Click Manage next to Field Settings.

5. Click New.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 108


Advanced Pricing
Exercise Guide

6. Enter the following for the new Field Setting:

Field Value Notes

Name Billing_Zip_Code__c

Feature CPQV2 Links to the CPQ APIs

Field Name Billing_Zip_Code__c API name of the field

Inclusion ✔

Object Name OrderItem API name of the object

Sequence 1

7. Click Save.

8. Close the Setup browser tab.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 109


Advanced Pricing
Exercise Guide

Task 9: Test in the Cart

1. Navigate to the Orders tab and click New.

2. On the New Order dialog, enter the following:


Field Value

Order Name Adv Pricing Hooks Order

Account Name Acme

Order Start Date [Today’s date]

Price List B2B Price List

3. Click Save.

4. Click on the Power Launcher’s search field and select Configure Order.

5. Add the BeatsX Wireless Earphones to the cart.

6. In the One Time Charge column, click on the charge and select the Price Details

icon.

7. Notice that the price returned is from the BillingZipCodeAttributePricingProcedure


based on the data entered in the matrix.

8. Click Close.

9. Navigate to the Accounts tab and open link in new tab.

10. Change the List Views to All Accounts.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 110


Advanced Pricing
Exercise Guide

11. Click Acme.

12. Click on the Details tab.

13. Note the Billing Address zip code, here ­____________________.

14. Close the Accounts tab.

15. Notice the new Billing Zip Code column in the cart and the billing zip code returned
for Acme.

ALERT:
The custom field value can’t be null. If null, it will not be read and will not
display.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 111


Advanced Pricing
Exercise Guide

Troubleshooting Guide

Attribute-Based Pricing

Is the BeatsX Wireless Earphones product not displaying the correct price in the cart based
on the BillingZipCodeAttributePricingMatrix? Use the troubleshooting headings below to
assist in your evaluation.

BillingZipCodeAttributePricingMatrix (Lookup Table)

● Verify that all matrix headers are spelled correctly.

● Verify that all input/output data in the matrix has proper spacing, punctuation, and
correct spelling.

● Verify that the matrix is enabled and has the highest rank (1).

BillingZipCodeAttributePricingProcedure (Expression Set)

● Verify that the procedure is working using the Simulate button on the Vlocity
Procedure page.

● Verify all variables has proper spacing, punctuation and correct spelling

● Verify the calculation steps:

○ The Decision Matrix element is pointing to the


BillingZipCodeAttributePricingMatrix.

○ The Calculation elements are pointing to the MRC/NRC


BillingZipCodeAttributePricingMatrix outputs.

● Include in Output is checked for each element.

● The expression set is enabled.

Custom Billing Zip Code Pricing Plan Step

● Verify all data input is spelled correctly and has proper spacing

● Step is active

© Copyright 2022 Salesforce.com, inc. All rights reserved. 112


Advanced Pricing
Exercise Guide

Modifying the Cart


Is the Billing Zip Code column not displaying in the cart? Use the troubleshooting headings
below to assist in your evaluation.

Billing Zip Code Field Setting

● The API names are spelled correctly with proper punctuation.

● The correct CPQ API is linked.

Card Template

● Fields Input Map includes the Billing Zip Code custom field and is preceded with a
comma.

● Correct custom view State is selected on the card.

○ Loyalty Pricing enabled? Use the CustomView_CPQAdvancedPricingLoyalty


state.

○ Loyalty Pricing not enabled? Use the CustomView_CPQAdvancedPricing state.

● The layout and card are both activated.

● Have you verified all the above and the column still isn’t displaying? Try clearing your
browser cache.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 113


Advanced Pricing
Exercise Guide

Exercise 9-5: Create Usage Pricing


Scenario
Infiwave has decided to get into the business of providing energy to their B2B customers.
One of the big differences in quoting and selling energy products is that customers need to
see estimated prices for commodity products included in their quotes and orders. So,
before these B2B customers can purchase energy products, Eliza needs to enable the Usage
Pricing feature and configure its related components so that the estimated usage
consumption and price is calculated accurately and displayed in the Cart.

Goal
● Explain the concept of usage pricing
● Define how to configure usage pricing for products
● Use usage pricing in the Cart

Tasks
1. Enable usage pricing
2. Create charge measurements and assign usage pricing to products
3. Configure an attribute and an attribute binding for estimated usage quantity
4. Test usage pricing in the Cart
5. Configure attribute-based pricing for usage pricing
6. Edit an order to use attribute-based pricing

Time: 45 mins

© Copyright 2022 Salesforce.com, inc. All rights reserved. 114


Advanced Pricing
Exercise Guide

What is Usage Pricing?

Usage pricing is a type of pricing used when a customer is charged based on their usage
(consumption) of a product or service, such as water, gas or electricity. Typically, at the end
of a period (often, a billing cycle), a service provider collects information about actual
service consumption and calculates total charges for that period. Unlike fixed charges,
which are predefined, usage-based charges fluctuate from period to period. Then, the
customer is charged for their actual usage by the billing system.

This makes sense when you’re talking about services that are installed and already sold to a
customer. Most of us have experienced this type of pricing as home or business owners. But
things get more complicated when you think about how to price and sell these services
before they’re installed—because the usage or consumption hasn’t happened yet! So, during
quoting and order capture, you need a way to estimate usage, so you have a defined price
that you can share and discuss with your customer.

In Industries CPQ, usage pricing provides the ability to price a product or service during
quoting and order capture based on an estimate of usage.

It’s important to understand that the customer may not be charged the estimated usage
price that displays in the quote or order. Instead, that information can be shared with the
customer to help them understand the price they may pay in the future, or it can be used in
contracts to lock in a rate for a set period of time. (Note that administering and billing
actual usage is handled by an external back office system.)

Some of the most typical use cases for usage pricing are:

● Long-distance call charges depending on the destination country and call duration.

● Internet data overage charges when a service provider charges for each gigabyte
over a certain threshold.

● Cloud backup service proportional to the total volume of backups.

● Cloud computing charges based on the total time of resources being used.

● Utility services, including commodities like electricity, gas, or water.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 115


Advanced Pricing
Exercise Guide

Eliza has been asked to create pricing for a fixed rate electricity product. Just like it sounds,
this product provides customers with a fixed rate for electricity for the length of their plan,
even if electricity prices fluctuate in the market. Sounds great, right? The tricky part is that
the price must be based on past usage or consumption data for their location, and it must
include a component for electricity as a commodity and also a standing charge for service
to the house or location.

So, Eliza creates a new Fixed Energy product bundle that contains two child products, Unit
Rate and Standing Charges. The Unit Rate product represents the rate that the customer will
pay for electricity based on their estimated usage, and the Standing Charges represent the
standard fee to supply the location (or service point) with electricity service.

At the completion of this exercise, you’ll be able to order the Fixed Energy product in the
Cart with a calculated usage price based on an estimate as shown below. The calculation
will multiply the Estimated Usage Quantity by the Usage Price for each product to get a
Usage Price Total amount, which then will be rolled up the product hierarchy to get a total
for the product bundle. We’ll also implement attribute-based pricing to make the Usage
Price for each child product variable based on Distribution Region and Payment Method
using attribute-based pricing.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 116


Advanced Pricing
Exercise Guide

ALERT:
Several elements, such as object types, attribute categories, attributes,
picklists, and products, have been pre-configured in your training playground
to expedite the usage pricing exercise. In a sandbox or production
environment, the setup of these elements would have been done in
conjunction with the decision to enable usage pricing.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 117


Advanced Pricing
Exercise Guide

Task 1: Enable usage pricing

Eliza’s first task at hand is enabling the usage pricing feature so that B2B customers can
purchase energy products. Under the hood, there are a number of activities occurring to
ensure the feature is set up correctly, so you don’t have to. Once enabled, usage pricing
variables and usage pricing variable bindings (we’ll learn about bindings later) are created.
In addition, usage pricing fields are available in the Cart and are used for calculations based
on the usage pricing variables defined. You’ll see all this in action when we create a usage
pricing order later in this exercise.

1. Navigate to the Vlocity CMT Administration tab. You may need to click the More
dropdown menu to expand for additional tabs.

2. Under Custom Settings, click Enable Features.

3. Next to Usage Pricing, click the button currently set to Disabled.

4. The Enable Usage Pricing dialog window opens, click Enable.

5. Click OK to the message that the feature has been enabled successfully.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 118


Advanced Pricing
Exercise Guide

Task 2: Create charge measurements and assign usage pricing to


products

What is a charge measurement?

Charge measurements describe units of measure that are used to price products or services
using usage pricing. For example, electricity can be measured in kilowatt hours (kWh). To
price based on electricity usage, you would need to create a charge measurement for
“kWh”.

So, in our scenario, Eliza needs to create two charge measurements, kWh and day. The kWh
charge measurement will be used with the Unit Rate product to price electricity usage, and
the day charge will be used with the Standing Charges product to price daily service charges.

1. Create charge measurements

a. Using the Lightning App Launcher, enter Charge Measurements in the


search box and click to select.
b. Click New on the Charge Measurement page.
c. Enter kWh for the Charge Measurement Name and click Save & New.
d. Enter day for the Charge Measurement Name and click Save.

Below you can see how the charge measurements you’ve just created will display in the
Cart.

Next, Eliza needs to create two pricing elements for the B2B price list that will be used to
create price list entries for the Unit Rate and Standing Charges products.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 119


Advanced Pricing
Exercise Guide

Creating pricing elements should be familiar to you as this topic was covered in earlier
modules. However, when creating pricing elements for usage pricing, you need to use a
special Charge Type: Usage Std Price. This allows you to specify a Usage Unit of Measure
(a.k.a. Charge Measurement). In this way, we can create one pricing element for the
electricity rate that will be priced using kWh and another pricing element for standing
charges that will be priced per day of service.

2. Create a pricing element for usage pricing charges

a. Navigate to the Vlocity Product Console.


b. Click on the search icon for Price List.
c. Search for the B2B Price List and select it.
d. Click on the Pricing Elements facet of the B2B Price List.
e. On the CHARGES tab, click New.
f. Enter the following to create a new Pricing Element and click Save:
Field Value Notes

Charge Type Usage

Search / Select a Pricing Usage Std Price Usage is a legacy variable


Variable: that should not be used.

Name $0.0123

Code U-0.0123

Display Text $0.0123/kWh

Usage Unit of Measure kWh

Amount 0.0123

Effective From [today’s date]

Active ✔

© Copyright 2022 Salesforce.com, inc. All rights reserved. 120


Advanced Pricing
Exercise Guide

g. Click New to create another pricing element.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 121


Advanced Pricing
Exercise Guide

h. Enter the following and click Save:


Field Value Notes

Charge Type Usage

Search / Select a Pricing Variable: Usage Std Price Usage is a


legacy variable
that should not
be used.

Name $0.87123

Code U-0.87123

Display Text $0.87123/day

Usage Unit of Measure day

Amount 0.87123

Effective From [today’s date]

Active ✔

Lastly, Eliza needs to create price list entries and assign usage pricing to two child products,
Unit Rate and Standing Charges. Creating price list entries should be familiar to you as this
topic was covered in earlier modules.

3. Create price list entries for usage pricing products

a. Navigate to the Vlocity Product Console.


b. Click on the search icon next to Product and search for Unit Rate to select it.
c. Click on the Pricing facet.
d. On the CHARGES tab, click New.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 122


Advanced Pricing
Exercise Guide

e. Enter the following on the PRICE LIST ENTRY tab and click Save:
Field Value

Price List B2B Price List

Display Text $0.0123/kWh

Base Price ✔

Charge Type Usage

Search / Select a Pricing Variable: Usage Std Price

Pricing Element $0.0123

Effective From [today’s date]

Active ✔

f. Search for the product Standing Charges from the Vlocity Product Console
and select it.
g. Click on the Pricing facet.
h. On the CHARGES tab, click New.
i. Enter the following on the PRICE LIST ENTRY tab and click Save:
Field Value

Price List B2B Price List

Display Text $0.87123/day

Base Price ✔

Charge Type Usage

Search / Select a Pricing Variable: Usage Std Price

Pricing Element $0.87123

Effective From [Today’s date]

Active ✔

© Copyright 2022 Salesforce.com, inc. All rights reserved. 123


Advanced Pricing
Exercise Guide

The screen capture below displays the price of the energy products (using attribute-based
pricing – we’ll get to that soon!) and the field name on the Order Product (OrderItem)
object in the Cart.

Now that Eliza has created charge measurements and pricing elements for usage pricing
and assigned a usage price list entry to each product, next she needs to configure the
variable element in the pricing calculation: Estimated Usage Quantity.

Estimated Usage Quantity will store the estimated amount of electricity the customer will
use, so that it can be used in the usage pricing calculations for the quote or order.
Remember that the Usage Price Total is calculated by multiplying the Usage Price by the
Estimated Usage Quantity. But notice that the estimated quantity has a double burden; not
only does it need to be visible and editable by users within the Cart, it also needs to be
included in the pricing engine’s calculations and rollups. To achieve this, Eliza will create an
attribute binding.

What is an attribute binding?

An attribute binding links an attribute to a field on an object, so that as you change the
attribute’s value in the Cart, it is also changed in the bound field.

ALERT:
Attribute bindings are a one-way street. You cannot change the bound field’s
value and have the new value populate the attribute’s value in the
JSONAttribute field. The attribute always drives the bound field—and not the
other way around.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 124


Advanced Pricing
Exercise Guide

Why is this useful?

Usually, it’s because you want to use the value in some kind of calculation or process. When
an attribute value is embedded within the JSONAttribute field, it’s very accessible to the end
users in the Cart, allowing them to change its value easily. But, as it turns out, it’s not very
accessible to any other processes! You can’t monitor its value and trigger a workflow from it,
for example. And importantly for our usage pricing scenario, the pricing engine can’t use
attribute values embedded in the JSONAttribute field for its calculations. They need to be
stored in a field on the line item.

So, in order to enable usage pricing, we must create an attribute binding to link the
attribute to a field, and then the field can be added to the pricing engine’s calculation logic
(via a pricing variable binding).

In our usage pricing scenario, we will bind the Estimated Usage Quantity to an existing field
that’s provided as part of the application, Usage Quantity
(vlocity_cmt__UsageQuantity__c) on the Order Product (OrderItem) object.

The steps to create an attribute binding are:

● Create the attribute.


● Create (or select) the field and object that will be bound to the attribute.
● Create a Vlocity Object to link the field’s object to the shared catalog’s metadata.
● Create the attribute binding to link the field to the attribute via the Vlocity Object.

Then, if you plan to use the attribute binding in pricing, you must also:

● Create a pricing variable binding to the bound field.

NOTE:
In our scenario, we will use an existing field that is already bound to an
out-of-the-box pricing variable, so essentially, it’s been done for us. But it’s
important to note that if you were using a custom field, this is a key step that
would need to be done.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 125


Advanced Pricing
Exercise Guide

What is a Vlocity Object?

You might have noticed in the steps above that you need to create a Vlocity Object as part
of creating an attribute binding, and naturally, you’re probably wondering what that is.

While Salesforce Industries has many objects that it has added to Salesforce’s data model,
there are some specific objects that the shared catalog considers its responsibility to
manage. These objects are called Vlocity Objects, and they can be viewed in the Vlocity
Objects and Object Types tab. You’ll recognize most of them because they are precisely the
objects you work with using the Product Console—objects like Product2, Attribute, Price List,
Rules, and so on. Vlocity Objects adds a layer of metadata around the object itself, and the
shared catalog uses the metadata to perform its functions.

So, when you create an attribute binding to a field on an object that is outside the shared
catalog’s “field of vision”, so to speak, you must also define the object as a Vlocity Object so
that the shared catalog knows about it. You only need to do this once for each object. In
our scenario, we need to do it for the Order Product (OrderItem) object, and then you
could create multiple attribute bindings to different fields on the Order Product object. If
we wanted to enable usage pricing during quoting, we’d need to also create a Vlocity Object
for the Quote Line Item (QuoteLineItem) object. And so on, for each object that has a
field for which you want to create an attribute binding.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 126


Advanced Pricing
Exercise Guide

Task 3: Configure an attribute and an attribute binding for estimated


usage quantity

1. Create an attribute.

a. Navigate to the Vlocity Product Console.


b. Click the + icon next to Attribute.
c. Enter the following and click Save:
Field Value

Name Estimated Usage Quantity

Code ATT_EST_USAGE_QTY

Active ✔

Attribute Category Usage Pricing

Value Type Number

2. Create a Vlocity Object for Order Product (OrderItem).

a. Using the Lightning App Launcher, enter Vlocity Objects and Object Types
in the search box and click to select.
b. Click New.
c. Select Object as the record type on the New Vlocity Object or Object Type
window and click Next.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 127


Advanced Pricing
Exercise Guide

d. Enter the following and click Save:


Field Entry

Name Order Product

Object API Name OrderItem

Mode Record Type

Parent Object Type Leave blank

Record Type Name OrderItem

e. Navigate to the Vlocity Product Console.


f. Click on the search icon next to Object in the Metadata section and search
for all objects.
g. Notice the Order Product object record that you just created.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 128


Advanced Pricing
Exercise Guide

Next, Eliza needs to bind the Estimated Usage Quantity attribute to the Usage Quantity field
on the Order Product (OrderItem) object.

3. Create an attribute binding.

a. Navigate to the Vlocity Attribute Categories tab. You may need to click the
More dropdown menu to expand for additional tabs.
b. Select List View All.
c. Select the Usage Pricing category.
d. Click on the Estimated Usage Quantity attribute.
e. Click on the Related tab and click New.
f. Enter the following to create a New Vlocity Attribute Binding:
Field Value

Attribute Binding Name Estimated Usage Quantity


Binding

Object Class Order Product

Field Name vlocity_cmt__UsageQuantity__c

© Copyright 2022 Salesforce.com, inc. All rights reserved. 129


Advanced Pricing
Exercise Guide

g. Click Save.

Lastly, Eliza will assign the bound attribute, Estimated Usage Quantity, to the Fixed Energy
child products, Unit Rate and Standing Charges.

4. Assign bound attribute to a product

a. Navigate to the Vlocity Product Console.


b. Click the search icon next to Product to search for the Unit Rate product and
select it.
c. Click on the Attributes and Fields facet.
d. Click on the Assign Attributes/Fields button. Check the box next to
Estimated Usage Quantity and click Assign.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 130


Advanced Pricing
Exercise Guide

e. Repeat these steps to assign the Estimated Usage Quantity attribute to the
product Standing Charges.

5. Review usage pricing variables

Remember earlier when we enabled the usage pricing feature and we mentioned
that several activities occur behind the scenes when features are enabled? Well,
when usage pricing was enabled, pricing variables for usage and usage pricing
variable bindings were created. You’ll notice that these usage pricing variable
bindings are similar to the attribute binding you just created.

a. Navigate to the Vlocity Product Console.


b. Click on the search icon for Pricing Variable.
c. Enter usage in the search box and click the search icon.
d. Notice the usage pricing variables created when usage pricing was enabled.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 131


Advanced Pricing
Exercise Guide

e. Click on the edit icon next to Usage Std Price and then click on the Pricing
Variable Bindings facet.
f. Notice the field binding associated with each sObject type.

The screen capture below displays the attribute (Estimated Usage Quantity) bound to the
vlocity_cmt__UsageQuantity__c field on the OrderItem object where the pricing engine
detects it and can perform calculations, based on the pricing variables defined, in the Cart.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 132


Advanced Pricing
Exercise Guide

Task 4: Test usage pricing in the Cart

1. Navigate to the Orders tab and click New.

2. On the New Order, enter the following and click Save.


Field Value

Order Name Energy Usage Pricing Order

Account Name Acme

Order Start Date [Today’s date]

Price List B2B Price List

3. Click on the Power Launcher’s search field and select Configure Order.

4. Add the Fixed Energy product to the cart.

5. Click the down arrow to Configure the Unit Rate order line item.

6. Enter 1000 for the Estimated Usage Quantity attribute. Close the Configure window.

7. Click the down arrow to Configure the Standing Charges order line item.

8. Enter 500 for the Estimated Usage Quantity attribute. Close the Configure window.

9. Notice how the pricing engine calculates the Usage Price Total from the bound
attribute and pricing variable bindings created.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 133


Advanced Pricing
Exercise Guide

NOTE:
If usage pricing doesn’t display or calculate correctly in the cart verify that you
have configured usage pricing correctly for each step. Then, run the
maintenance jobs -- Clear Managed Platform Cache and Refresh Platform
Cache.

In many Energy & Utilities deployments, usage pricing alone is not enough. The cost of
energy commodities fluctuates and will vary based on customers’ geographic location.
Therefore, in addition to usage pricing, Eliza needs to create a decision matrix to change the
usage price of the Unit Rate and Standing Charges products using attribute-based pricing.
And, in order to use attribute-based pricing with usage pricing, you need to extend
attribute-based pricing to work with new usage pricing variables.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 134


Advanced Pricing
Exercise Guide

Task 5: Configure attribute-based pricing for usage pricing

1. Create an attribute-based pricing matrix.


a. Using the Lightning App Launcher in the upper left, select Files.
b. Locate the UsagePricingMatrix v1.csv file.
c. Click the drop-down menu on the UsagePricingMatrix v1 line and select
Download.
d. Navigate to the Lookup Tables tab. You may need to reopen it using the
Lightning App Launcher.
e. Click New, select Decision Matrix, and click Next.
f. In the New Decision Matrix dialog box, type UsagePricingMatrix for the
Name, select Standard as Type, and click Save.
g. Click the Related tab and select UsagePricingMatrix V1.
h. Click Upload CSV Files.
i. In the dialog box that appears, select Upload Files.
j. Select the downloaded .csv file.
k. Edit the Header Information with the following and click Upload:

Column Header Data Type Header Type


SourceProductName Text Input

SourceProductCode Text Input

CharacteristicName Text Input

CharacteristicValue Text Input

MRC Currency Output

NRC Currency Output

UP Currency Output

CM Text Output

© Copyright 2022 Salesforce.com, inc. All rights reserved. 135


Advanced Pricing
Exercise Guide

l. Click Done and wait for the file upload to process. Click Refresh, if necessary.
m. Notice the following:
i. Products in the matrix, along with their attributes and values in the
Characteristic Name and Characteristic Value columns.
ii. UP column = usage pricing
iii. CM column = charge measurement

n. In the UsagePricingMatrix V1 header, click Edit.


o. Select yesterday’s date from the calendar icon for the Start Date Time / Date
field.
p. Check the Enabled checkbox and select Save.

Once the decision matrix is defined, Eliza then needs to create a usage pricing procedure
expression set so that the energy products assigned usage pricing are calculated based on
the UsagePricingMatrix.

2. Create an attribute pricing procedure expression set.

a. Navigate to the Expression Sets tab. You may need to reopen it using the
Lightning App Launcher.
b. Click New.
c. In the New Expression Set dialog box, enter UsagePricingProcedure for
the Name and click Save.
d. Click the Related tab and next to UsagePricingProcedure V1, click the

dropdown arrow and select Edit.

e. In the Rank field, enter 1.

f. Click the Start Date Time / Date field and select yesterday’s date from the
calendar, and select Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 136


Advanced Pricing
Exercise Guide

g. Select UsagePricingProcedure V1.


h. Click Open in Expression Set Builder.
i. Click the plus + sign and select Lookup Table in the Add Element dialog box.
j. In the Lookup Table Details field, search for and select UsagePricingMatrix.

k. With the Lookup Table element selected, click the Element Details tab in
the left panel, and check the Include in Output checkbox.

l. Click the Resource Manager tab and select Add Resource.

m. In the Add New Resource dialog, and enter the following:

Field Value

Resource Type Variable

Resource Name REC_MNTH_STD_PRC

Data Type Currency

Decimal 2

n. Click Done And New and enter the following:

Field Value

Resource Type Variable

Resource Name OT_STD_PRC

Data Type Currency

Decimal 2

© Copyright 2022 Salesforce.com, inc. All rights reserved. 137


Advanced Pricing
Exercise Guide

o. Click Done And New and enter the following:


Field Value

Resource Type Variable

Resource Name USAGE_STD_PRC

Data Type Currency

Decimal 5

p. Click Done And New and enter the following:


Field Value

Resource Type Variable

Resource Name CM

Data Type Text

q. Click Done.
r. Click the plus + sign and add a Calculation step to the expression set.
i. In the Formula field, search for and select UsagePricingMatrix__MRC.
ii. In the Output Variable, search for and select REC_MNTH_STD_PRC.

iii. Click the Element Details tab in the left panel, and check the
Include in Output checkbox.
s. Click the plus + sign and add a Calculation step to the expression set.
i. In the Formula field, search for and select UsagePricingMatrix__NRC.
ii. In the Output Variable, search for and select OT_STD_PRC.

iii. Click the Element Details tab in the left panel, and check the
Include in Output checkbox.
t. Click the plus + sign and add a Calculation step to the expression set.
i. In the Formula field, search for and select UsagePricingMatrix__UP.
ii. In the Output Variable, search for and select USAGE_STD_PRC.

iii. Click the Element Details tab in the left panel, and check the
Include in Output checkbox.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 138


Advanced Pricing
Exercise Guide

u. Click the plus + sign and add a Calculation step to the expression set.
i. In the Formula field, search for and select UsagePricingMatrix__CM.
ii. In the Output Variable, search for and select CM.

iii. Click the Element Details tab in the left panel, and check the
Include in Output checkbox.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 139


Advanced Pricing
Exercise Guide

v. Click Save and then click Activate.


w. Optional: Simulate the expression set and troubleshoot any errors that occur.
x. Close the Expression Set Builder browser tab.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 140


Advanced Pricing
Exercise Guide

3. Create a custom pricing plan step.

a. Navigate to the Vlocity Product Console.


b. Next to Pricing Plan in the Pricing area, click the search icon .
c. In the Search Pricing Plan… dialog box, press the return or enter key to
display the Default Pricing Plan.
d. Click on the Default Pricing Plan.
e. Click on the Pricing Plan Steps facet.
f. Click New Item.
g. Enter the following data in the General Properties pane:
Field Value

Name Calculate Usage ABP

Implementation Name CustomPricingPlanStepImpl

Method Name GetMatrixPrice

Sequence 9.5

Active ✔

ALERT:
All attribute pricing steps must occur before the Initialize Pricing Context step;
therefore, the sequence number must be before 10.

h. Click the Edit icon to open the Parameters dialog box.


i. Click the + symbol to add the following parameters:
Field Value

ProcedureName UsagePricingProcedure

MatrixName UsagePricingMatrix

DecisionMatrix true

j. Click Done.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 141


Advanced Pricing
Exercise Guide

k. Click Save in the General Properties pane.

Finally, Eliza needs to extend the PricingPlanHelper Apex Class to include the
USAGE_STD_PRC variable mapping to ensure the USAGE_STD_PRC value coming from the
expression set is saved into the vlocity_cmt__UsageUnitPrice__c field.

4. Configure PricingPlanHelper Apex Class for usage pricing.


a. Click on the Setup icon and select Setup.
b. In the Quick Find search box, enter and select Apex Classes.
c. On the Apex Classes page, click Edit next to PricingPlanHelper.
d. Place the cursor at the end of line 184. Enter a comma (,) and then press the
enter key to create a new line 185.
e. Enter 'USAGE_STD_PRC'=>'vlocity_cmt__UsageUnitPrice__c' on
the new line 185.

f. Click Save.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 142


Advanced Pricing
Exercise Guide

Task 6: Edit an order to use attribute-based pricing

Eliza will now see all her hard work come together to price an energy product in the Cart
based on values defined in the ABP matrix and estimated usage consumption attribute
field.

1. Navigate to the Orders tab and select the Energy Usage Pricing Order.

2. Click on the Power Launcher’s search field and select Configure Order.

3. In the cart line item for Unit Rate, click the down arrow and select Configure.

4. Enter A for the Distribution Region attribute. Close the Configure window.

5. What price displays in the Usage Price column and Usage Price Total column?

________________________________________________________

6. Change the Distribution Region to B and the Estimated Usage Quantity to 1050.
Close the Configure window.

7. In the Usage Price column for Unit Rate, click on the price and select the Price

Details icon. Notice that the price returned is from the UsagePricingProcedure
based on the data entered in the matrix. Close the Price Details window.

NOTE:
The Usage Price column displays as five decimal places which was defined
when you created the UsagePricingProcedure. However, it defaults to two
decimal places in the Details window. Custom configuration of the Details
window would be required to alter the precision of decimal places.

8. In the Usage Price Total column for Unit Rate, click on the price and select the Price
Details icon. Notice the calculation to arrive at the total usage price. Close the Price
Details window.

9. In the cart line item for Standing Charges, click the down arrow and select
Configure.

10. Enter A for the Distribution Region attribute. Close the Configure window.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 143


Advanced Pricing
Exercise Guide

11. Click Submit Order.

The screen capture below displays all the relevant fields in the Cart after enabling Usage
Pricing and binding an attribute to a field.

© Copyright 2022 Salesforce.com, inc. All rights reserved. 144


Advanced Pricing
Exercise Guide

Exercise 9-6: Extending Attribute-Based Pricing


Challenge
Scenario
Marketing has introduced the Apple iPhone Xs as a new product offering where customers
can either pay in full for the phone or pay monthly. Marketing is also offering a volume
discount when more than 50 Apple iPhone Xs’ are paid in full. Eliza is tasked with creating
attribute-based pricing matrices to accommodate the request by marketing.

Goal
● Review the requirements below and challenge yourself to create attribute-based
pricing for the iPhone Xs product
● Challenge exercises solidify what you learned in the exercises, build your skills, and
allow you to make mistakes -- which is how you will master this application

Tasks
1. Review product attributes
2. Set up attribute-based pricing matrix
3. Test attribute-based pricing in the Cart

Time: 45 mins

© Copyright 2022 Salesforce.com, inc. All rights reserved. 145


Advanced Pricing
Exercise Guide

Task 1: Review product attributes

1. The Apple iPhone Xs (Product Code C-PHO-010) is available in three finishes – Silver,
Space Gray and Gold.

2. The iPhone Xs is available in three capacities – 64GB, 256GB, and 512GB.

3. Customers have two payment choices: Pay in Full or Pay Monthly. Use the graphic
below to understand the one-time and recurring pricing models.

One-time and Recurring Pricing

© Copyright 2022 Salesforce.com, inc. All rights reserved. 146


Advanced Pricing
Exercise Guide

4. Volume discounts are available to customers buying over 50 units. Use the graphic
below for volume discount pricing.

Volume Discount Pricing

© Copyright 2022 Salesforce.com, inc. All rights reserved. 147


Advanced Pricing
Exercise Guide

Task 2: Set up attribute-based pricing matrix

TIPS:
● Did you enter the data in the matrix using proper case and/or
appropriate spacing?
● Are multiple attribute names separated with proper punctuation?
● Have you double-checked your spelling?
● Does the color of the Apple iPhone Xs affect pricing? Does it need to
be included in the matrix?

© Copyright 2022 Salesforce.com, inc. All rights reserved. 148


Advanced Pricing
Exercise Guide

Task 3: Test attribute-based pricing in the Cart

© Copyright 2022 Salesforce.com, inc. All rights reserved. 149


Advanced Pricing
Exercise Guide

Yay! All done!

© Copyright 2022 Salesforce.com, inc. All rights reserved. 150

You might also like