How to setup Attribute-based pricing in Vlocity

Let’s say you want to sell Watches, but you have different colors and features and each of thse influences the final price. Traditionally in Salesforce, you would have to create multiple products just to represent all the variations of a single base product. In Vlocity, you can simple setup the base product and then configure all the attributes (like Color, size, connectivity, features, plans, screen size) that influence the final price.

Using Attribute-based pricing, the products can be configured to use dynamic pricing based on the attributes or fields that are chosen.

Step 1: Install Attribute-based pricing DataPack

These steps were tested in Salesforce Media Cloud ASM and SLM versions, they should work just fine in any other Salesforce Industries flavors.

  1. We’ll be installing this Process (make sure you’re signed in on the Org you wish to install this)
    You’ll need a Vlocity University Account and you’ll have to sign in. If you don’t have an account, create one, activate it and then come back.
    • Download Attribute/Volume Based Pricing Apex Classes to install manually in a later step
attribute-based pricing datapack
  1. Hit NEXT to install the DataPack to Salesforce (bottom of the page, blue)
  2. Choose if production or sandbox from the dropdown menu.
    You might be prompted to sign in to your org. Make sure you’re logged in the correct org.
    After signing in, hit Install Vlocity DataPack
  3. Make sure everything is selected and hit NEXT and then on the review click NEXT again
  1. Once the import is complete, click on Activate Now.

If you get a Time Out error, just go back and try to install the datapack again.

  1. Select all and hit NEXT 
  2. Wait for the activation to complete and then hit Done

Step 2: Check that Everything was installed correctly

These checks are optional, you could skip to Step 3 and trust that everything was installed correctly, but I encourage you to do these checks now instead of waiting for something to break and then having to trace your way back to check that everything was installed correctly.

Check the data packs

  1. In the same screen (Omnistudio DataPacks) click on the Installed tab

Check for the DataPack

  • Check that VPL-AttributeAndVolumeBasedPricing-CMT exists (usually at the end of the list)

If it’s there, then you can go ahead and close that tab/window and continue with the checks.

Check that the Default Pricing Plan is installed and the right fields are displayed

  1. Go to Vlocity Product Console > Dashboard > Pricing Plan and press ENTER
  2. Default Pricing Plan should show
  3. Check that the Parameters field displays in the General Properties pane in the Pricing Plan Steps facet of the Default Pricing Plan.

If the Default Pricing Plan isn’t shown, run the EPC job

  1. go to Vlocity CMT administration (from the app launcher)
  2. In the middle column, in the admin area, open EPC Jobs
  3. find the INSTALL DEFAULT PRICING PLAN DATA job, and click INSTALL
  4. Once that’s done, go back to previous section and check for Default Pricing Plan

If Parameters field isn’t displayed, enable it

  • If it doesn’t display, go to CMT Administration > EPC Jobs > Install Default Vlocity Objects and Layouts > Install
  • The DefaultPricingPlan custom setting are in CMT Administration > Custom Settings > CPQ Configuration Setup 
  • The PricingPlanService implementation is active and set to default from the PricingInterface on the InterfaceImplementation tab.

Step 3: Create Apex Classes for Vlocity Attribute Based Pricing

Remember the Apex classes you downloaded in Step 1?

  1. Go to Setup > Apex classes > New
  1. You must create the classes in this order or they won’t work, because they are dependent on each other
    • PricingPlanHelper.cls
    • CustomPricingPlanStepImpl.cls
    • CustomPricingPlanStepImplTest.cls
  2. Open the Classes you downloaded in Step 1 (use a text or code editor) copy the contents of each class and paste it on the Apex Class Edit and hit Quick Save (the “save” button sometimes gives an error)
  3. Go back to Apex Classes and Hit New. Repeat the process to create the other two remaining classes

If you have an org with Vlocity package that is 900.468 and beyond: PricingPlanHelper Apex class needs an additional line to patch some new changes Vlocity introduced. Please do the following.

  1. Open PricingPlanHelper apex class
  2. Go to line 1077 in the code, at the end of the line, press enter to add a new line and add the following code:
'isExpressionSet' => false,

Should look like this:

Step 4: Setup Calculation Matrix for Attribute-Based Pricing

Create a new Vlocity Calculation Matrix from the existing AttributePricingMatrix v2

  1. Go to App Launcher > Vlocity calculation matrices > AttributePricingMatrix > Related Tab
  1. Click on the latest version of all the available ones, most likely v2
  2. On the top right corner, click on the Create New Version button.
    A small dialog will pop up, wait until it disappears

If you don’t see the table above and get this message:

This page is no longer available. Use the App Launcher to access Decision Matrices.

Don’t panic. It means you’re using a Vlocity release of Spring 22 and forward, in which Omnistudio uses Salesforce Objects instead of Custom Objects. You’ll have to enable the Legacy Calculation Matrices from setup to work with the old Interface and come back here.

Create CSV Pricing Matrix using the legacy Calculation Matrices interface

  1. Click Download CSV
  2. Preparing the CSV Calculation Matrix
    • For more details, see: Creating Combinations for Vlocity Calculation Matrices
    • Don’t modify the column header names, don’t remove or add
    • DO NOT CLICK Delete all, it will vanish the table and mappings and re upload won’t work
    • Careful with extra spaces at the end or beginning of, things must match exactly the information in the Product.
    • Every row entry is a permutation of the product, combination of Attributes
    • Fields
      • Source product name is for product name (as is in the product setup) Case sensitive
      • Source Product Code  is for the product code. Case sensitive and space too
      • Characteristic Name this is the attribute field name, you can add multiple separated by semicolon ( ; ) like Case Size in the example or Color
      • Characteristic Value the specific choice from the attribute (for example, the measure of a case size or the color red) separated by semicolon ( ; )
      • MRC is for recurrent monthly charges if this is a subscription. If you won’t use, leave as zero
      • NRC is one-time charge. Use this for the purchasing price. If using monthly, leave as zero.
    • Once you’re done, click Delete Data (not to be confused with Delete All)
    • Click Upload CSV, pick the CSV file you prepared and click Save Data 
    • Click the pencil on Priority and set a number higher than the previous version (like 100) and check Enabled checkbox.
    • Click Save at the bottom of the page (not to be confused with Save Data in the matrix table) 
  3. Once enabled, the matrix table cannot be edited. You’d have to create a new version, re-upload and set priority and enable.

Test the Calculation Procedures and Matrices by simulating all the steps

  1. Go to App launcher > Vlocity Calculation Procedures > AttributePricingProcedure > Related 
  2. Click on the latest version and go to the Simulation tab
    • In some orgs, the Simulation tab (with its component) is not present on the Page (next to Calculation Step), if you can’t find it, add it to the page:
      1. click the Config cog > Edit page
      2. Add a new tab, called Simulation 
      3. In the component list, add Visualforce component (not to be confused with Vlocity Visualforce) on the Simulation tab
      4. On the right side pane, in Visualforce Page Name, select PricingProcedureSimulation and set Height to 1000 (for better visibility)
      5. Click Save and Activate as Org Default if necessary.
  3. Select all the hypothetical parameters of the product for simulation (based on existing products) and hit Simulate All Steps
  4. If you get a calculation result, then the procedure was installed correctly

Step 5: Add Attribute-Based Pricing as a Step in the Default Pricing Plan

  1. Go to Vlocity Product Console > Pricing Plan
  2. Click on the magnifying glass and open the Default Pricing Plan clicking on the pencil icon to edit it
  3. On the left side pane, click on Pricing Plan Steps. You’ll see a list of plan steps
  4. Click on the New Item button, a pane opens on the right side.
  5. In the General Properties pane, enter the following
NameCalculate Attribute Based Pricing
DescriptionCustom pricing step
Implementation NameCustomPricingPlanStepImpl
Method NameGetMatrixPrice
Also, make sure you mark the Active checkbox

The General Properties Pane should look like this:

  1. In the Sequence field, make sure you choose a number before the Initialize Pricing Context but after the first step (that’s why I chose 6)
  1. For Parameters, click the pencil icon and click the + button to add each parameter
ProcedureNameAttributePricingProcedure
MatrixNameAttributePricingMatrix
  1. Click Done and then click Save on the General Properties pane

Final Step: Test Attribute-Based Pricing in the Cart

If you completed all the previous steps correctly, test out the Attribute-Based pricing with a test order and play around with the attributes of a chosen product.

  1. Create a test order. Fill out the required fields and save
  2. In the Order, in the top right menu, click Configure
    1. If the Configure button doesn’t show, add it to the page:
      1. Click the config cog > Edit Page
      2. Wait until all the components load
      3. Click on the Highlight Panel (the component at the top with the 3 buttons)
      4. In the side panel options, click Add Action
      5.  Search for Configure, choose Configure under Custom Actions and click Done
      6. Click Save in top right corner and Activate as org default (if necessary)
  3. Select a Price List from the dropdown
  4. Add a product to the cart (product must exist in the matrix CSV you uploaded before)
  5. Change the options in the attributes and see if the price gets updated
  6. Click the price and then the info icon to see where the pricing has been calculated from, if it says:
    • Priced from AttributePricingProcedure” then it’s working.

Congratulations! You have successfully configured Attribute-Based pricing in Vlocity.

Was this article helpful?
YesNo