CME CPQ PDF-en

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1015

CME CPQ

Copyright 2021 Vlocity LLC, a Salesforce company. All rights reserved. Information in this document is subject to change without
notice. This documentation and the software, tools, templates and other material described in this document (“Vlocity Materials”) are
furnished exclusively under a subscription services agreement or nondisclosure agreement. The Vlocity Materials may be used or
copied only in accordance with the terms of those agreements. No part of the Vlocity Materials may be reproduced, stored in a
retrieval system, or transmitted in any form or any means electronic or mechanical, including photocopying or recording for any
purpose other than the licensee’s personal use as set forth in the applicable agreement without the prior written permission of Vlocity
LLC. Vlocity is a trademark of Vlocity LLC, a Salesforce company, as are other names and marks. Other marks appearing herein may
be trademarks of their respective owners.
CME CPQ

Table of Contents
Vlocity Configure, Price, Quote (CPQ) .......................................................................................... 1

Vlocity Order Capture .................................................................................................................. 5


Order-Capture Flow ............................................................................................................ 5
Creating an Order Using Vlocity Cart ................................................................................... 6
See Also .................................................................................................................... 9
Going to Vlocity Cart ........................................................................................................... 9
Expanding and Collapsing the List Pane ............................................................................. 10
Configuring a Product Using Vlocity Cart ............................................................................. 11
Searching for Products and Promotions .............................................................................. 12
Viewing Promotions In Vlocity Cart ...................................................................................... 15
Working with Line Items in Vlocity Cart ................................................................................ 16
Cardinality: Minimum and Maximum Quantities ............................................................ 19
Deleting a Line Item From the Cart ..................................................................................... 20
Overriding Default Functions .............................................................................................. 20
Adding Pre- and Post-Processing Logic .............................................................................. 22
Vlocity Cards for CPQ ........................................................................................................ 22
comp-assets-base-grid (template) ............................................................................... 42
comp-assets-contract (template) ................................................................................. 44
comp-assets-contract-layout ....................................................................................... 44
comp-assets-contract-load (template) ......................................................................... 45
comp-assets-header (card) ......................................................................................... 45
comp-assets-header (layout) ...................................................................................... 46
comp-assets-header (template) .................................................................................. 47
comp-assets-header-card (template) ........................................................................... 48
comp-assets-info-panel (layout) .................................................................................. 48
comp-assets-info-panel (template) .............................................................................. 49
comp-assets-load (template) ...................................................................................... 52
comp-assets-no-contract (card) .................................................................................. 53
comp-assets-no-contract-layout .................................................................................. 54
comp-assets-base-grid (layout) ................................................................................... 55
comp-assets-product-children (layout) ......................................................................... 57
comp-assets-product-children (template) ..................................................................... 57
comp-assets-product-item (card) ................................................................................ 58
comp-assets-product-item (template) .......................................................................... 59
comp-assets-product-item-child (card) ........................................................................ 60
comp-assets-product-item-child (template) .................................................................. 61
comp-assets-products (layout) .................................................................................... 64
comp-assets-products (template) ................................................................................ 64
comp-assets-promotions (layout) ................................................................................ 67
comp-assets-promotions (template) ............................................................................ 68
comp-assets-promotions-card .................................................................................... 69

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

comp-assets-theme-variables (template) ..................................................................... 70


comp-cart-review (layout) ........................................................................................... 70
comp-cart-review (template) ....................................................................................... 72
comp-assets-no-contract (template) ............................................................................ 73
comp-cart-review-base-grid (layout) ............................................................................ 74
comp-cart-review-base-grid (template) ........................................................................ 75
cpq-base-grid (layout) ................................................................................................ 76
cpq-base-grid (template) ............................................................................................ 77
cpq-base-header (template) ....................................................................................... 78
cpq-base-header-card (template) ................................................................................ 79
cpq-base-header-payment-choice (layout) ................................................................... 81
cpq-base-header-pricelist (layout) ............................................................................... 82
cpq-base-header-pricelist (template) ........................................................................... 83
cpq-base-theme-variables (template) .......................................................................... 84
cpq-base-variables (template) .................................................................................... 85
cpq-card-blank (template) ........................................................................................... 87
cpq-card-mixin (template) ........................................................................................... 87
cpq-cart-item-detail (card) .......................................................................................... 89
cpq-cart-item-detail (layout) ........................................................................................ 90
comp-assets-contract (card) ....................................................................................... 92
cpq-cart-item-details (template) .................................................................................. 93
cpq-cart-item-lookup (layout) ...................................................................................... 94
cpq-cart-item-lookup (template) .................................................................................. 95
cpq-cart-promotions (card) ......................................................................................... 96
cpq-cart-promotions (layout) ....................................................................................... 97
cpq-cart-promotions (template) ................................................................................... 99
cpq-config-attr-custom-action-template1 and cpq-config-attr-custom-action-template2 . 100
cpq-header (card) .................................................................................................... 102
cpq-header (layout) .................................................................................................. 103
cpq-base-header-payment-choice (template) ............................................................. 104
cpq-input-custom-template-sample ........................................................................... 104
cpq-left-sidebar (layout) ............................................................................................ 104
cpq-left-sidebar (template) ........................................................................................ 106
cpq-product-addon (layout) ....................................................................................... 108
cpq-product-addon (template) ................................................................................... 109
cpq-product-addon-item (card) .................................................................................. 110
cpq-product-addon-item-separate-section (template) .................................................. 111
cpq-product-cart (layout) .......................................................................................... 112
cpq-product-cart (template) ...................................................................................... 114
cpq-product-cart-config (layout) ................................................................................ 115
cpq-product-cart-config (template) ............................................................................ 117
cpq-product-cart-item (card) ..................................................................................... 121
cpq-product-cart-item (template) ............................................................................... 122
cpq-product-cart-item-cell-detail (flyout) ..................................................................... 125
cpq-product-cart-item-cell-detail (template) ................................................................ 127
cpq-product-cart-item-cell-payment-choice (template) ................................................ 128

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

cpq-product-cart-item-cell-pricing (flyout) ................................................................... 129


cpq-product-cart-item-cell-pricing (template) .............................................................. 130
cpq-product-cart-item-child (card) ............................................................................. 131
cpq-product-cart-item-child (layout) ........................................................................... 132
cpq-product-cart-item-child (template) ....................................................................... 133
cpq-product-config-custom-action (layout) ................................................................. 138
cpq-product-config-custom-action (template) ............................................................. 140
cpq-product-details (card) ......................................................................................... 145
cpq-product-filters (layout) ........................................................................................ 146
cpq-product-filters (template) .................................................................................... 148
cpq-product-item (card) ............................................................................................ 149
cpq-product-item (template) ...................................................................................... 150
cpq-product-item-details (template) ........................................................................... 153
cpq-product-item-more (layout) ................................................................................. 155
cpq-product-item-more (template) ............................................................................. 156
cpq-product-list (layout) ............................................................................................ 157
cpq-product-list (template) ........................................................................................ 159
cpq-promotion-item (card) ........................................................................................ 160
cpq-promotion-item (template) .................................................................................. 161
cpq-promotions-list (layout) ...................................................................................... 163
cpq-promotions-list (template) .................................................................................. 165
cpq-slds-prompt (layout) ........................................................................................... 166
cpq-slds-prompt (template) ....................................................................................... 167
cpq-theme-variables (template) ................................................................................ 167
cpq-total-bar (layout) ................................................................................................ 168
cpq-total-bar (template) ............................................................................................ 169
cpq-total-bar-card .................................................................................................... 170
cpq-total-card (template) .......................................................................................... 171
Asset-Based Ordering ...................................................................................................... 171
Move, Add, Change, Delete (MACD) ......................................................................... 172
Asset Reference IDs ................................................................................................ 173
Selecting the Asset-Based Ordering Implementation .................................................. 174
Submitting an Order and Creating Assets .................................................................. 175
Converting an Asset to a Quote or an Order .............................................................. 176
Asset-Based Ordering Visualforce Pages .................................................................. 177
Mapping Fields for Asset-Based Ordering ................................................................. 179
Mapping Objects for Asset-Based Ordering ............................................................... 182
Mapping Fields Using Field Mapper .................................................................................. 186
Adding a New Field to Field Mapper .......................................................................... 188
Adding a Filter to Field Mapper ................................................................................. 191
Editing Field Mappings ............................................................................................. 191
In-Flight Amendments ...................................................................................................... 192
Supplemental Orders ............................................................................................... 192
Follow-On Orders .................................................................................................... 195
See Also ................................................................................................................. 195
Amend In-Flight Orders ............................................................................................ 196

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Cancel an In-Flight Order ......................................................................................... 197


Order Statuses in CPQ ............................................................................................ 199
View Amendment History for In-Flight Orders ............................................................ 199
View Status Notifications for In-Flight Orders ............................................................. 200
Manage In-Flight Orders .......................................................................................... 201
In-Flight Order Cancellation .............................................................................................. 202
Supported Cancellation Flows .................................................................................. 202
Cancellation Process ............................................................................................... 204
CPQ Data Model Changes for Order Cancellation ...................................................... 207
See Also ................................................................................................................. 208
Future-Dated Orders and Order Queuing in CPQ ............................................................... 208
Scheduling a Submit-Batch Job for Queued Orders ................................................... 209
Creating a Change Order ................................................................................................. 211
Cancel a Submitted Order ................................................................................................ 211
Results ................................................................................................................... 212
See Also ................................................................................................................. 213
Opportunity, Quote, and Order Managers (Deprecated) ...................................................... 213
Setting Up Managers and Review Cart Interfaces ...................................................... 214
Synchronizing a Quote with an Opportunity ............................................................... 241
Creating an Order Using the Order Manager ............................................................. 242
Creating an Opportunity ........................................................................................... 249
Creating a Quote ..................................................................................................... 252

Pricing Definition ...................................................................................................................... 254


Pricing Components ......................................................................................................... 254
Price Lists ............................................................................................................... 254
Pricing Elements ...................................................................................................... 257
Pricing Variables ...................................................................................................... 267
Create a Time Plan for a Product's Price ................................................................... 272
Create a Time Policy for a Product's Price ................................................................. 273
Product Pricing ................................................................................................................ 275
Create a Price List Entry .......................................................................................... 275
Multiple Price List Entries ......................................................................................... 277
Price Assignment ..................................................................................................... 278
Best Practices for Price Display Text ......................................................................... 279
Pricing Strategies for Product Bundles .............................................................................. 279
Price Adjustments and Overrides ...................................................................................... 280
Pricing Adjustments Using Product Bundles .............................................................. 280
Pricing Adjustments Using Promotions ...................................................................... 280
Adjustment Records ................................................................................................. 280
Adjust the Base Price for a Product in a Bundle ......................................................... 281
Override the Base Price for a Product in a Bundle ...................................................... 282
Manual Price Changes in the Cart ............................................................................. 284
Enable Usage Pricing ....................................................................................................... 287

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Configure Usage Pricing .......................................................................................... 288


Set Up Dynamic Usage Quantity ............................................................................... 288
Create a Pricing Element for Usage Pricing Charges .................................................. 292
Create a Usage Standard Cost for a Product ............................................................. 297
Vlocity Cards for Usage Pricing ................................................................................ 299
Final Price Calculation ..................................................................................................... 300
Pricing Variable Calculation Hook ..................................................................................... 301
Input Map ................................................................................................................ 302
Output Map ............................................................................................................. 303
Example Hook Class ................................................................................................ 306
Setting Up the Hook ................................................................................................. 310
Names of Elements ................................................................................................. 311
Pricing Hooks .................................................................................................................. 313
Invoke the CpqAppHandlerHook ............................................................................... 314
Using a Hook ........................................................................................................... 315
Pricing and Validating Changed Items Only ....................................................................... 316
Attribute-Based Pricing .................................................................................................... 317
Attribute-Based Pricing Implementation ..................................................................... 318
Attribute-Based Pricing Using Pricing Plans ............................................................... 318
Setting Up Attribute-Based Pricing Using Pricing Plans .............................................. 320
Pricing Plan ............................................................................................................. 343
Repricing Existing Prices .................................................................................................. 353
Setting Up the Interface Implementations .................................................................. 353
Repricing an Asset to Reflect a Context Rule Condition for an Account ....................... 357
Repricing Best Practices .......................................................................................... 358
Using Repricing APIs ............................................................................................... 359
Invoking the Repricing API ....................................................................................... 359
Invoking the Repricing Batch Processor .................................................................... 361
Loyalty Pricing ................................................................................................................. 361
Enable Loyalty Pricing .............................................................................................. 362
Managing Loyalty Pricing in the Cart ......................................................................... 363
Creating Pricing Elements for Loyalty Point Charges .................................................. 364
Upgrading to Use Loyalty Pricing .............................................................................. 365
Pricing Using PricingRulesImplementation ......................................................................... 366
Setting Up Pricing Matrices Using the PricingRulesImplementation ............................. 367
Cost and Margin Overview ............................................................................................... 384
Defining Cost and Margins ....................................................................................... 385
Defining and Validating Margin Ranges ..................................................................... 385
Customizing Default Margin Range and Validation Interface Implementations .............. 385
Associating Service Points to Line Items in Vlocity Cart .............................................. 386
Enabling Cost and Margin ........................................................................................ 386
Vlocity Cards for Cost and Margins ........................................................................... 388
Creating a Pricing Element for Costs ......................................................................... 390
Defining Costs ......................................................................................................... 391
Defining and Validating Margin Ranges ..................................................................... 392
Pricing Variables for Cost and Margins ...................................................................... 399

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Customizing Default Interface Implementations for Margin Ranges ............................. 400


Linking Line Items to Service Points .......................................................................... 407

Context Rules and Advanced Rules Frameworks ....................................................................... 408


Context Rules Framework ................................................................................................ 408
Setting Up Context Rules Framework ........................................................................ 409
Types of Context Rules ............................................................................................ 410
Context Rule Components ....................................................................................... 434
Create Context Actions ............................................................................................ 492
Functions for Rules .................................................................................................. 493
Using Context Rules to Check User's Eligibility in Self-Service Transactions ................ 495
Migrate Context Rules Between Environments .......................................................... 497
Advanced Rules Framework ............................................................................................. 502
Rules Overview ....................................................................................................... 503
Entity Filters Overview ............................................................................................. 514
Product Relationships Overview ............................................................................... 520
About Build Rules and Entity Filters .......................................................................... 523
Setting Up an Availability or Eligibility Rule to Exclude Declined Products .................... 545
Setting Up a Vlocity Attribute Configuration Rule to Modify Attributes Across Line
Items ...................................................................................................................... 548
Context Rules or Advanced Rules: What Type to Use? ...................................................... 553
After You Edit and Before You Test Rules .......................................................................... 554

Promotions .............................................................................................................................. 555


Products within Promotions .............................................................................................. 555
Price Lists, Products, and Promotions ............................................................................... 555
Differences between Promotions and Discounts ................................................................ 555
Promotions Capabilities .................................................................................................... 556
Orderable Promotions .............................................................................................. 556
Multiple Promotions for One Product or Product Bundle ............................................. 557
Promotions that Apply to Assets ............................................................................... 557
Promotions Automation ............................................................................................ 557
Promotion Design Considerations ..................................................................................... 557
Configuration of Products in Promotions ............................................................................ 558
Minimum, Default, and Maximum Quantity ................................................................. 558
Time Plan Hierarchy ................................................................................................. 558
Product Hierarchy in a Promotion ............................................................................. 558
Context Rules and Promotions ................................................................................. 558
Time Plans for Products in Promotions .............................................................................. 558
Create a Promotion .......................................................................................................... 558
Define Basic Promotion Settings ............................................................................... 559
Add a Product to a Promotion ................................................................................... 561
Product Price Changes in a Promotion ...................................................................... 562

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Activate a Follow-on Promotion ........................................................................................ 566


Run the Batch Job PromotionExpirationBatch ............................................................ 566
Promotions that Apply to Products in the Cart .................................................................... 566
Multiple Promotions for a Single Product Bundle ................................................................ 567
Promotions List in the Cart ............................................................................................... 568
Qualified and Disqualified Promotions ....................................................................... 569
Add a Promotion to the Cart ..................................................................................... 569
Delete a Promotion from the Cart .............................................................................. 570
Cancel a Promotion ................................................................................................. 571

Discounts ................................................................................................................................ 572


Discount Definition Stages ............................................................................................... 572
Discount Management in the Vlocity Cart .......................................................................... 572
Types of Discounts .......................................................................................................... 573
Order-Based Discounts ............................................................................................ 573
Account-Based Discounts ........................................................................................ 574
Contract-Based Discounts ........................................................................................ 574
Define a New Discount ..................................................................................................... 575
Define New Discount Items ...................................................................................... 578
Define a New Discount Pricing Item .......................................................................... 579
Create an Order-Based Discount .............................................................................. 581
Create an Account-Based Discount ........................................................................... 582
Create a Contract-Based Discount ............................................................................ 583
Edit Discounts in Vlocity Cart ............................................................................................ 587
Define Custom Discounts in Vlocity Cart ........................................................................... 588
Approve Discounts ........................................................................................................... 590
Enable Discount Approvals ....................................................................................... 591
Submit Discounts for Approval .................................................................................. 592
See Also ................................................................................................................. 593
Activating and Deactivating Discounts ............................................................................... 593
Activating a Discount ............................................................................................... 594
Deactivating an Account-Based Discount .................................................................. 594
Deactivating a Contract-Based Discount ................................................................... 594
Products and Discounts in Vlocity Cart .............................................................................. 594
No Products or Discounts in Cart .............................................................................. 595
No Products with Multiple Discount Types ................................................................. 595
Multiple Products with Multiple Discounts .................................................................. 596

Flow Management ................................................................................................................... 597


Enabling a Flow ............................................................................................................... 597
Deactivating a Flow ......................................................................................................... 598
Add a Rule to the Pricing Flow .......................................................................................... 599

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Change of Plans ...................................................................................................................... 604


Usage Scenarios ............................................................................................................. 604
Creating a New Offer Migration Plan ................................................................................. 605
Defining Mappings ................................................................................................... 607
Searching for Offer Migration Plans ................................................................................... 607
Editing and Deleting Offer Migration Plans ......................................................................... 608
Editing an Offer Migration Plan ................................................................................. 608
Deleting an Offer Migration Plan ............................................................................... 608
Editing and Deleting Offer Migration Mapping Exceptions ........................................... 609
Replacing and Comparing Plans ....................................................................................... 610
Replacing Plans ...................................................................................................... 610
Comparing Plans ..................................................................................................... 611
Asset Status After Submitting the Order .................................................................... 612
Applying Change Fees ..................................................................................................... 612
Setting Up the Framework to Apply Change Fees ...................................................... 613
Transforming Multiplay Offers ........................................................................................... 613
Merging Multiple Existing Offers into a Single New Offer ............................................ 614
Splitting a Single Existing Offer into Multiple New Offers ............................................. 615
Merging, Splitting, or Transforming a Multiplay Offer .................................................. 615
Comparing Offers .................................................................................................... 623
Creating Custom Field Settings ................................................................................ 625

Multi-Site Quote and Order Capture .......................................................................................... 628


Multi-Site Workflow .......................................................................................................... 628
See Also ......................................................................................................................... 629
Define Multi-Site Objects .................................................................................................. 629
Create a Premises ................................................................................................... 629
Create an Account ................................................................................................... 630
Create a New Service Point ...................................................................................... 631
Associate a New Asset to an Account and Premises .................................................. 631
Associate a Parent Premises to an Existing Premises ................................................ 631
What's Next ............................................................................................................. 632
Configure Multi-Site Customizations .................................................................................. 632
Configure the Single or Multiple Structure .................................................................. 632
Enable Apply to Group, Validate and Price, and Submit on the Group Page ................. 633
Configure Objects for Grouping ................................................................................ 634
Configure Field Settings for Display Columns ............................................................ 635
Configure Filters ...................................................................................................... 637
Configure the Multi-Site Group Pane in Vlocity Cart ................................................... 638
Configure the Page Size for Groups in Vlocity Cart .................................................... 640
Configure the Batch Size .......................................................................................... 642
Create the Opportunity, Quote or Order Structure, and Groups ........................................... 643
Create the Opportunity ............................................................................................. 644
Create the Master Quote or Order ............................................................................. 644

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Clone a Master Quote or Order ................................................................................. 646


Create Groups ......................................................................................................... 646
What's Next ............................................................................................................. 647
Manage Multi-Site Groups ........................................................................................ 647
Validate and Price a Single Quote or Order ....................................................................... 651
Attach Groups to Line Items ..................................................................................... 651
Validate and Price Products ...................................................................................... 652
Submit the Master Quote or Order ............................................................................ 652
What's Next ............................................................................................................. 653
Validate and Price Multiple Quotes or Orders ..................................................................... 653
Apply Products to Groups ......................................................................................... 653
Validate and Price Products ...................................................................................... 654
Submit the Master Quote or Order ............................................................................ 655
What's Next ............................................................................................................. 655
Validate and Price on the Groups Page ............................................................................. 656
Select Products in the Cart ....................................................................................... 656
Apply Products to Groups ......................................................................................... 656
Validate and Price Products ...................................................................................... 657
Submit the Master Quote or Order ............................................................................ 657
What's Next ............................................................................................................. 658
View Multi-Site Orders on the Account Record Page .......................................................... 658
View Record Types .................................................................................................. 658
Add an Order Record Type Column to the Order Related List for Accounts .................. 659
Configure Quantity Rollup Lists ......................................................................................... 660
Results ................................................................................................................... 662

Order Management Integration ................................................................................................. 663


Invoking the Order Management Integration Layer ............................................................. 663
Invoking Using APEX ............................................................................................... 663
Invoking Using REST API ......................................................................................... 663
Notification Types .................................................................................................... 663
DataRaptor Setup for Order Management Integration Layer ............................................... 664
Order-Level Notification ............................................................................................ 664
Order Item-Level Notification .................................................................................... 664
Notification Examples ............................................................................................... 665
Order Management Integration Layer Messages Initiated by CPQ ...................................... 674
Submit Order Request ............................................................................................. 675
Freeze Order Request and Response ....................................................................... 689
Unfreeze Order Request and Response .................................................................... 690
Create Hooks for Odin Notification Handlers ...................................................................... 691

Cart-Based APIs ...................................................................................................................... 695


Base URI Structure and Namespaces ............................................................................... 696

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

API Authentication and Security ........................................................................................ 696


API Limits ........................................................................................................................ 696
API Response Status Codes ............................................................................................ 697
Non-Alphanumeric Characters .......................................................................................... 697
See Also ......................................................................................................................... 697
Guest User Security Restrictions ...................................................................................... 697
Cart-Based APIs ...................................................................................................... 697
Digital Commerce APIs ............................................................................................ 700
See Also ................................................................................................................. 701
Cart-Based API Swagger Reference ................................................................................. 701
API Response Format ...................................................................................................... 701
CPQ APIs to Replace OmniCPQServiceWrapper ............................................................... 703
Add Items to Cart ............................................................................................................. 704
Remote Method ....................................................................................................... 704
REST Handler ......................................................................................................... 705
Apex Remote Service .............................................................................................. 705
Apex Remote Input Map ........................................................................................... 705
Package .................................................................................................................. 705
API Parameters and Response Format ..................................................................... 705
Resource Information ............................................................................................... 705
Example Request .................................................................................................... 705
Example Result ....................................................................................................... 714
Add Promotion to Cart ...................................................................................................... 719
Remote Method ....................................................................................................... 720
REST Handler ......................................................................................................... 720
Apex Remote Service .............................................................................................. 720
Apex Remote Input Map ........................................................................................... 720
Package .................................................................................................................. 720
API Parameters and Response Format ..................................................................... 720
Resource Information ............................................................................................... 720
Example Request .................................................................................................... 720
Example Response .................................................................................................. 721
Add to Cart ...................................................................................................................... 721
Remote Method ....................................................................................................... 722
REST Handler ......................................................................................................... 722
Apex Remote Service .............................................................................................. 722
Apex Remote Input Map ........................................................................................... 722
Package .................................................................................................................. 723
API Parameters and Response Format ..................................................................... 723
Resource Information ............................................................................................... 723
Example Request .................................................................................................... 723
Example Response .................................................................................................. 726
Apply Adjustment ............................................................................................................. 731
Remote Method ....................................................................................................... 731
Package .................................................................................................................. 731
API Parameters and Response Format ..................................................................... 731

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Resource Information ............................................................................................... 731


Example Request .................................................................................................... 732
Example Result ....................................................................................................... 732
Cancel Order ................................................................................................................... 736
Remote Method ....................................................................................................... 736
REST Handler ......................................................................................................... 736
Apex Remote Service .............................................................................................. 736
Apex Remote Input Map ........................................................................................... 736
Package .................................................................................................................. 736
API Parameters and Response Format ..................................................................... 736
Resource Information ............................................................................................... 736
Example Request .................................................................................................... 737
Example Request Body ............................................................................................ 737
See Also ................................................................................................................. 737
Check Status of the Cart .................................................................................................. 737
Remote Method ....................................................................................................... 737
REST Handler ......................................................................................................... 738
Apex Remote Service .............................................................................................. 738
Apex Remote Input Map ........................................................................................... 738
API Parameters and Response Format ..................................................................... 738
Resource Information ............................................................................................... 738
Example Request Body ............................................................................................ 738
Example Responses ................................................................................................ 739
Message Codes ...................................................................................................... 740
Checkout Items in Cart ..................................................................................................... 740
Remote Method ....................................................................................................... 741
REST Handler ......................................................................................................... 741
Apex Remote Service .............................................................................................. 741
Apex Remote Input Map ........................................................................................... 741
Package .................................................................................................................. 741
API Parameters and Response Format ..................................................................... 741
Resource Information ............................................................................................... 741
Example Request .................................................................................................... 742
Example Responses ................................................................................................ 742
Clone Line Items in Cart ................................................................................................... 743
Remote Method ....................................................................................................... 743
REST Handler ......................................................................................................... 743
Apex Remote Service .............................................................................................. 743
Apex Remote Input Map ........................................................................................... 743
Package .................................................................................................................. 743
API Parameters and Response Format ..................................................................... 743
Resource Information ............................................................................................... 743
Example Request .................................................................................................... 743
Example Result ....................................................................................................... 744
Create Cart ..................................................................................................................... 751
Remote Method ....................................................................................................... 751

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

REST Handler ......................................................................................................... 751


Apex Remote Service .............................................................................................. 751
Apex Remote Input Maps ......................................................................................... 752
Package .................................................................................................................. 753
API Parameters and response format ........................................................................ 753
Resource Information ............................................................................................... 753
Example Requests ................................................................................................... 753
See Also ................................................................................................................. 755
Create Cart (assetToOrder) .............................................................................................. 755
Remote Method ....................................................................................................... 755
REST Handler ......................................................................................................... 755
Apex Remote Service .............................................................................................. 755
Apex Remote Input Map ........................................................................................... 755
Package .................................................................................................................. 755
API Parameters and Response Format ..................................................................... 756
Resource Information ............................................................................................... 756
Example Request .................................................................................................... 756
Example Response .................................................................................................. 756
Create New Account for Current Site ................................................................................ 756
Remote Method ....................................................................................................... 757
REST Handler ......................................................................................................... 757
Apex Remote Service .............................................................................................. 757
Apex Remote Input Map ........................................................................................... 757
Package .................................................................................................................. 757
API Parameters and Response Format ..................................................................... 757
Resource Information ............................................................................................... 757
Example Request .................................................................................................... 757
Example Response .................................................................................................. 758
Create String Translations ................................................................................................ 758
Apex Remote Service .............................................................................................. 758
Remote Method ....................................................................................................... 758
Package .................................................................................................................. 758
API Parameters and Response Format ..................................................................... 758
Example POST Body ............................................................................................... 758
Example Response .................................................................................................. 759
Create Supplemental Order .............................................................................................. 759
Remote Method ....................................................................................................... 759
Apex Method ........................................................................................................... 759
Package .................................................................................................................. 760
API Parameters and Response Format ..................................................................... 760
Resource Information ............................................................................................... 760
Example Request .................................................................................................... 760
Example Request Body ............................................................................................ 760
Message Codes ...................................................................................................... 760
See Also ................................................................................................................. 761
Delete Adjustment ........................................................................................................... 761

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Remote Method ....................................................................................................... 761


Package .................................................................................................................. 761
API Parameters and Response Format ..................................................................... 761
Resource Information ............................................................................................... 762
Example Request .................................................................................................... 762
Example result ......................................................................................................... 762
Delete Applied Promo Items ............................................................................................. 768
Remote Method ....................................................................................................... 768
REST Handler ......................................................................................................... 768
Apex Remote Service .............................................................................................. 768
Apex Remote Input Map ........................................................................................... 768
Package .................................................................................................................. 769
API Parameters and Response Format ..................................................................... 769
Resource Information ............................................................................................... 769
Example Request .................................................................................................... 769
Example Response .................................................................................................. 769
Delete String Translations ................................................................................................ 770
Apex Remote Service .............................................................................................. 770
Remote Method ....................................................................................................... 770
Package .................................................................................................................. 770
API Parameters and Response Format ..................................................................... 770
Discard Supplemental Order ............................................................................................. 770
Apex Method ........................................................................................................... 770
See Also ................................................................................................................. 771
Expand Items .................................................................................................................. 771
Remote Method ....................................................................................................... 771
Handlers ................................................................................................................. 771
Apex remote service ................................................................................................ 771
Apex remote input map ............................................................................................ 771
Package .................................................................................................................. 772
API Parameters and Response Format ..................................................................... 772
Resource Information ............................................................................................... 772
Example Request .................................................................................................... 772
Example Result ....................................................................................................... 772
Freeze Order ................................................................................................................... 779
Remote Method ....................................................................................................... 779
REST Handler ......................................................................................................... 779
Apex ....................................................................................................................... 779
Package .................................................................................................................. 780
API Parameters and Response Format ..................................................................... 780
Resource Information ............................................................................................... 780
Message Codes ...................................................................................................... 780
See Also ................................................................................................................. 781
Get Account Details ......................................................................................................... 781
Remote Method ....................................................................................................... 781
Handlers ................................................................................................................. 781

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Apex Remote Service .............................................................................................. 781


Apex Remote Input Map ........................................................................................... 781
Package .................................................................................................................. 781
API Parameters and Response Format ..................................................................... 781
Resource Information ............................................................................................... 781
Example Request .................................................................................................... 781
Example Response .................................................................................................. 782
Get Applied or Available Promotions for Cart ..................................................................... 782
Remote Method ....................................................................................................... 782
REST Handler ......................................................................................................... 782
Apex Remote Service .............................................................................................. 783
Apex Remote Input Map ........................................................................................... 783
Package .................................................................................................................. 783
API Parameters and Response Format ..................................................................... 783
Resource Information ............................................................................................... 783
Example Request .................................................................................................... 783
Example Result ....................................................................................................... 783
Get Applied Promotions for Account .................................................................................. 785
Remote Method ....................................................................................................... 785
Handlers ................................................................................................................. 785
Apex Remote Service .............................................................................................. 786
Apex Remote Input Map ........................................................................................... 786
Package .................................................................................................................. 786
API Parameters and Response Format ..................................................................... 786
Resource Information ............................................................................................... 786
Example Request .................................................................................................... 786
Example Response .................................................................................................. 786
Get Asset Pricing ............................................................................................................. 793
Remote Method ....................................................................................................... 793
Handlers ................................................................................................................. 793
Apex Remote Service .............................................................................................. 793
Apex Remote Input Map ........................................................................................... 793
Package .................................................................................................................. 794
API Parameters and Response Format ..................................................................... 794
Resource Information ............................................................................................... 794
Example Request .................................................................................................... 794
Example Response .................................................................................................. 794
Get Assets for Account .................................................................................................... 796
Remote Method ....................................................................................................... 797
Handlers ................................................................................................................. 797
Apex Remote Service .............................................................................................. 797
Apex Remote Input Map ........................................................................................... 797
Package .................................................................................................................. 797
API Parameters and Response Format ..................................................................... 797
Resource Information ............................................................................................... 797
Example Request .................................................................................................... 797

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Example Response .................................................................................................. 797


Get Assets for Contract .................................................................................................... 809
Remote Method ....................................................................................................... 809
Handlers ................................................................................................................. 809
Apex Remote Service .............................................................................................. 809
Apex Remote Input Map ........................................................................................... 809
Package .................................................................................................................. 810
API Parameters and Response Format ..................................................................... 810
Resource Information ............................................................................................... 810
Example Request .................................................................................................... 810
Example Response .................................................................................................. 810
Get Available Sites .......................................................................................................... 822
Remote Method ....................................................................................................... 822
REST Handler ......................................................................................................... 822
Apex Remote Service .............................................................................................. 822
Apex Remote Input Map ........................................................................................... 822
Package .................................................................................................................. 822
API Parameters and Response Format ..................................................................... 822
Example Request .................................................................................................... 822
Example Result ....................................................................................................... 823
Get Cart Items ................................................................................................................. 824
Remote Method ....................................................................................................... 824
REST Handler ......................................................................................................... 824
Apex Remote Service .............................................................................................. 824
Apex Remote Input Map ........................................................................................... 825
Package .................................................................................................................. 825
API Parameters and Response Format ..................................................................... 825
Resource Information ............................................................................................... 825
Example Request .................................................................................................... 825
Example Response .................................................................................................. 825
See Also ................................................................................................................. 836
Get Cart Promotions ........................................................................................................ 836
Remote Method ....................................................................................................... 836
Handlers ................................................................................................................. 836
Apex remote service ................................................................................................ 836
Apex Remote Input Map ........................................................................................... 836
Package .................................................................................................................. 836
API Parameters and Response Format ..................................................................... 836
Resource Information ............................................................................................... 837
Example Request .................................................................................................... 837
Example Response .................................................................................................. 837
Get Cart Summary ........................................................................................................... 838
Remote Method ....................................................................................................... 838
REST Handler ......................................................................................................... 839
Apex Remote Service .............................................................................................. 839
Apex Remote Input Map ........................................................................................... 839

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Package .................................................................................................................. 839


API Parameters and Response Format ..................................................................... 839
Resource Information ............................................................................................... 839
Example Request .................................................................................................... 839
Example Result ....................................................................................................... 839
Get Catalog Information ................................................................................................... 841
Remote Method ....................................................................................................... 842
REST Handler ......................................................................................................... 842
Apex Remote Service .............................................................................................. 842
Apex Remote Input Map ........................................................................................... 842
Package .................................................................................................................. 842
API Parameters and Response Format ..................................................................... 842
Resource Information ............................................................................................... 842
Examples ................................................................................................................ 842
Get Contracts for Account ................................................................................................ 846
Remote Method ....................................................................................................... 846
Handlers ................................................................................................................. 846
Apex Remote Service .............................................................................................. 847
Apex Remote Input Map ........................................................................................... 847
Package .................................................................................................................. 847
API Parameters and Response Format ..................................................................... 847
Resource Information ............................................................................................... 847
Example Request .................................................................................................... 847
Example Response .................................................................................................. 847
Get Details of Product ...................................................................................................... 848
Remote Method ....................................................................................................... 848
REST Handler ......................................................................................................... 848
Apex Remote Service .............................................................................................. 849
Apex Remote Input Map ........................................................................................... 849
Package .................................................................................................................. 849
API Parameters and Response Format ..................................................................... 849
Resource Information ............................................................................................... 849
Example Request .................................................................................................... 849
Example Response .................................................................................................. 849
Get Filterable Attributes .................................................................................................... 851
Remote Method ....................................................................................................... 851
REST Handler ......................................................................................................... 851
Apex Remote Service .............................................................................................. 851
Apex Remote Input Map ........................................................................................... 852
Package .................................................................................................................. 852
API Parameters and Response Format ..................................................................... 852
Resource Information ............................................................................................... 852
Example Request .................................................................................................... 852
Example Response .................................................................................................. 852
Get Line Items by ID ........................................................................................................ 853
Remote Method ....................................................................................................... 853

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

REST Handler ......................................................................................................... 853


Apex Remote Service .............................................................................................. 853
Apex Remote Input Map ........................................................................................... 853
Package .................................................................................................................. 854
API Parameters and Response Format ..................................................................... 854
Resource Information ............................................................................................... 854
Example Request .................................................................................................... 854
Example Result ....................................................................................................... 854
Get List of Products ......................................................................................................... 859
Remote Method ....................................................................................................... 860
REST Handler ......................................................................................................... 860
Apex Remote Service .............................................................................................. 860
Apex Remote Input Map ........................................................................................... 860
Package .................................................................................................................. 860
API Parameters and Response Format ..................................................................... 860
Resource Information ............................................................................................... 861
Example Request .................................................................................................... 861
Example Response .................................................................................................. 861
Get Lists of Values ........................................................................................................... 875
Remote Method ....................................................................................................... 875
Package .................................................................................................................. 875
API Parameters and Response Format ..................................................................... 875
Resource Information ............................................................................................... 876
Example Request .................................................................................................... 876
Example Response .................................................................................................. 876
Example Request .................................................................................................... 877
Example Response .................................................................................................. 877
Get Price Lists for Cart ..................................................................................................... 879
Remote Method ....................................................................................................... 879
REST Handler ......................................................................................................... 879
Apex Remote Service .............................................................................................. 879
Apex Remote Input Map ........................................................................................... 879
Package .................................................................................................................. 880
API Parameters and Response Format ..................................................................... 880
Resource Information ............................................................................................... 880
Example Request .................................................................................................... 880
Example Response .................................................................................................. 880
Get Price Waterfall for Price ............................................................................................. 881
Remote Method ....................................................................................................... 881
Package .................................................................................................................. 881
API Parameters and Response Format ..................................................................... 881
Resource Information ............................................................................................... 881
Example Request .................................................................................................... 882
Example Response .................................................................................................. 882
Get Products by ID .......................................................................................................... 883
Remote Method ....................................................................................................... 883

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

REST Handler ......................................................................................................... 883


Apex Remote Service .............................................................................................. 883
Apex Remote Input Map ........................................................................................... 883
Package .................................................................................................................. 884
API Parameters and Response Format ..................................................................... 884
Example Request .................................................................................................... 884
Example Response .................................................................................................. 884
Get Promotions Applied to Cart ........................................................................................ 891
Remote Method ....................................................................................................... 891
REST Handlers ....................................................................................................... 891
Apex Remote Service .............................................................................................. 891
Apex Remote Input Map ........................................................................................... 891
Package .................................................................................................................. 892
API Parameters and Response Format ..................................................................... 892
Resource Information ............................................................................................... 892
Example Request .................................................................................................... 892
Example Response .................................................................................................. 892
Get String Translation Dictionary ....................................................................................... 897
Apex Remote Service .............................................................................................. 897
Remote Method ....................................................................................................... 897
Package .................................................................................................................. 897
API Parameters and Response Format ..................................................................... 897
Example Response .................................................................................................. 897
Get String Translations ..................................................................................................... 898
Remote Action ......................................................................................................... 898
Remote Method ....................................................................................................... 899
Package .................................................................................................................. 899
API Parameters and Response Format ..................................................................... 899
Resource Information ............................................................................................... 899
Example Response .................................................................................................. 899
Post Cart Promotion Items ............................................................................................... 900
Remote Method ....................................................................................................... 901
REST Handler ......................................................................................................... 901
Apex Remote Service .............................................................................................. 901
Apex Remote Input Map ........................................................................................... 901
Package .................................................................................................................. 901
API Parameters and Response Format ..................................................................... 901
Resource Information ............................................................................................... 901
Example Request .................................................................................................... 901
Example Response .................................................................................................. 902
Price Items in Cart (Query) ............................................................................................... 906
Remote Method ....................................................................................................... 906
REST Handlers ....................................................................................................... 907
Apex Remote Service .............................................................................................. 907
Apex Remote Input Map ........................................................................................... 907
Package .................................................................................................................. 907

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

API Parameters and Response Format ..................................................................... 907


Resource Information ............................................................................................... 907
Example Request .................................................................................................... 907
Example Response .................................................................................................. 908
Remove Items from Cart .................................................................................................. 909
Remote Method ....................................................................................................... 910
REST Handler ......................................................................................................... 910
Apex Remote Service .............................................................................................. 910
Apex Remote Input Map ........................................................................................... 910
Package .................................................................................................................. 911
API Parameters and Response Format ..................................................................... 911
Resource Information ............................................................................................... 911
Example Request .................................................................................................... 911
Example Response .................................................................................................. 911
Run Pricing for Items to Cart ............................................................................................. 912
Remote Method ....................................................................................................... 912
REST Handler ......................................................................................................... 912
Apex Remote Service .............................................................................................. 912
Apex Remote Input Map ........................................................................................... 912
Package .................................................................................................................. 912
API Parameters and Response Format ..................................................................... 912
Resource Information ............................................................................................... 913
Example Request .................................................................................................... 913
Example Response .................................................................................................. 913
Submit a Cancel Order Request ....................................................................................... 914
Apex Method ........................................................................................................... 915
Package .................................................................................................................. 915
API Parameters and Response Format ..................................................................... 915
Resource Information ............................................................................................... 915
Example Request .................................................................................................... 916
Example Request Body ............................................................................................ 916
See Also ................................................................................................................. 916
Unfreeze Order ................................................................................................................ 916
Apex Method ........................................................................................................... 916
Package .................................................................................................................. 917
API Parameters and Response Format ..................................................................... 917
Resource Information ............................................................................................... 917
Example Request .................................................................................................... 917
Example Request Body ............................................................................................ 917
See Also ................................................................................................................. 917
Update Item Attributes ..................................................................................................... 917
Remote Method ....................................................................................................... 918
Handlers ................................................................................................................. 918
Apex Remote Service .............................................................................................. 918
Apex Remote Input Map ........................................................................................... 918
Package .................................................................................................................. 918

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

API Parameters and Response Format ..................................................................... 918


Resource Information ............................................................................................... 918
Example Request .................................................................................................... 918
Example Request Body ............................................................................................ 918
Example Response .................................................................................................. 922
Update Items in Cart ........................................................................................................ 925
URI ......................................................................................................................... 926
HTTP Method .......................................................................................................... 926
Request Parameters ................................................................................................ 926
Query Parameters, Requests, and Responses .......................................................... 926
Remote Method ....................................................................................................... 926
REST Handler ......................................................................................................... 947
Example REST Request .......................................................................................... 947
Example Response .................................................................................................. 948
See Also ................................................................................................................. 958
Update String Translations ............................................................................................... 958
Apex Remote Service .............................................................................................. 959
Remote Parameters ................................................................................................. 959
Remote Method ....................................................................................................... 959
Package .................................................................................................................. 959
Example Request Body ............................................................................................ 959
Example Response .................................................................................................. 960
Validate Cart Action ......................................................................................................... 960
Remote Method ....................................................................................................... 960
REST Handler ......................................................................................................... 960
Apex Remote Service .............................................................................................. 960
Apex Remote Input Map ........................................................................................... 960
Package .................................................................................................................. 961
API Parameters and Response Format ..................................................................... 961
Resource Information ............................................................................................... 961
Example Request .................................................................................................... 961
Example Response .................................................................................................. 961
Pre- and Post-Processing Logic for CPQ APIs ................................................................... 964
Overview of Creating a CpqAppHandler Hook ................................................................... 965
Workflow for Creating a CpqAppHandler Hook .......................................................... 965
See Also ................................................................................................................. 966
Uses of CpqAppHandlerHook ................................................................................... 966
Review the Billing Zip Code Custom Field ................................................................. 969
Create an Attribute Pricing Matrix for the Billing Zip Code ........................................... 970
Create an Attribute Pricing Procedure for the Billing Zip Code ..................................... 972
Create a Custom Pricing Plan Step for the Billing Zip Code ........................................ 973
Create a New Apex Class ........................................................................................ 975
Create the CpqAppHandlerHookImplementation ........................................................ 976
Add a New Column to Vlocity Cart ............................................................................ 977
Add the Billing Zip Code as a Custom Field in Vlocity Cart .......................................... 983
Test in Vlocity Cart ................................................................................................... 985

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

CpqAppHandlerHook Troubleshooting Guide ............................................................. 986


CpqAppHandlerError Codes for Cart-Based APIs .............................................................. 987

© 2021 Vlocity LLC, a Salesforce


company
CME CPQ

Vlocity Configure, Price, Quote (CPQ)

Vlocity CPQ provides extensions to native Salesforce capabilities to support Opportunity, Order, and Quote
processing.

Using asset-based ordering, you can select, price, and configure products, ensuring that the quoted
solution is right for the customer. You can assemble products based on attributes, provide opportunity
forecasting, and enable shopping cart interactions. In addition, CPQ enables you to convert opportunities to
quotes, quotes to orders, orders to assets, assets to orders, and assets to quotes.

Using Interfaces and Implementations, you can selectively use Vlocity components, services, and UI
elements. Through a unified UI, you can access data that is located in Salesforce or external systems. You
can customize the interfaces, replace them, or preserve your existing business logic. You can choose the
implementation that best fits your needs or you can create your own.

Orders are affected by availability, eligibility, compatibility, and pricing rules. Rules link qualifying criteria and
actions. A defined rule applies to an object, such as an opportunity, an order, or a quote. See Rules.

At the point in the order process when Vlocity generates the price quote for a product, bundle, or promotion,
Vlocity runs the availability interface to determine if the item is available at the customer's location. For
example, a customer could be inquiring about high-speed Internet service, but their building may not have
fiber option cabling.

Next, Vlocity runs the eligibility interface to ensure that the customer is eligible to purchase the item. For
example, an existing customer would not be eligible to purchase an item that is available only for new
customers.

Vlocity checks all products for availability and eligibility before displaying them to the customer for product
selection.

You can also configure a Vlocity compatibility or validation interface to enforce purchasing required
products or to recommend additional products on the order. You can define product relationships to relate
products to one another.

After the availability and eligibility interfaces run, Vlocity applies pricing to the entire order using flows.
Flows consist of individual pricing rules applied in sequence, which produces the specified price.

After the items in the order are priced, applicable taxes are calculated and added, and the pricing is saved
to the order. The order is ready to move through the next steps in the order management process.

© 2021 Vlocity LLC, a Salesforce


company 1
CME CPQ

Figure 1. Vlocity Order Pricing Flow

© 2021 Vlocity LLC, a Salesforce


company 2
CME CPQ

Each process has several functional components:

Figure 2. Process Flow

• Trigger event: Initiates an interaction with the Vlocity Component Object Model (COM) functional stack. A
trigger event can be external or internal and can trigger a Vlocity interface or implementation, or a COM
class directly. Trigger events include:
• CPQ UI widgets
• Vlocity OmniScripts
• Vlocity mobile applications
• Vlocity communities
• Customer self-service websites
• Partner websites
• Custom mobile applications
• Interface/Implementation: A trigger event runs a Vlocity interface, which then calls the active interface
implementation. There may be multiple implementations for one interface, but only one implementation
can be active. See Interfaces, Implementations, and Services.
• Flow: An interface implementation initiates a workflow, which defines a sequence of events, including
rules, process logic, and custom processing options. Flows are based on Salesforce flow features.
Vlocity extends flows to support the flow of objects, such as orders and quotes, providing eligibility,
compatibility, and pricing. Flows also support branching, embedding, and flow actions. Flows are
reusable.
• Flow rule: You can create and implement rules for availability, eligibility, compatibility, and pricing. Build
rules using natural language, so you can remember what the rule does now and six months from now.
• Entity filter: Rules use entity filters to determine which items in the order are subject to the rule action.
Rules can include one or many filters, depending on the business logic the rule implements. Entity filters

© 2021 Vlocity LLC, a Salesforce


company 3
CME CPQ

are reusable. For example, as part of a promotion, you might create a filter to identify premises where the
service activation date is 45 days or less. Once created, that filter is available for use in any rule that
needs to use it.
• Conditional action: Rule actions define the changes that a rule makes on qualified objects. A rule action
can be an offering procedure, a product relationship, a calculation procedure, or another procedure, such
as a call to Apex code. Different rule types use different rule actions.

See Interface and Implementation Workflows.

© 2021 Vlocity LLC, a Salesforce


company 4
CME CPQ

Vlocity Order Capture

Vlocity's order-capture capabilities enable you to manage the order capture flow using Vlocity Cart and an
asset-based ordering system.

Vlocity order-capture capabilities are integral to Vlocity CPQ, which enables you to design and apply
business rules that ensure products and services are:

• Available to the business or consumer account.


• Items for which the customer is eligible.
• Priced accurately.
• Compatible with any existing products and services held by the customer account.

Customer service representatives and sales teams can perform a variety of business tasks through guided
selling to capture the perfect customer order. The product-service-resource (PSR) data from Vlocity
Enterprise Product Catalog (EPC) supports the Vlocity solution with a shared, central single point of truth
for all PSR data.

Order-Capture Flow

Order capture flows include:

• B2B flow: Starts from a business account by creating an opportunity, a quote, or an order. An opportunity
becomes a quote and a quote becomes an order. When completed, the order becomes an asset. If the
customer wants to change the asset, the asset is moved to an order or a quote. A contract is often
injected after the order is created but before the asset is created, but scenarios vary.
• B2C flow: Starts from a consumer account by creating an order. When completed, the order becomes an
asset. If the customer wants to change the asset, the asset is moved to an order.

Vlocity order capture extends the native capabilities of Salesforce to provide comprehensive management
of the order-capture flow between the following standard Salesforce objects:

• Opportunity represents a sale or pending deal. Order capture uses opportunities for business accounts.
Opportunities include details about the stage of an opportunity cycle—for example, in process or
completed. If an opportunity becomes a quote or an order, information from the opportunity moves
forward. Opportunities are identified by their stage, such as prospecting, identifying decision-makers, or
negotiation/review. Opportunities also include the projected success, in percentages. Order capture fully
integrates opportunities, quotes, and orders to accommodate asset-based ordering.
See Creating an Opportunity.
• Quote represents a record that includes proposed prices for products and services. You can create
quotes from opportunities. You can email quotes as PDF files to customers. Quotes capture additional

© 2021 Vlocity LLC, a Salesforce


company 5
CME CPQ

information, such as originating source or campaign, installation ZIP code, state, associated purchase
order, and one-time or recurring charges. Order capture integrates opportunities, orders, and quotes to
accommodate asset-based ordering.
See Creating a Quote.
• Order represents an order for products or services associated with an account. Orders consist of header
information followed by line items of individually ordered products or services. Order capture fully
integrates opportunities, orders, and quotes to accommodate asset-based ordering.
See Creating an Order Using Vlocity Cart.
• Asset is a standard Salesforce object that represents an item of commercial value, such as a product or
service sold by your company or a competitor, that an account or contact owns. Order capture provides
extensions to the Asset object support discounts, special pricing, and customer preferences.
See Asset-Based Ordering.

Creating an Order Using Vlocity Cart


Vlocity Cart is Vlocity's shopping-cart UI, which was developed using the Vlocity Cards Framework.

You can modify the appearance and behavior of the cart to customize it according to your specific business
requirements. The Vlocity Cards Framework provides configurable cards, layouts, and templates, which are
UI building blocks included out-of-the-box.

Vlocity Cart is split into two parts: the list and cart panes. The list pane is on the left and the cart pane is on
the right.

There are two tabs on the left side of the cart: the Products and Promotions tabs. A Discounts tab appears
if discounts are defined.

© 2021 Vlocity LLC, a Salesforce


company 6
CME CPQ

To create an order using Vlocity Cart:

1. On the Orders tab, click New.


The New Order dialog box is displayed.

2. Enter the following information:


• Account Name is a lookup to the account associated with the order.
• Order Start Date is the date on which the order becomes effective.
• Status is the stage the order has reached.
For more information about other fields, see Order Fields in the Salesforce Help.
3. Click Save.
4. On the Order record detail page, click Configure Order or ConfigureWithNamespace.

© 2021 Vlocity LLC, a Salesforce


company 7
CME CPQ

5. Select the Price List.


6. In the Products list, click Add to Cart to add products and services to the order.
The Cart displays the selected products.

The total bar displays the price totals of the items in the cart. By default, the total bar includes the
recurring total, one-time total, and order total.

NOTE
If a required attribute is missing, an error message appears at the top of the cart. To
fix the error, click the Details icon, which resembles an eye. For more information, see
Configure a Product Using Vlocity Cart.

7. To configure the products, click the arrow on the right.


See Configure a Product Using Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 8
CME CPQ

You can also clone, inspect, and delete products in Vlocity Cart. See Working with Line Items in Vlocity
Cart and Deleting a Line Item From the Cart.
8. When you complete configuring line items, click Submit Order.
If you are using Vlocity CME Winter '20, a message appears that displays the result of the order
submission. The result can be a successful submission or rejection of the order or assetization of the
product based on the response from Order Management.

WARNING
Do not create an order by cloning a previous order. The Clone button in the Salesforce
Classic (Aloha) interface is not intended to work with Vlocity orders and can cause serious
errors.

See Also
• Cancel an In-Flight Order
• Amend In-Flight Orders

Going to Vlocity Cart


In the Salesforce Classic (Aloha) interface, you can use the CPQ button to open Vlocity Cart. In Salesforce
Lightning, you can use the Configure or configureWithNamespace button.

To go to Vlocity Cart:
1. On an Order record detail page, click the relevant button: CPQ, Configure, or
ConfigureWithNamespace.

2. To exit Vlocity Cart, click View Record, located in the upper right corner of the cart page.

© 2021 Vlocity LLC, a Salesforce


company 9
CME CPQ

WARNING
Do not create an order by cloning a previous order. The Clone button in the Salesforce
Classic (Aloha) interface is not intended to work with Vlocity orders and can cause serious
errors.

Expanding and Collapsing the List Pane


You can expand and collapse the Products list and Promotions list.

© 2021 Vlocity LLC, a Salesforce


company 10
CME CPQ

To collapse the Products list and Promotions list:

• Click the vertical ellipsis (three dots) that appears between the list and the cart.

Configuring a Product Using Vlocity Cart


You can configure a product using the Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 11
CME CPQ

If a required attribute is missing, an error message appears at the top of the cart and the eye icon is
highlighted. To fix the error, click the down arrow for the line item and select Configure. This feature is
called Take Me There. An error message appears at the cart level and at the line item attribute level. There
is one cart-level message per root item ID. That is, at the cart level, there is one error message per bundle.
The cart-level message can call the action getCartsItemsById, which fetches the entire hierarchy of the
root item.

To configure a product in the Vlocity Cart:

1. Click the down arrow for the line item and select Configure.
The criteria you can configure depend on the line item.

2. When you are finished configuring the product, click Close.

Searching for Products and Promotions


Vlocity Cart provides a search feature for products and promotions that are included in the selected price
list.

To search for products in Vlocity Cart:

1. Click the Products list tab.


2. In the Search box, enter the search term.

© 2021 Vlocity LLC, a Salesforce


company 12
CME CPQ

3. Press Enter.

To search for promotions in Vlocity Cart:

1. Click the Promotions list tab.


2. In the Search box, enter the search term.
3. Press Enter.

© 2021 Vlocity LLC, a Salesforce


company 13
CME CPQ

© 2021 Vlocity LLC, a Salesforce


company 14
CME CPQ

NOTE
A promotion must belong to the same price list as the order to which is it added.
Otherwise, the promotion does not appear in the Vlocity Cart Promotions list.

Just above the Promotions list or Products list are the Qualified and Disqualified tabs. The items that
appear here depend on context rules. Qualified items can be added to the cart and ordered. Disqualified
items cannot be added to the cart for this account.

The prices displayed in the Products list are the base prices for the product, service, or offer.

Viewing Promotions In Vlocity Cart


The Promotions tab lists the promotions in the cart.

By default, all promotions are displayed. From the picklist in the left corner, you can select the following
options:

• All displays all promotions in the cart.


• Active displays the currently active promotions in the cart. Use the date picker to see promotions that are
active for specific dates.

© 2021 Vlocity LLC, a Salesforce


company 15
CME CPQ

• Expired displays the expired promotions in the cart. Expired promotions have passed their effectivity
dates.
• Canceled displays the canceled promotions.

Working with Line Items in Vlocity Cart


You can expand the Vlocity Cart's items to see its child items.

Vlocity Cart has the following tabs:

• Cart: Displays all of the items in the cart


• Promotions: Displays only the promotions in the cart

Click the arrow to the left of an item name to expand it and see its child items.

© 2021 Vlocity LLC, a Salesforce


company 16
CME CPQ

A blue flag indicates that the item is a draft line item. An orange flag indicates that the item is an asset.

© 2021 Vlocity LLC, a Salesforce


company 17
CME CPQ

You can click any price to adjust it and see the price details.

• The Change Price button resembles a pencil.


• The Price Details button is a lowercase i in a circle.

On the far right, click the Show Actions button to reveal actions:

• Inspect
• Clone
• Configure
• Delete

© 2021 Vlocity LLC, a Salesforce


company 18
CME CPQ

Cardinality: Minimum and Maximum Quantities


Most order line items have a minimum and maximum value allowed, which Vlocity Cart enforces in the
Quantity for each line item. In the Vlocity EPC database, the product data model defines the cardinality of
product child items, which are displayed as order line items in Vlocity Cart. Cardinality is like a rule that
ensures you specify the right quantities in the cart: not too many, and not too few.

For example, a business account may be allowed to purchase up to two Complete TV products, with the
purchase of the product optional. In this case, the underlying Vlocity EPC data model defines the following
cardinality for the Complete TV product:

• Minimum: 0
• Maximum: 2

With this cardinality defined, if you try to specify a quantity of 3, the cart notifies you that you can only add
up to 2 Complete TV products.

See Cardinality of Child Products in a Bundle.

© 2021 Vlocity LLC, a Salesforce


company 19
CME CPQ

Deleting a Line Item From the Cart


If a line item is not part of a promotion, you can delete it from Vlocity Cart.

To delete a line item from Vlocity Cart:

1. To the right of the line item to delete, click the Show Actions button.

2. Select Delete.

Overriding Default Functions


To override default JavaScript functions, the descendant class can override certain behavior in the ancestor
class by specifying the modified behavior in protected methods (similar to the object-oriented technique of
Java protected methods).

NOTE
For details about adding pre- and post-processing logic, see Adding Pre- and Post-
Processing Logic.

This mechanism enables customers to override a function of the default JavaScript controller. The function
must meet the following criteria:

• The function must be a scope function, that is, $scope.function.


• The function must be defined in the allowlist. Using an allowlist avoids abusive overrides of key
functionality.

You can override the following controllers:

© 2021 Vlocity LLC, a Salesforce


company 20
CME CPQ

Controller Functions
CPQPromotionItemController $scope.beforeAddToCartHook(payload)
$scope.afterAddToCartHook(payload)
CPQPromotionsController $scope.beforeDeletePromotionItemHook(payload)
scope.afterDeletePromotionItemHook(payload);
CPQCartItemController $scope.beforeAddToCartHook(payload)
$scope.afterAddToCartHook(payload);
$scope.beforeDeleteItemFromCartHook(payload)
$scope.afterDeleteItemFromCartHook(payload)

TIP
Using this approach to override functions decreases maintenance and the risk of missing
functionality in future releases. It also decreases maintenance needs.

To override a controller:

1. Create a new controller.


2. Go the Vlocity Template that contains the function to override.
3. On the HTML Code tab, enter the appropriate markup to initialize the custom controller. For example:
<div ng-controller="customOverrideController"></div>
4. On the JavaScript Code tab, enter the appropriate code to register the custom controller and override
the default function using CPQOverrideService.

Example 1. Sample Controller Override


vlocity.cardframework.registerModule.controller('customOverrideController',
['$scope', 'CPQOverrideService', function($scope, CPQOverrideService) {
#var overrideFunctions = {
'beforeAddToCartHook': function(parent, obj) {
alert('Hurray!');;
}
};

CPQOverrideService.addToOverrideList('CPQCartItemController',
overrideFunctions);
}]);

© 2021 Vlocity LLC, a Salesforce


company 21
CME CPQ

Adding Pre- and Post-Processing Logic


When adding or deleting products or promotions, you can define pre- and post-processing logic to be
executed before and after the cart is modified by defining a method containing the desired logic and
assigning it to the corresponding pre- or post-processing hook.

Example

$scope.beforeAddToCartHook = myBeforeAddToCartHookMethod(myHookPayload)
{...logic goes here...};

The following hooks are available.

CPQPromotionItemController:

• $scope.beforeAddToCartHook(payload);
• $scope.afterAddToCartHook(payload);

CPQPromotionsController:

• $scope.beforeDeletePromotionItemHook(payload);
• $scope.afterDeletePromotionItemHook(payload);

CPQProductItemController:

• $scope.beforeAddToCartHook(payload);
• $scope.afterAddToCartHook(payload);

CPQCartItemController:

• $scope.beforeAddToCartHook(payload);
• $scope.afterAddToCartHook(payload);
• $scope.beforeDeleteItemFromCartHook(payload);
• $scope.afterDeleteItemFromCartHook(payload);
• $scope.getAlternativePaymentFieldMapHook(data);

Vlocity Cards for CPQ


Vlocity Cart is Vlocity Communications' shopping-cart UI, which was developed using the Vlocity Cards
Framework.

You can modify the appearance and behavior of the cart to customize it according to your specific business
requirements. The Vlocity Cards Framework provides configurable cards, layouts, and templates, which are
UI building blocks included out-of-the-box with the Vlocity Communications managed package.

Layouts can call the Vlocity omnichannel web APIs to retrieve data. Templates and cards display that data.
The cards-based CPQ user interface uses the HybridCPQ Visualforce page, not the typical Console Cards
page.

© 2021 Vlocity LLC, a Salesforce


company 22
CME CPQ

You can use Assets Visualforce pages to render assets on the Account record detail pages. You can use
the Review Order Cart read-only Visualforce page to render a read-only review cart on the Order record
detail pages. Cards, templates, and layouts control these areas as well.

Vlocity Communications, Media, and Energy uses the following Vlocity Cards, Layouts, and Templates.

NOTE
To implement Vlocity Cards for usage-based pricing for energy, see Enable Usage Pricing.

Name Element Description Related To Data Source


comp-assets- layout Provides structure for the comp-assets- None
base-grid cards-based Assets and base-grid
(layout) Review Cart Visualforce (template)
pages.
comp-assets- template Provides space for the cards- comp-assets- n/a
base-grid based Assets and Review Cart base-grid (layout)
(template) Visualforce pages.
comp-assets- layout Provides structure for assets comp-assets- Dual
contract-layout that are listed by contract on contract
the cards-based Assets and (template) getAssetsByContract
Review Cart Visualforce
pages. comp-assets-
product-item
(card)
comp-assets- template Groups assets by contract IDs. n/a n/a
contract-load
(template)
comp-assets- card Renders the date picker and comp-assets-
contract (card) other items in the header products
portion of the space that (template)
displays the assets in the
cards-based Assets and comp-assets-
Review Cart Visualforce contract-layout
pages, when assets are
comp-assets-no-
grouped by contract.
contract (card)

comp-assets-no-
contract-layout
comp-assets- template Provides space for assets that comp-assets- n/a
contract are listed by contract on the contract-layout
(template) cards-based Assets and
Review Cart Visualforce
pages.
comp-assets- template Renders the banner at the top comp-assets- n/a
header-card of the cards-based Assets and header (card)
(template) Review Cart Visualforce
pages. comp-assets-
header (layout)

© 2021 Vlocity LLC, a Salesforce


company 23
CME CPQ

Name Element Description Related To Data Source


comp-assets- card With the comp-assets-header- comp-assets- None
header (card) card template, renders the header-card
banner at the top of the cards- (template)
based Assets and Review Cart
Visualforce pages. comp-assets-
header (layout)
comp-assets- layout Provides the structure for the comp-assets- Dual
header (layout) banner at the top of the cards- header
based Assets and Review Cart (template) getAccounts
Visualforce pages.
comp-assets-
header (card)
comp-assets- template Provides the space for the comp-assets- n/a
header banner in the cards-based header (layout)
(template) Assets and Review Cart
Visualforce pages. comp-assets-
header (card)
comp-assets- layout Provides the structure for the comp-assets- None
info-panel info panel in the cards-based info-panel
(layout) Assets and Review Cart (template)
Visualforce pages.
comp-assets- template Renders the info panel in the comp-assets- n/a
info-panel cards-based Assets and info-panel
(template) Review Cart Visualforce (layout)
pages.
comp-assets- template Renders the space for assets comp-assets- n/a
load (template) that are not grouped by products (layout)
contract in the cards-based
Assets and Review Cart comp-assets-
Visualforce pages. contract (card)

comp-assets-no-
contract (card)

comp-assets-no-
contract-layout
comp-assets- layout Provides structure for assets comp-assets-no- Dual
no-contract- that are not associated with contract
layout contracts on the cards-based (template) getAssetsByAccount
Assets and Review Cart
Visualforce pages. comp-assets-
product-item
(card)
comp-assets- card Renders the date picker and comp-assets- Sample
no-contract other items in the header load (template)
(card) portion of the space that
displays the assets in the
cards-based Assets and
Review Cart Visualforce
pages, when assets are not
grouped by contract.
comp-assets- template Provides space for assets that comp-assets-no- n/a
no-contract are not associated with contract-layout
(template) contracts on the cards-based
Assets and Review Cart
Visualforce pages.

© 2021 Vlocity LLC, a Salesforce


company 24
CME CPQ

Name Element Description Related To Data Source


comp-assets- layout Provides the structure for each comp-assets- Parent
product- child product item on the product-children
children cards-based Assets and (template)
(layout) Review Cart Visualforce
pages. comp-assets-
product-item-
child (card)
comp-assets- template Provides the space for each comp-assets- n/a
product- child product item on the product-children
children cards-based Assets and (layout)
(template) Review Cart Visualforce
pages.
comp-assets- card Renders each child product on comp-assets- None
product-item- the cards-based Assets and product-item
child (card) Review Cart Visualforce (template)
pages.
comp-assets-
product-children
(layout)
comp-assets- template Displays the details of the child comp-assets- n/a
product-item- element in an asset bundle in product-children
child (template) the cards-based Assets and (layout)
Review Cart Visualforce
pages.
comp-assets- card Renders the space for comp-assets- None
product-item products listed by contracts on product-item
(card) the cards-based Assets and (template)
Review Cart Visualforce
pages. cpq-card-blank
(template)

comp-assets-
contract-layout
comp-assets- template Provides the space for comp-assets- n/a
product-item products listed by contracts on product-item
(template) the cards-based Assets and (card)
Review Cart Visualforce
pages. comp-assets-
product-item-
child (card)
comp-assets- layout Provides the structure for the comp-assets- None
products space for assets that are not products
(layout) grouped by contract in the (template)
cards-based Assets and
Review Cart Visualforce comp-assets-
pages. contract (card)

comp-assets-no-
contract (card)

comp-assets-no-
contract-layout

© 2021 Vlocity LLC, a Salesforce


company 25
CME CPQ

Name Element Description Related To Data Source


comp-assets- template Renders the header portion of comp-assets- n/a
products the space that displays the contract (card)
(layout) assets in the cards-based
Assets and Review Cart comp-assets-no-
Visualforce pages. contract (card)

comp-assets-no-
contract-layout
comp-assets- card Renders the products on the comp-assets- None
promotions- Promotions tab on the cards- promotions
card based Assets and Review Cart (layout)
Visualforce pages.
comp-assets-
promotions
(template)

cpq-card-blank
(template)
comp-assets- layout Provides the structure for the comp-assets- Dual
promotions Promotions tab on the cards- promotions
(layout) based Assets and Review Cart (template) getAppliedPromotionsByAccount
Visualforce pages.
comp-assets-
promotions-card
comp-assets- template Provides the space for the comp-assets- n/a
promotions Promotions tab on the cards- promotions
(template) based Assets and Review Cart (layout)
Visualforce pages.
comp-assets-
promotions-card
comp-assets- template Contains CSS variables used all assets n/a
theme- in other templates. templates
variables
comp-cart- layout Provides the structure for the comp-cart- None
review-base- Review Cart Visualforce page. review-base-grid
grid (layout) (template)
comp-cart- template Provides the space for the comp-cart- n/a
review-base- Review Cart Visualforce page. review-base-grid
grid (template) (layout)
comp-cart- layout Provides the structure for the comp-cart-review Dual
review (layout) main panel of the Review Cart (template)
Visualforce page. getCartsItems
comp-assets-
product-item
(card)
comp-cart- template Provides the space for the comp-cart-review n/a
review main panel of the Review Cart (layout)
(template) Visualforce page.
cpq-base-grid layout Provides the underlying cpq-base-grid None
(layout) structure for the CPQ interface. (template)
cpq-base-grid template Provides a three-column cart cpq-base-grid n/a
(template) interface with the total bar (layout)
along the bottom of the page.
cpq-base- template Provides the text and buttons cpq-header n/a
header-card and their format for the cart (card)
(template) header.

© 2021 Vlocity LLC, a Salesforce


company 26
CME CPQ

Name Element Description Related To Data Source


cpq-base- layout Calls the getListsOfValues cpq-base- Dual
header- API to provide the user header-payment-
payment- payment choices in Vlocity choice (template) getListsOfValues
choice (layout) Cart.
cpq-base- template Renders the Payment Choice cpq-base- n/a
header- drop-down list in Vlocity Cart. header-payment-
payment- choice (layout)
choice
(template)
cpq-base- layout Renders the picklist that cpq-base- Dual
header-pricelist displays the price lists in the header-pricelist
(layout) upper left corner of Vlocity (template) getPriceLists
Cart.
cpq-base- template Calls changePricelist to cpq-base- changePricelist
header-pricelist assign the price list the agent header-pricelist
(template) selects. (layout)
cpq-base- template Provides the structure for the cpq-header n/a
header cart header. (layout)
(template)
cpq-header
(card)
cpq-base- template Contains CSS variables used comp-assets- n/a
theme- in other templates. theme-variables
variables
cpq-theme-
variables
cpq-base- template Contains CSS variables used cpq-base-theme- n/a
variables in other templates and themes. variables
cpq-card-blank template Empty template to create a cpq-cart-applied- n/a
(template) custom view. promotions-card
and cpq-cart-
promotions (card)

cpq-product-cart-
item (card)

comp-assets-
product-item
(card)

comp-assets-
promotions-card

© 2021 Vlocity LLC, a Salesforce


company 27
CME CPQ

Name Element Description Related To Data Source


cpq-card-mixin template Displays the bundle hierarchy comp-assets- n/a
(template) in Vlocity Cart. product-item-
child (card)

comp-assets-
product-item-
child (template)

cpq-product-cart-
item-child (card)

cpq-product-cart-
item-child
(layout)

cpq-product-cart-
item-child
(template)

cpq-product-cart-
item (template)
cpq-cart-item- card Renders the information in the cpq-cart-item- None
detail (card) Line Item Details dialog box. detail (layout)

cpq-product-cart-
item (template)
cpq-cart-item- layout Provides the interface for the cpq-cart-item- getCartsItems
detail (layout) Line Item Details dialog box. details (template)
or cpq-cart-item-details card
cpq-cart-item-
detail (card)
cpq-cart-item- template Provides the structure for the cpq-cart-item- n/a
details cards in the Line Items lookup (layout)
(template) Details dialog box.
cpq-cart-item-
detail (card)
cpq-cart-item- layout Provides the Cart Item cpq-cart-item- getAvailableSites
lookup (layout) Lookup Field dialog box. lookup (template)
cpq-cart-item- template Provides the structure for the cpq-cart-item- n/a
lookup Cart Item Lookup Field dialog lookup (layout)
(template) box.
cpq-cart- card Renders each individual cpq-cart- None
promotions applied promotion in the cart. promotions
(card) (layout)

cpq-card-blank
(template)
cpq-cart- layout Renders the list of applied cpq-cart- Dual
promotions promotions in the cart. promotions
(layout) (template) getPromotionsAppliedToCart

cpq-cart-
promotions (card)
cpq-cart- template Retrieves the list of applied cpq-cart- n/a
promotions promotions in the cart. promotions
(template) (layout)

© 2021 Vlocity LLC, a Salesforce


company 28
CME CPQ

Name Element Description Related To Data Source


cpq-config-attr- template Created to support custom none n/a
custom-action- actions in the Vlocity Cart
template1 and information panel. Adds
cpq-config-attr- functionality with a lookup field
custom-action- for a phone number.
template2
cpq-header card Displays the cart header cpq-base- getCarts
(card) content. header-card
(template)

cpq-header
(layout)
cpq-header layout Provides the header for the cpq-base-header None
(layout) cart. (template)

cpq-header
(card)
cpq-input- template Sample template to show how none n/a
custom- to provide a custom template
template- for a field in the Vlocity Cart
sample information panel.
cpq-left-sidebar layout Displays the sidebar that cpq-left-sidebar None
(layout) contains the Product list and (template)
Promotions list.
cpq-left-sidebar template Provides structure for the cpq-left-sidebar n/a
(template) Product list and Promotions (layout)
list in Vlocity Cart.
cpq-mixin template Generates padding styles for All templates n/a
the product name in a
hierarchy in Vlocity Cart.
cpq-product- card Contains the editable fields cpq-product-cart- None
card-config- that the user can update on the config (template)
card product configuration panel.
cpq-product-cart-
config (layout)
cpq-product- layout Renders the configuration cpq-product-cart- None
cart-config panel in the cart. config (template)
(layout)
cpq-product- template Provides the structure for the cpq-product-cart- n/a
cart-config configuration panel in the cart. config (layout)
(template)
cpq-product- flyout Displays the Price Details cpq-product-cart- None
cart-item-cell- dialog box. item-cell-detail
detail (flyout) (template)
cpq-product- template Provides structure for the Price n/a
cart-item-cell- Details dialog box.
detail
(template)
cpq-product- template Renders the Payment Choice cpq-product-cart- n/a
cart-item-cell- drop-down list for a single line item-cell-
payment- item in Vlocity Cart. payment-choice
choice (template)
(template)

© 2021 Vlocity LLC, a Salesforce


company 29
CME CPQ

Name Element Description Related To Data Source


cpq-product- flyout Displays the Apply Discount cpq-product-cart- None
cart-item-cell- dialog box item-cell-pricing
pricing (flyout) (template)
cpq-product- template Provides structure for the cpq-product-cart- n/a
cart-item-cell- Apply Discount dialog box. item-cell-pricing
pricing (flyout)
(template)
cpq-product- card Renders each child-level line cpq-product-cart- None
cart-item-child item in Vlocity Cart. item-child
(card) (template)
cpq-product- layout Displays child-level product cpq-product-cart- Parent
cart-item-child information in Vlocity Cart. item-child
(layout) (template)

cpq-cart-item-
child-products
card
cpq-product- template Provides the structure for the cpq-product-cart- n/a
cart-item-child child-level product information item-child
(template) in Vlocity Cart. (layout)
OBSOLETE

cpq-product-
cart-item-delete
cpq-product- card Displays each line item in a cpq-product-cart None
cart-item (card) cart. (layout)

cpq-product-cart-
item (template)
cpq-product- template Provides the structure for the cpq-cart-item- n/a
cart-item Line Item Details dialog box. detail (card)
(template)
cpq-product- template Provides the structure for each cpq-product-cart- n/a
cart-item line item in the cart. Display the item (card)
(template) root level product information
in the cart.
cpq-product- layout Provides the structure for the cpq-product-cart getCartsItems
cart (layout) product cart. (template)

cpq-product-cart-
item (card)
cpq-product- template Provides the structure for the cpq-product-cart n/a
cart (template) cart. (layout)
cpq-product- layout Renders custom actions in the cpq-product- Custom
config-custom- CPQ user interface. config-custom-
action action (template)
cpq-product- template Provides a very basic structure cpq-product- n/a
config-custom- on which you can base custom config-custom-
action actions. action layout
(template)
cpq-product- card Displays the details for one cpq-product-item- None
details (card) product in the Product Details more (layout)
dialog box.
cpq-product-item-
details (template)

© 2021 Vlocity LLC, a Salesforce


company 30
CME CPQ

Name Element Description Related To Data Source


cpq-product- layout Renders the filterable attributes cpq-product- getCartsAttributes
filters (layout) list panel, including the Reset filters (template)
and Apply buttons.
cpq-product- template Renders the filterable attributes cpq-product- n/a
filters list panel, including the Reset filters (layout)
(template) and Apply buttons.
cpq-product- template Provides the structure for each cpq-product- n/a
item-details product in the Product Details details (card)
(template) dialog box.
cpq-product- layout Renders the Product Details cpq-product-item- getCartsProducts
item-more dialog box. more (template)
(layout) flyout
cpq-product-
details (card)
cpq-product- template Provides the base structure for cpq-product-item- n/a
item-more the Product Details dialog more (layout)
(template) box.
cpq-product- card Displays each product in the cpq-product-list None
item (card) product list in the cart. (layout)

cpq-product-item
(template)

cpq-product-item-
more (template)
flyout
cpq-product- template Provides the structure for each cpq-product-item n/a
item (template) product in the product list in the (card)
cart.
cpq-product-list layout Renders the product list in the cpq-product-list getCartsProducts
(layout) cart, including the search box (template)
and filter.
cpq-product-item
(card)
cpq-product-list template Provides the structure for the cpq-product-list n/a
(template) product list in the cart. (layout)
cpq-promotion- card Renders each individual cpq-promotions- None
item (card) promotion line item in Vlocity list (layout)
Cart.
cpq-promotion-
item (template)
cpq-promotion- template Provides the structure for an cpq-promotion- n/a
item (template) individual promotion line item item (card)
in Vlocity Cart.
cpq- layout Renders the Promotions list in cpq-promotions- Dual
promotions-list Vlocity Cart. list (template)
(layout) getCartsPromotions
cpq-promotion-
item (card)
cpq- template Provides the structure for the cpq-promotions- n/a
promotions-list Promotions list in Vlocity Cart. list (layout)
(template)
cpq-slds- layout Provides the container for the cpq-slds-prompt n/a
prompt (layout) template to customize prompts (template)
in Vlocity Cart

© 2021 Vlocity LLC, a Salesforce


company 31
CME CPQ

Name Element Description Related To Data Source


cpq-slds- template Enables customizing prompts cpq-slds-prompt n/a
prompt in Vlocity Cart. (layout)
(template)
cpq-theme- template Contains CSS variables used all CPQ n/a
variables in other templates. templates
cpq-total-bar- card Renders the total bar in the cpq-total-card None
card cart. (template)

cpq-total-bar
(layout)
cpq-total-bar layout Renders the total bar in the cpq-total-bar getCarts
(layout) cart. (template)

cpq-total-bar-
card
cpq-total-bar template Provides the structure for the cpq-total-bar n/a
(template) total bar in the cart. (layout)

cpq-total-card template Provides the text and buttons, cpq-total-bar- n/a


(template) as well as their styling, for the card
total bar in the cart

NOTE
The following templates, layouts, and card were deleted from Vlocity Communications,
Media, and Energy Summer '17:

• cpq-product-addon (template and layout)


• cpq-product-addon-item (card)
• cpq-product-addon-item-same-section (template)
• cpq-product-addon-item-separate-section (template)

All layouts are listed on the Vlocity Cards tab.

© 2021 Vlocity LLC, a Salesforce


company 32
CME CPQ

© 2021 Vlocity LLC, a Salesforce


company 33
CME CPQ

Figure 3. Vlocity Cart with Product List and Product Line Items

1. cpq-base-grid layout and cpq-base-grid template


2. cpq-base-header-pricelist layout and cpq-base-header-pricelist template
3. cpq-base-header template and cpq-header layout
4. cpq-base-header layout, cpq-base-header-card template, and cpq-header card
5. cpq-product-list layout and cpq-product-list template
6. cpq-product-item card and cpq-product-item template
7. cpq-product-cart layout and cpq-product-cart template
8. cpq-product-cart-item template and cpq-product-cart-item card
9. cpq-total-bar layout, cpq-total-bar template, cpq-total-bar-card card, and cpq-total-card template

© 2021 Vlocity LLC, a Salesforce


company 34
CME CPQ

Figure 4. Vlocity Cart with Configuration Panel

1. cpq-product-cart-config layout and cpq-product-cart-config template


2. Click to look up a specific object, such as a service account or location.

© 2021 Vlocity LLC, a Salesforce


company 35
CME CPQ

Figure 5. Vlocity Cart Basic View

1. Click for product details. Opens the Product Details dialog box, which uses the cpq-product-details
card, cpq-product-item-more layout, and cpq-product-item-details template.
2. Click to display or hide the Products or Promotions list.
3. Click for line item details for the root item. Opens the Line Item Details dialog box.
4. Click to open the configuration panel.
5. Products and Promotions lists, cpq-left-sidebar template and cpq-left-sidebar layout
6. Child line items in Vlocity Cart, cpq-product-cart-item-child layout, cpq-product-cart-item-child template,
and cpq-product-cart-item-child card

© 2021 Vlocity LLC, a Salesforce


company 36
CME CPQ

Figure 6. Vlocity Cart Promotion List and Tab

1. cpq-promotions-list layout and cpq-promotions-list template


2. cpq-cart-promotions and cpq-cart-promotions template
3. cpq-promotion-item template and cpq-promotion-item card
4. cpq-cart-promotions card

© 2021 Vlocity LLC, a Salesforce


company 37
CME CPQ

Figure 7. Product Details Dialog Box

1. cpq-product-item-more layout and cpq-product-item-more template


2. cpq-product-details card and cpq-product-item-details template

NOTE
Configure the card to determine which details are displayed.

© 2021 Vlocity LLC, a Salesforce


company 38
CME CPQ

Figure 8. Line Item Details Dialog Box

1. cpq-cart-item-detail layout and cpq-cart-item-details template


2. cpq-cart-item-detail card and cpq-product-cart-item template

© 2021 Vlocity LLC, a Salesforce


company 39
CME CPQ

Figure 9. Cart Item Lookup Field Dialog Box

• cpq-cart-item-lookup layout and cpq-cart-item-lookup template


• cpq-product-filters layout and cpq-product-filters template

© 2021 Vlocity LLC, a Salesforce


company 40
CME CPQ

Figure 10. Vlocity Cart with Filterable Attributes List

• cpq-product-filters layout and cpq-product-filters template

© 2021 Vlocity LLC, a Salesforce


company 41
CME CPQ

Figure 11. Vlocity Assets Cards-Based Visualforce Page

1. comp-assets-header
2. comp-assets-products
3. comp-assets-contract
4. comp-assets-product-item
5. comp-assets-product-item-child
6. comp-assets-product-children
7. comp-assets-base-grid
8. comp-assets-contract
9. comp-assets-header

comp-assets-base-grid (template)
The comp-assets-base-grid template provides a space for the Assets and Review Cart cards-based
Visualforce pages.

Template Type
Containers

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 42
CME CPQ

Image

See Also
• Learning About Asset-Based Ordering Visualforce Pages

© 2021 Vlocity LLC, a Salesforce


company 43
CME CPQ

comp-assets-contract (template)
The comp-assets-contract template provides the space for assets that are listed by contract on the cards-
based Assets and Review Cart Visualforce pages. For more information about these pages, see Learning
About Asset-Based Ordering Visualforce Pages.

Template Type
Cards

Code
HTML

Image

comp-assets-contract-layout
The comp-assets-contract layout provides the structure for assets that are listed by contract on the cards-
based Assets and Review Cart Visualforce pages. For more information about these pages, see Learning
About Asset-Based Ordering Visualforce Pages.

Template
comp-assets-contract (template)

Layout Session Variables


None

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getAssetsByContract

Input map
Input Map Variable Value
contractId {{parent.Id.value}}

© 2021 Vlocity LLC, a Salesforce


company 44
CME CPQ

Input Map Variable Value


effectiveAssetsDateFilter {{attrs.effectiveDate}}
pagesize 10
priceDetailsFields vlocity_cmt__OneTimeCharge__c

Result JSON Path


records

REST API Information


Get Assets for Contract

GET /services/apexrest/vlocity_cmt/v2/contracts/{{parent.Id.value}}/assets?

Cards
comp-assets-product-item (card)

Image

comp-assets-contract-load (template)
The comp-assets-contract-load template groups assets by contract IDs.

Template Type
Cards

Code
HTML

Image
None

comp-assets-header (card)
The comp-assets-header card, with the comp-assets-header-card template, renders the banner at the top
of the cards-based Assets and Review Cart Visualforce pages. For more information about these pages,
see Learning About Asset-Based Ordering Visualforce Pages.

Title
comp-assets-header

© 2021 Vlocity LLC, a Salesforce


company 45
CME CPQ

Filter
None

Card Session Variables


None

Data Source
No source/layout

States
Active Account

Template
comp-assets-header-card (template)

Actions
None

Flyout
None

Conditions
None

Image

comp-assets-header (layout)
The comp-assets-header layout provides the structure for the top of the cards-based Assets and Review
Cart Visualforce pages. For more information about these pages, see Learning About Asset-Based
Ordering Visualforce Pages.

Template
comp-assets-header (template)

Layout Session Variables


None

Data Source
Dual

© 2021 Vlocity LLC, a Salesforce


company 46
CME CPQ

Remote Class
CpqAppHandler

Remote Method
getAccounts

Input map
Input Map Variable Value
id {{attrs.accountId}}

Result JSON Path


records

REST API Information


Get Accounts

GET /services/apexrest/vlocity_cmt/v2/accounts/{{attrs.accountId}}

Cards
comp-assets-header (card)

Image

comp-assets-header (template)
The comp-assets-header template provides the space for the banner in the cards-based Assets and
Review Cart Visualforce pages. For more information about these pages, see Learning About Asset-Based
Ordering Visualforce Pages.

Template Type
Containers

Code
HTML

Image
None

© 2021 Vlocity LLC, a Salesforce


company 47
CME CPQ

comp-assets-header-card (template)
The comp-assets-header-card template renders the top of the cards-based Assets and Review Cart
Visualforce pages. For more information about these pages, see Learning About Asset-Based Ordering
Visualforce Pages.

Template Type
Cards

Code
HTML, CSS/SCSS

Image

comp-assets-info-panel (layout)
The comp-assets-info-panel layout provides the structure for the info panel in the cards-based Assets and
Review Cart Visualforce pages. For more information about these Visualforce pages, see Learning About
Asset-Based Ordering Visualforce Pages

Template
comp-assets-info-panel (template)

Layout Session Variables


None

Data Source
None

Cards
Empty

© 2021 Vlocity LLC, a Salesforce


company 48
CME CPQ

Image

comp-assets-info-panel (template)
The comp-assets-info-panel template renders the information panel in the cards-based Assets and Review
Cart Visualforce pages. For more information about these Visualforce pages, see Learning About Asset-
Based Ordering Visualforce Pages.

The comp-assets-info-panel template provides multi-language support translation for Attribute Category
Name, Attribute Name, and Attribute Value for attribute types.

Template Type
Containers

© 2021 Vlocity LLC, a Salesforce


company 49
CME CPQ

Code
HTML, CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

First Change
In CME Winter '18, keep the following:

<h3>{{attributeObj.Name}}</h3>

In CME Summer '18, replace the HTML above with the following HTML to use translation features:

© 2021 Vlocity LLC, a Salesforce


company 50
CME CPQ

<h3 cpq-translate="AttributeCategory.Name">{{attributeObj.Name}}</h3>

Second Change
In CME Winter '18, keep the following:

<span class="slds-form-element__label slds-text-


body_regular">{{attribute.label}}:</span>

In CME Summer '18, replace the above HTML with the following HTML to use translation features:

<span class="slds-form-element__label slds-text-body_regular" cpq-


translate="Attribute.Name"> {{attribute.label}}
</span>

Third Change
In CME Winter '18, keep the following:

<span ng-if="attribute.inputType !== 'dropdown' && attribute.inputType !


=='radio' && attribute.inputType !=='checkbox' && attribute.inputType !
=='date'">

In CME Summer '18, replace the above HTML with the following HTML to use translation features:

<span ng-if="attribute.inputType !== 'dropdown' && attribute.inputType !


=='radio' && attribute.inputType !=='checkbox' && attribute.inputType !
=='date'" cpq-translate="Attribute.Value">

Fourth Change
In CME Winter '18, keep the following:

<span ng-repeat="valueObj in attribute.values" ng-if="valueObj.value ===


attribute.userValues">
{{valueObj.label}}
</span>

In CME Summer '18, replace the above HTML with the following HTML to use translation features:

<span ng-repeat="valueObj in attribute.values" ng-if="valueObj.value ===


attribute.userValues">
{{valueObj.label | CPQTranslateFilter:'Attribute.Name' }}
</span>

Fifth Change
In CME Winter '18, keep the following:

<span ng-if="!$first">, </span>{{valueObj.label}}

In CME Summer '18, replace the above HTML with the following HTML to use translation features:

© 2021 Vlocity LLC, a Salesforce


company 51
CME CPQ

<span ng-if="!$first">, </span>


<span cpq-translate="Attribute.Name">{{valueObj.label}}</span>

Sixth Change
In CME Winter '18, keep the following:

<span ng-if="!$first">, </span>{{valueObj.label}}

In CME Summer '18, replace the above HTML with the following HTML to use translation features:

<span ng-if="!$first">, </span><span cpq-


translate="Attribute.Name">{{valueObj.label}}</span>

Seventh Change
In CME Winter '18, keep the following:

<span ng-if="!attribute.multiselect && attribute.inputType ==='checkbox'">

In CME Summer '18, replace the above HTML with the following HTML to use translation features:

<span ng-if="!attribute.multiselect && attribute.inputType ==='checkbox'" cpq-


translate="Attribute.Value">"

comp-assets-load (template)
The comp-assets-load template renders the space for assets that are not grouped by contract in the cards-
based Assets and Review Cart Visualforce pages. For more information about these Visualforce pages,
see Learning About Asset-Based Ordering Visualforce Pages

Template Type
Cards

Code
HTML

© 2021 Vlocity LLC, a Salesforce


company 52
CME CPQ

Image

comp-assets-no-contract (card)
The comp-assets-no-contract card renders the date picker and other items in the header portion of the
space that displays the assets on the cards-based Assets and Review Cart Visualforce pages, when the
assets are not grouped by contract. For more information about these pages, see Learning About Asset-
Based Ordering Visualforce Pages.

Title
No Contract Assets

Filter
None

Card Session Variables


None

Data Source
Sample

Remote Class
None

Remote Method
None

States
No Contract Assets

© 2021 Vlocity LLC, a Salesforce


company 53
CME CPQ

Template
comp-assets-load (template)

Actions
None

Flyout
comp-assets-no-contract-layout

Conditions
None

Image

comp-assets-no-contract-layout
The comp-assets-no-contract-layout provides structure for assets that aren't associated with contracts on
the cards-based Assets and Review Cart Visualforce pages.

Template
comp-assets-no-contract

Layout Session Variables


Name Value
totalSize payload.totalSize
nextAssets payload.actions.nextproducts

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getAssetsByAccount

Input map
Input Map Variable V
accountId {{attrs.accountId}}

© 2021 Vlocity LLC, a Salesforce


company 54
CME CPQ

Input Map Variable V


effectiveAssetsDateFilter {{attrs.effectiveDate}}
includes {{attrs.assetIncludeType}}
priceDetailsFields vlocity_cmt__OneTimeCharge__c,vlocity_cmt__OneTimeManualDiscount__c,vlocity_cmt__OneTimeCalculatedPrice__c,vlocity_cm
pagesize 10

Result JSON Path


records

REST API Information


Get Assets for Account

For more information, see Get Assets for Account.

GET /services/apexrest/vlocity_cmt/v2/accounts/{{attrs.accountId}}/assets?
includes={{attrs.assetIncludeType}}&effectiveAssetsDateFilter={{attrs.effective
Date}}&priceDetailsFields=vlocity_cmt__OneTimeCharge__c,vlocity_cmt__OneTimeCal
culatedPrice__c,vlocity_cmt__OneTimeTotal__c,vlocity_cmt__RecurringCharge__c,vl
ocity_cmt__RecurringCalculatedPrice__c,vlocity_cmt__RecurringTotal__c&pagesize=
10

Cards
comp-assets-product-item (card)

Image

See Also
• Learning About Asset-Based Ordering Visualforce Pages

comp-assets-base-grid (layout)
The comp-assets-base-grid layout provides the underlying structure for the Assets and Review Cart cards-
based Visualforce pages.

Template
comp-assets-base-grid (template)

Layout Session Variables


None

© 2021 Vlocity LLC, a Salesforce


company 55
CME CPQ

Data Source
No source

Cards
None

Image

© 2021 Vlocity LLC, a Salesforce


company 56
CME CPQ

See Also
• Learning About Asset-Based Ordering Visualforce Pages

comp-assets-product-children (layout)
The comp-assets-product-children layout provides the structure for each child product item on the cards-
based Assets and Review Cart Visualforce pages. For more information about these Visualforce pages,
see Learning About Asset-Based Ordering Visualforce Pages.

Template
comp-assets-product-children (template)

Layout Session Variables


None

Data Source
Parent

Cards
comp-assets-product-item-child (card)

Image
None

comp-assets-product-children (template)
The comp-assets-product-children template provides the space for each child product item on the cards-
based Assets and Review Cart Visualforce pages. For more information about these Visualforce pages,
see Learning About Asset-Based Ordering Visualforce Pages.

Template Type
Containers

Code
HTML

Image
None

© 2021 Vlocity LLC, a Salesforce


company 57
CME CPQ

comp-assets-product-item (card)

comp-assets-product-item (card)

comp-cart-review-product-item (card)
The comp-assets-product-item card renders the space for products listed by contracts on the cards-based
Assets and Review Cart Visualforce pages. For more information about these Visualforce pages, see
Learning About Asset-Based Ordering Visualforce Pages.

In Vlocity Communications, Media, and Energy Summer '18, the comp-assets-product-item card has been
renamed comp-cart-review-product-item.

Title
Asset Product Item

Filter
None

Card Session Variables


None

Data Source
No source/layout

States

• Asset Product Item


• CustomView_Basic
• CustomView_AdvancedPricing
• CustomView_AdvancedPricingLoyalty

Templates

• comp-assets-product-item (template)
• cpq-card-blank (template)

Actions
None

Flyout
None

Conditions
None

© 2021 Vlocity LLC, a Salesforce


company 58
CME CPQ

Image

comp-assets-product-item (template)
The comp-assets-product-item template provides the space for products listed by contracts on the cards-
based Assets and Review Cart Visualforce pages. For more information about these Visualforce pages,
see Learning About Asset-Based Ordering Visualforce Pages.

In Vlocity Communications, Media, and Energy Summer '18, comp-assets-product-item has been changed
to provide multi-language support to translate Product Name and Promotion Name.

Template Type
Cards

Code
HTML, CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

First Change
<button ng-click="childProdState.show = !childProdState.show" class="slds-
button assets-item-has-children" aria-controls="tree0-node1" ng-hide="!
(obj.childAssets.records || obj.lineItems.records ||
obj.productGroups.records)">
<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'switch'"
extra-classes="'slds-button__icon_left slds-float_left'" ng-class="{'assets-
fix-slds-close-switch' : !childProdState.show}"></slds-button-svg-icon>
<span class="slds-assistive-text">Toggle</span>
<span class="assets-product-name" cpq-
translate="Product2.Name">{{obj[customField.fieldName]}}</span>
</button>
<button ng-click="childProdState.show = !childProdState.show" class="slds-
button assets-item-has-children" aria-controls="tree0-node1" ng-hide="!
(obj.childAssets.records || obj.lineItems.records ||

© 2021 Vlocity LLC, a Salesforce


company 59
CME CPQ

obj.productGroups.records)">
<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'switch'"
extra-classes="'slds-button__icon_left'" ng-class="{'assets-fix-slds-close-
switch' : !childProdState.show}"></slds-button-svg-icon>
<span class="slds-assistive-text">Toggle</span>
<span class="assets-product-name">{{obj[customField.fieldName]}}</span>
</button>

Second Change
<span class="assets-item-no-children" ng-show="!(obj.childAssets.records ||
obj.lineItems.records || obj.productGroups.records)">
{{ obj[customField.fieldName]}}
</span>
<span class="assets-item-no-children" ng-show="!(obj.childAssets.records ||
obj.lineItems.records || obj.productGroups.records)" cpq-
translate="Product2.Name">
{{ obj[customField.fieldName]}}
</span>

Third Change
{{promoItem.Name}}{{$last ? '' : ', '}}
<span cpq-translate=""Promotion.Name"">{{promoItem.Name}}</span>
{{$last ? '' : ', '}}

comp-assets-product-item-child (card)
The comp-assets-product-item-child card renders each child product on the cards-based Assets and
Review Cart Visualforce pages. For more information about these Visualforce pages, see Learning About
Asset-Based Ordering Visualforce Pages.

Title
Assets Product Children Item

Filter
None

Card Session Variables


None

Data Source
None

States
Assets Product Children Item

© 2021 Vlocity LLC, a Salesforce


company 60
CME CPQ

Template
comp-assets-product-item-child

Actions
None

Flyout
None

Conditions
None

Image

comp-assets-product-item-child (template)
The comp-assets-product-item-child template displays the details of the child element in an asset bundle in
the cards-based Assets and Review Cart Visualforce pages. For more information about these Visualforce
pages, see Learning About Asset-Based Ordering Visualforce Pages.

In Vlocity Communications, Media, and Energy Summer '18, comp-assets-product-item child has been
changed to provide multi-language support to translate Product Name and Promotion Name.In addition,
only part of the template appears if a line item is inside a product group.

Template Type
Cards

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 61
CME CPQ

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

First Change
In CME Winter '18, keep the following:

<div class="slds-is-relative">

In CME Summer '18, replace the HTML above with the following HTML:

<div class="slds-is-relative" ng-


if="importedScope.isLineItemInProductGroups(childProd)">

Second Change
In CME Winter '18, keep the following:

<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'switch'" extra-


classes="'slds-button__icon_left'" ng-class="{'assets-fix-slds-close-
switch' : !childProdState.show}"></slds-button-svg-icon>

© 2021 Vlocity LLC, a Salesforce


company 62
CME CPQ

In CME Summer '18, replace the above HTML with the following HTML:

<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'switch'" extra-


classes="'slds-button__icon_left slds-float_left'" ng-class="{'assets-fix-slds-
close-switch' : !childProdState.show}"></slds-button-svg-icon>

Third Change
In CME Winter '18, keep the following:

<span class="assets-product-name">

In CME Summer '18, replace the above HTML with the following HTML:

<span class="assets-product-name" cpq-translate="Product2.Name">

Fourth Change
In CME Summer '18, add the following HTML:

<div class="assets-item-no-children" cpq-translate="Product2.Name" ng-show="!


importedScope.checkIfChildProdHasChildren(childProd)">
{{(childProd.PricebookEntry.Product2.Name || childProd.Product2.Name ||
childProd[customField.fieldName])}}
</div>

Fifth Change
In CME Winter '18, keep the following:

<!-- Text -->


<div ng-if="customField.type === 'string'">{{childProd[customField.fieldName]
['value']}}</div>
<!-- Loyalty-->

In CME Summer '18, replace the above HTML with the following HTML:

<div ng-if="(childProd.itemType !== 'productGroup')">


<!-- Text -->
<div ng-if="customField.type === 'string'">{{childProd[customField.fieldName]
['value']}}</div>
<!-- Loyalty-->

Sixth Change
In Winter '18, keep the following:

<div ng-repeat="promoItem in childProd[customField.fieldName].records" ng-attr-


title="{{promoItem.Name}}" class="assets-promo-text-wrap">
{{promoItem.Name}}{{$last ? '' : ', '}}

In CME Summer '18, replace the above HTML with the following HTML:

© 2021 Vlocity LLC, a Salesforce


company 63
CME CPQ

<div ng-repeat="promoItem in childProd[customField.fieldName].records" ng-attr-


title="{{promoItem.Name}}" class="assets-promo-text-wrap">
<span cpq-translate="Promotion.Name">{{promoItem.Name}}</span>
{{$last ? '' : ', '}}
</div> "

comp-assets-products (layout)
The comp-assets-products layout provides the structure for the space for assets that are in the cards-based
Assets and Review Cart Visualforce pages. For more information about these pages, see Learning About
Asset-Based Ordering Visualforce Pages

Template
comp-assets-products (template)

Layout Session Variables


None

Data Source
None

Cards
• comp-assets-contract (card)
• comp-assets-no-contract (card)

Image

comp-assets-products (template)
The comp-assets-products template renders the For more information about these Visualforce pages, see
Learning About Asset-Based Ordering Visualforce Pages.

© 2021 Vlocity LLC, a Salesforce


company 64
CME CPQ

In Vlocity Communications, Media, and Energy Summer '18, the comp-assets-products template was
modified.

• changeCustomView() now takes a second parameter, tabChanged, which clears selected assets
when a tab changes.
• Removed rootScope to use importedScope to store indicators when changeToQuote,
changeToOrder, and moveAssets buttons are enabled.

Template Type
Containers

Code
HTML, CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following change to the HTML in the Card Designer.

First Change
In CME Winter '18, keep the following:

<li class=""slds-tabs_default__item slds-text-heading_label"" title=""Item


One"" role=""presentation"" ng-class=""{'slds-active' : tabSelected ===
'Assets'}"" ng-click=""tabSelected = 'Assets';
importedScope.changeCustomView(1);"">

In CME Summer '18, replace the HTML above with the following HTML:

<li class="slds-tabs_default__item slds-text-heading_label" title="Item One"


role="presentation" ng-class="{'slds-active' : tabSelected === 'Assets'}" ng-
click="tabSelected = 'Assets'; importedScope.changeCustomView(1, true);">

Second Change
In CME Winter '18, keep the following:

<li class="slds-tabs_default__item slds-text-heading_label" title="Item One"


role="presentation" ng-class="{'slds-active' : tabSelected === 'Promotions'}"
ng-click="tabSelected = 'Promotions'; importedScope.changeCustomView(0)" ng-
show="$root.customViews.cpqCustomViews.length >= 1 && attrs.promotionMode ===
'on'">

© 2021 Vlocity LLC, a Salesforce


company 65
CME CPQ

In CME Summer '18, replace the above HTML with the following HTML:

<li class="slds-tabs_default__item slds-text-heading_label" title="Item One"


role="presentation" ng-class="{'slds-active' : tabSelected === 'Promotions'}"
ng-click="tabSelected = 'Promotions'; importedScope.changeCustomView(0,
true)" ng-show="$root.customViews.cpqCustomViews.length >= 1 &&
attrs.promotionMode === 'on'">

Third Change
In CME Winter '18, keep the following:

<li class="slds-dropdown__item" role="presentation" ng-repeat="customView in


$root.customViews.cpqCustomViews" ng-
click="importedScope.changeCustomView($index)">

In CME Summer '18, replace the above HTML with the following HTML:

<li class="slds-dropdown__item" role="presentation" ng-repeat="customView in


$root.customViews.cpqCustomViews" ng-
click="importedScope.changeCustomView($index, false)">

Fourth Change
In CME Winter '18, keep the following:

<button class="slds-button slds-button_neutral" ng-


click="importedScope.assetChangeToQuote(attrs.accountId,
attrs.assetIncludeType)" ng-disabled="!
$root.vlocityAssets.enableChangeToCartButton">

In CME Summer '18, replace the above HTML with the following HTML:

<button class="slds-button slds-button_neutral" ng-


click="importedScope.assetChangeToQuote(attrs.accountId,
attrs.assetIncludeType)" ng-disabled="!
importedScope.enableAssetButtons.changeToCartButton">

Fifth Change
In CME Winter '18, keep the following:

<button class="slds-button slds-button_neutral" ng-


click="importedScope.assetChangeToOrder()" ng-disabled="!
$root.vlocityAssets.enableChangeToCartButton">

In CME Summer '18, replace the above HTML with the following HTML:

<button class="slds-button slds-button_neutral" ng-


click="importedScope.assetChangeToOrder()" ng-disabled="!
importedScope.enableAssetButtons.changeToCartButton">

© 2021 Vlocity LLC, a Salesforce


company 66
CME CPQ

Sixth Change
In CME Winter '18, keep the following:

<button class="slds-button slds-button_neutral" ng-


click="importedScope.assetMove()" ng-disabled="!
$root.vlocityAssets.enableMoveButton">

In CME Summer '18, replace the above HTML with the following HTML:

<button class="slds-button slds-button_neutral" ng-


click="importedScope.assetMove()" ng-disabled="!
importedScope.enableAssetButtons.moveButton">

comp-assets-promotions (layout)
The comp-assets-promotions layout provides the structure for the Promotions tab on the cards-based
Assets and Review Cart Visualforce pages. For more information about these Visualforce pages, see
Learning About Asset-Based Ordering Visualforce Pages.

Template
comp-assets-promotions (template)

Layout Session Variables


None

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getAppliedPromotionsByAccount

Input map
Input Map Variable Value
accountId {{attrs.accountId}}

Result JSON Path


records

REST API Information


Get Applied Promotions for Account

© 2021 Vlocity LLC, a Salesforce


company 67
CME CPQ

For more information, see Get Applied Promotions for Account.

GET /services/apexrest/vlocity_cmt/v2/accounts/{{attrs.accountId}}/promotions

Cards
comp-assets-promotions-card

Image

comp-assets-promotions (template)
The comp-assets-promotions template provides the space for the Promotions tab on the cards-based
Assets and Review Cart Visualforce pages. For more information about these Visualforce pages, see
Learning About Asset-Based Ordering Visualforce Pages.

In Vlocity Communications, Media, and Energy Summer '18, comp-assets-promotions has been changed to
provide multi-language support to translate Promotion Name.

Template Type
Containers

Code
HTML, CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

<div ng-show="record[field.fieldName].dataType != 'DATETIME'">


<div ng-show="record[field.fieldName].dataType != 'DATETIME'" cpq-
translate="Promotion.Name">

© 2021 Vlocity LLC, a Salesforce


company 68
CME CPQ

comp-assets-promotions-card
The comp-assets-promotions-card Renders the products on the Promotions tab on the cards-based
Assets and Review Cart Visualforce pages. For more information about these Visualforce pages, see
Learning About Asset-Based Ordering Visualforce Pages.

Title
Assets Applied Promotion Card

Filter
None

Card Session Variables


None

Data Source
None

Result JSON Path

path

States
CustomView_Basic

Template
cpq-card-blank (template)

Actions
None

Flyout
None

Conditions
None

Image

© 2021 Vlocity LLC, a Salesforce


company 69
CME CPQ

comp-assets-theme-variables (template)
The comp-assets-theme-variables template contains CSS variables that are used in other templates for the
Assets and Review Cart Visualforce pages. For more information about these Visualforce pages, see
Learning About Asset-Based Ordering Visualforce Pages.

Template Type
Mixin

Code
CSS/SCSS

Image
n/a

Example 2. Example CSS for comp-assets-theme-variables

/***
***** ASSETS THEME VARIABLES ****
Add only the theme file here. Don't add any code here.
It's easier to swap the theme here rather than swapping in every other
template.
If you swap the theme here, all templates will automatically get the latest.

NOTE
Note: You need to re save all the templates once you change the
theme. Also, if you change theme files, refresh the browser and
then save the templates.

***/
@import "cpq-base-theme-variables";

comp-cart-review (layout)
The comp-cart-review layout provides the structure for the main panel of the Review Cart Visualforce page.
For more information about these Visualforce pages, see Learning About Asset-Based Ordering Visualforce
Pages.

In Vlocity Communications, Media, and Energy Summer '18, comp-cart-review has been changed. The
comp-assets-product-item card has been renamed comp-cart-review-product-item.

© 2021 Vlocity LLC, a Salesforce


company 70
CME CPQ

Template
comp-cart-review (template)

Layout Session Variables


Name Value
totalSize payload.totalSize
nextProducts payload.actions.nextproducts
messages payload.messages

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getCartsItems

Input map
Input Map
Variable
cartId {{attrs.cartId}}
fields vlocity_cmt__BillingAccountId__c,vlocity_cmt__ServiceAccountId__c,Quantity,vlocity_cmt__RecurringTotal__c,vlocity_cmt__OneTimeTota
pagesize 10
priceDetailsFields vlocity_cmt__OneTimeCharge__c,vlocity_cmt__OneTimeCalculatedPrice__c,vlocity_cmt__OneTimeTotal__c,vlocity_cmt__RecurringCha
validate false

Result JSON Path


records

REST API Information


Get Line Items

For more information, see Get Line Items by ID.

GET /services/apexrest/vlocity_cmt/v2/cpq/carts/{{attrs.cartId}}/items?
pagesize=10&price=false&validate=false&fields=vlocity_cmt__BillingAccountId__c,
vlocity_cmt__ServiceAccountId__c,Quantity,vlocity_cmt__RecurringTotal__c,vlocit
y_cmt__OneTimeTotal__c,vlocity_cmt__OneTimeManualDiscount__c,vlocity_cmt__Recur
ringManualDiscount__c,vlocity_cmt__ProvisioningStatus__c,vlocity_cmt__Recurring

© 2021 Vlocity LLC, a Salesforce


company 71
CME CPQ

Charge__c,vlocity_cmt__OneTimeCharge__c,ListPrice,vlocity_cmt__ParentItemId__c,
vlocity_cmt__BillingAccountId__r.Name,vlocity_cmt__ServiceAccountId__r.Name,vlo
city_cmt__PremisesId__r.Name,vlocity_cmt__InCartQuantityMap__c&priceDetailsFiel
ds=vlocity_cmt__OneTimeCharge__c,vlocity_cmt__OneTimeCalculatedPrice__c,vlocity
_cmt__OneTimeTotal__c,vlocity_cmt__RecurringCharge__c,vlocity_cmt__RecurringCal
culatedPrice__c,vlocity_cmt__RecurringTotal__c

Cards
comp-assets-product-item (card)

comp-cart-review-product-item (card)

Image

comp-cart-review (template)
The comp-cart-review template provides the space for the main panel of the Review Cart Visualforce page.
For more information about these Visualforce pages, see Learning About Asset-Based Ordering Visualforce
Pages.

© 2021 Vlocity LLC, a Salesforce


company 72
CME CPQ

Template Type
Containers

Code
HTML, CSS/SCSS

Image

comp-assets-no-contract (template)
The comp-assets-no-contract template provides space for assets that are not associated with contracts on
the cards-based Assets and Review Cart Visualforce pages.

In Vlocity Communications, Media, and Energy Summer '18, the comp-assets-no-contract template was
modified to show assets only after the data source has loaded.

Template Type
Cards

© 2021 Vlocity LLC, a Salesforce


company 73
CME CPQ

Code
HTML

Image
None

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following change to the HTML in the Card Designer.

In CME Winter '18, keep the following:

<div class="slds-grid slds-grid_vertical-align-center slds-grid_align-center"


ng-if="!records || records.length === 0 ">

In CME Summer '18, replace the above HTML with the following HTML to use translation features:

<div class="slds-grid slds-grid_vertical-align-center slds-grid_align-center"


ng-if="datasourceStatus.status === 'loaded' && (!records || records.length ===
0 )">

See Also
• Learning About Asset-Based Ordering Visualforce Pages

comp-cart-review-base-grid (layout)
The comp-cart-review-base-grid layout provides the structure for the Review Cart Visualforce page. For
more information about these Visualforce pages, see Learning About Asset-Based Ordering Visualforce
Pages.

Template
comp-cart-review-base-grid (template)

Layout Session Variables


None

Data Source
None

Cards
None

© 2021 Vlocity LLC, a Salesforce


company 74
CME CPQ

Image

comp-cart-review-base-grid (template)
The comp-cart-review-base-grid template provides the space for the Review Cart Visualforce page. For
more information about these Visualforce pages, see Learning About Asset-Based Ordering Visualforce
Pages.

Template Type
Containers

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 75
CME CPQ

Image

cpq-base-grid (layout)
The cpq-base-grid layout provides the underlying structure for the CPQ interface. The template provides a
three-column interface with the header bar at the top of the page and a total bar at the bottom of the page.

Template
cpq-base-grid (template)

Data Source
None

Cards
Empty

© 2021 Vlocity LLC, a Salesforce


company 76
CME CPQ

Image

cpq-base-grid (template)
The cpq-base-grid template provides a three-column cart interface with the header bar at the top of the
page and the total bar at the bottom of the page.

In Vlocity Communications, Media, and Energy Summer '18, cpq-base-grid has its own controller,
CPQHeaderController.

Template Type
Containers

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 77
CME CPQ

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following change to the HTML in the Card Designer.

<vloc-layout layout-name="cpq-header" enable-


pricing="{{importedScope.featureSettings.enablePricing}}" enable-loyalty-
points="{{importedScope.customSettings.EnableLoyaltyPoints}}"></vloc-layout>
<vloc-layout layout-name="cpq-header" ctrl="CPQHeaderController" enable-
pricing="{{importedScope.featureSettings.enablePricing}}" enable-loyalty-
points="{{importedScope.customSettings.EnableLoyaltyPoints}}"></vloc-layout>

cpq-base-header (template)
The cpq-base-header template provides the structure of the cart header.

In Vlocity Communications, Media, and Energy Summer '18, cpq-base-header passes the
CPQHeaderController to the card.

Template Type
Containers

Code
HTML

© 2021 Vlocity LLC, a Salesforce


company 78
CME CPQ

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following change to the HTML in the Card Designer.

<vloc-card ng-repeat="card in cards" ng-model="card" data="card"


index="{{$index}}" session-id="{{sessionId}}" enable-
pricing="{{attrs.enablePricing}}" enable-loyalty-
points="{{attrs.enableLoyaltyPoints}}">
<vloc-card ng-repeat="card in cards"
ng-model="card" index="{{$index}}" session-id="{{sessionId}}"
data="card" ctrl="{{ctrl}}"
enable-pricing="{{attrs.enablePricing}}"
enable-loyalty-points="{{attrs.enableLoyaltyPoints}}"
ng-if="isLoaded"></vloc-card>"

cpq-base-header-card (template)
The cpq-base-header-card template provides the structure for the cart header.

In Vlocity Communications, Media, and Energy Summer '18, cpq-base-header-card includes the following
changes:

• Replaced using the native field Order.status with the custom field OrderStatus__c.
• Created the Cancel Order button. It is enabled only when an order has a prevalidate action.
• Displays the batch Cancel Order Locked when IsChangesAllowed__c is false when the order reaches
the point of no return.
• Created class for batch Cancel Order Locked in SCSS.

Template Type
Cards

Code
HTML, CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following change to the HTML in the Card Designer.

© 2021 Vlocity LLC, a Salesforce


company 79
CME CPQ

First Change
{{::obj.Status}}
{{::obj.OrderStatus__c | uppercase}}

Second Change
In CME Summer '18, add the following new code:

<span ng-show="obj.IsChangesAllowed__c === 'false'" class="slds-badge cpq-base-


header-badge">
{{::importedScope.customLabels.CPQCancelOrderLocked}}
</span>
<button class="slds-button slds-m-left_large slds-button_neutral"
ng-click="importedScope.invokeOrderAction(obj.actions)"
ng-show="obj.actions && obj.actions.prevalidate"
ng-disabled="importedScope.progress.isProcessing">
{{::importedScope.customLabels.CPQCancelOrder}}
</button>

Third Change
<button cpq-dropdown-handler="isOpen = false" class="slds-button slds-
button_icon-border-filled" aria-haspopup="true" ng-click="isOpen = !isOpen"
id="{{idPrefix}}-toggle" title="Show More">
<slds-button-svg-icon size="type === 'button-group' ? null : 'small'"
sprite="'utility'" icon="'down'"></slds-button-svg-icon>
<span class="slds-assistive-text">Show More</span>
</button>
<button cpq-dropdown-handler="isOpen = false" class="slds-button slds-
button_icon-border-filled" aria-haspopup="true" ng-click="isOpen = !
isOpen" id="{{idPrefix}}-toggle"
title="{{::importedScope.customLabels.CPQShowMore}}">
<slds-button-svg-icon size="type === 'button-group' ? null : 'small'"
sprite="'utility'" icon="'down'"></slds-button-svg-icon>
<span class="slds-assistive-
text">{{::importedScope.customLabels.CPQShowMore}}</span>
</button>

Fourth Change
In CME Summer '18, add the following :

.#{$namespace}-base-header-badge {
padding: 5px 15px;
margin: auto;
margin-right: 5px;
} "

© 2021 Vlocity LLC, a Salesforce


company 80
CME CPQ

cpq-base-header-payment-choice (layout)
The cpq-base-header-payment-choice layout calls the getListsOfValues API to provide the user payment
choices in Vlocity Cart.

Template
cpq-base-header-payment-choice (template)

Layout Session Variables


None

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getListsOfValues

Input map
Input Map Variable Value
cartId {{params.id}}
listkeys PaymentChoice

Result JSON Path


records

REST API Information


GET /services/apexrest/vlocity_cmt/v2/listsofvalues?
listkeys=PaymentChoice&cartId={{params.id}}

For more information, see Get Lists of Values.

Cards
None

Image

© 2021 Vlocity LLC, a Salesforce


company 81
CME CPQ

cpq-base-header-pricelist (layout)
The cpq-base-header-pricelist layout renders the picklist that displays the price lists in the upper left corner
of Vlocity Cart.

Template
cpq-base-header-pricelist (template)

Layout Session Variables


None

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getPriceLists

Input map
Input Map Variable Value
cartId {{params.id}}

Result JSON Path


records

REST API Information


Get Price Lists for Cart

For more information, see Get Price Lists for Cart.

GET /services/apexrest/vlocity_cmt/v2/cpq/carts/{{params.id}}/pricelists

Cards
None

© 2021 Vlocity LLC, a Salesforce


company 82
CME CPQ

Image

cpq-base-header-pricelist (template)
The cpq-base-header-pricelist template calls changePricelist to assign the price list the agent selects.

In Vlocity Communications, Media, and Energy Summer '18, cpq-base-header-pricelist supports multi-
language translation for the Price List Name.

Template Type
Containers

Code
HTML

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following change to the HTML in the Card Designer.

First Change
<div class="slds-text-
body_small">{{::importedScope.customLabels.CPQPriceList}}</div>
<div class="slds-text-body_small">{{::importedScope.customLabels.CPQPriceList
| CPQTranslateFilter:'PriceList.Name'}}</div>

Second Change
{{importedScope.currentPricelist.Name ||
importedScope.customLabels.CPQSelectPriceList}}

© 2021 Vlocity LLC, a Salesforce


company 83
CME CPQ

<span>{{importedScope.currentPricelist.Name ||
importedScope.customLabels.CPQSelectPriceList |
CPQTranslateFilter:'PriceList.Name'}}</span>

Third Change
<span class="slds-truncate">{{pricelist.Name}}</span>
<span class="slds-truncate">{{pricelist.Name |
CPQTranslateFilter:'PriceList.Name'}}</span>

cpq-base-theme-variables (template)
The cpq-base-theme variables template contains CSS variables that are used in other templates.

Template Type
Mixin

Code
CSS/SCSS

Image
n/a

Example 3. Example CSS for cpq-base-theme-variables


/*** CPQ BASE THEME VARIABLES ***/
@import "cpq-base-variables";
// Common padding
$cpq-padding-base-vertical: 6px !default;
$cpq-padding-base-horizontal: 12px !default;
$cpq-padding-large-vertical: 10px !default;
$cpq-padding-large-horizontal: 16px !default;
$cpq-padding-small-vertical: 5px !default;
$cpq-padding-small-horizontal: 10px !default;
$cpq-padding-xs-vertical: 1px !default;
$cpq-padding-xs-horizontal: 5px !default;
$cpq-headings-font-weight: 600;
$cpq-cart-item-product-group-font-weight: 300;
$cpq-page-bg-color: #f4f6f9;
$cpq-product-container-bg-color: $white;
$cpq-product-container-border-color: $mid-gray;
$cpq-product-padding: 10px;
$cpq-product-item-padding: 3px;
$cpq-cart-container-tabs-height: 40px;
$cpq-cart-container-tabs-top-margin: -10px;
$cpq-cart-container-bg-color: $white;
$cpq-cart-container-border-color: $mid-gray;

© 2021 Vlocity LLC, a Salesforce


company 84
CME CPQ

$cpq-cart-total-bar-bg-color: #14315D;
$cpq-product-cart-items-bg-color: $white;
$cpq-product-cart-items-attr-value-color: $dark-gray;
$cpq-product-cart-item-selected-border-color: #FDB734;
$cpq-product-cart-order-bg-color: $mid-gray;
$cpq-product-cart-config-error-font-size: .75rem;
$cpq-product-cart-config-error-margin-top: .5rem;
$cpq-product-cart-discount-price: #97C077;
$cpq-cart-item-attr-label-font-size: 11px;
$cpq-cart-item-product-group-label-color: $black;
$cpq-cart-section-title-font-size: 15px;
$cpq-cart-item-product-messages-padding: 28px;
$cpq-cart-item-product-details-padding: 20px;
$cpq-cart-item-product-cfg-attr-font-size: 13px;
$cpq-cart-promo-item-bg-color: #F9FCF3;
$cpq-cart-promo-button-bg-color: #9ECC3B;
$cpq-cart-promo-item-border-color: #CCE29C;
$cpq-cart-promo-item-border-width: 2px;
$cpq-cart-promo-item-border-radius: 5px;
$cpq-loyalty-points-color: #061C3F;
$cpq-product-link-color: #0070d2;
$cpq-offers-count-bg-color: #FDB734;
$cpq-product-cart-item-popover-top: -3.5rem;
$cpq-product-cart-item-popover-left: -0.5rem;
$product-item-bookmark-red: #f65327;
$product-item-bookmark-blue: #0058C6;
$product-item-bookmark-green: #13834D;
$product-item-bookmark-yellow: #FFB75D;
$product-item-bookmark-grayish-blue: #54698D;

cpq-base-variables (template)
The cpq-base-variables template contains CSS variables used in other templates and themes.

Template Type
Mixin

Code
CSS/SCSS

Image
n/a

Example 4. Example CSS for cpq-base-theme-variables


/*** CPQ BASE VARIABLES ***/
/***

© 2021 Vlocity LLC, a Salesforce


company 85
CME CPQ

Do not modify this variables, Instead use Themes.


Modify only when you are sure what you are doing and the impact it may have.
These variables are used in different templates/themes.
**/
$black: #000000;
$white: #FFFFFF;
$mid-black: #16325c;
$dark-gray: #7c7c7c;
$text-gray: #9999a7;
$middle-dark-gray: #c7c7c7;
$mid-gray: #d8d8d8;
$middle-light-gray: #dedede;
$light-gray: #f2f2f2;
$lightest-gray: #f8f8f8;
$dark-blue: #008ab3;
$light-blue: #05a6df;
$warning: #eac438;
$success: #58a300;
$error: #f65327;
$font-family: "Salesforce Sans", Arial, sans-serif;
$font-size: 14px;
$line-height: 20px;
$font-title-size: 28px;
$font-heading-size: 22px;
$font-thin: normal 100 14px/18px $font-family;
$font-light: normal 300 14px/18px $font-family;
$font-regular: normal 400 14px/18px $font-family;
$font-semibold: normal 600 14px/18px $font-family;
/*** SLDS VARIABLES ***/
//*** RESPONSIVE BREAKPOINTS ***//
$bp-xsmall: 20em;
$bp-small: 30em;
$bp-xmedium: 44em;
$bp-medium: 48em;
$bp-large: 64em;
$bp-xlarge: 80em;
//*** COLORS ***//
// Grays
$header-gray: #f7f9fb;
$cards-gray: #f4f6f9;
$cards-border-gray: #d8dde6;
$mobile-icons-gray: #9faab5;
// Notifications
$notify-danger: #c23934;
$notify-warning: #ffb75d;
$notify-success: #04844b;

© 2021 Vlocity LLC, a Salesforce


company 86
CME CPQ

$notify-default: #54698d;
// Neutrals
$neutral-lightest: #EEF1F6;
$neutral-light: #CFD7E6;
$neutral-medium: #A7B8D1;
$neutral-dark: #4F6A92;
// Modals
$modal-overlay: #7e8c99;
// Primary Colors
$primary-alternative: #4A90E2;
$primary-lightest: #0C8EFF;
$primary-light: #0070D2;
$primary-medium: #005FB2;
$primary-dark: #00396B;
// Secondary Colors
$secondary-pink: #EF7EAD;
$secondary-green: #4BC076;
$secondary-aqua: #50E3C2;
$secondary-purple: #7F8DE1;
$secondary-orange: #F88962;
// Other Colors
$slds-red: #ef6e64;
// Fonts
$slds-font: "Salesforce Sans", Arial, sans-serif;
// Namespace
$cpq-namespace: 'cpq';
$assets-namespace: 'assets'

cpq-card-blank (template)
The cpq-card-blank template is an empty template. You can use cpq-card-blank to create a custom view in
the cpq-product-cart-item card state.

Template Type
Cards

Code
None

Image
None

cpq-card-mixin (template)
The cpq-card-mixin template displays the bundle hierarchy in Vlocity Cart.

In Vlocity Communications, Media, and Energy Summer '18, cpq-card-mixin includes the
#{$namespace}-product-name-block.

© 2021 Vlocity LLC, a Salesforce


company 87
CME CPQ

Template Type
Mixin

Code
CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the CSS in the Card Designer.

First Change
In CME Winter '18, keep the following in the CSS:

.comp-#{$namespace}-product-item-child, .comp-#{$namespace}-product-item {
position:relative; /* needed for selected border */
input.ng-invalid {

In CME Summer '18, replace the CSS statements above with the following CSS statements:

© 2021 Vlocity LLC, a Salesforce


company 88
CME CPQ

.comp-#{$namespace}-product-item-child, .comp-#{$namespace}-product-item {
position:relative; /* needed for selected border */
padding-top: 20px;
input.ng-invalid {

Second Change
.slds-button__icon {
float: left;
margin: 0.3rem 0.5rem 0 0;
.slds-button__icon {
margin: 0.3rem 0.5rem 0 0;

Third Change
In CME Summer '18 , add the following :

.#{$namespace}-product-name-block {
display: inline-flex;
.#{$namespace}-product-icon-block {
display: inherit;
div {
margin: auto
}
}
} "

cpq-cart-item-detail (card)
The cpq-cart-item-detail card renders the information in the Line Item Details dialog box. Each card
contains the information for one product, or line item, in the cart. Use the line item details to modify the
attributes of any item inline.

Title
Line Item Detail

Filter
None

Card Session Variables


Name Value
Name ['PricebookEntry']['Product2']['Name']

Data Source
None

© 2021 Vlocity LLC, a Salesforce


company 89
CME CPQ

States
Active

Template
cpq-product-cart-item (template)

Actions
None

Flyout
None

Conditions
None

Use
cpq-cart-item-detail (layout)

Image

cpq-cart-item-detail (layout)
The cpq-cart-item detail layout provides the interface for the Line Item Details dialog box.

Template
cpq-cart-item-details (template)

Layout Session Variables

Name Value
messages payload.messages

© 2021 Vlocity LLC, a Salesforce


company 90
CME CPQ

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getCartsItemsById

Input Map
Input
Map
Variable
cartId {{params.id}}
fields Quantity,vlocity_cmt__RecurringTotal__c,vlocity_cmt__OneTimeTotal__c,vlocity_cmt__OneTimeManualDiscount__c,vlocity_cmt__RecurringManua
id {{attrs.lineItemIds}}

Result JSON Path


records

REST API Information


Get Line Items

For more information, see Get Cart Items.

GET /vlocity_cmt/v2/cpq/carts/{{params.id}}/items?
id={{attrs.lineItemIds}}&fields=Quantity,vlocity_cmt__RecurringTotal__c,vlocity
_cmt__OneTimeTotal__c,vlocity_cmt__OneTimeManualDiscount__c,vlocity_cmt__Recurr
ingManualDiscount__c,vlocity_cmt__ProvisioningStatus__c,vlocity_cmt__RecurringC
harge__c,vlocity_cmt__OneTimeCharge__c,ListPrice,vlocity_cmt__ParentItemId__c,v
locity_cmt__BillingAccountId__r.Name,vlocity_cmt__ServiceAccountId__r.Name,vloc
ity_cmt__PremisesId__r.Name,vlocity_cmt__InCartQuantityMap__c

Cards
cpq-cart-item-detail (card)

© 2021 Vlocity LLC, a Salesforce


company 91
CME CPQ

Image

comp-assets-contract (card)
The comp-assets-contract card renders the date picker and other items in the header portion of the space
that displays the assets on the cards-based Assets and Review Cart Visualforce pages, when the assets
are grouped by contract. For more information about these pages, see Learning About Asset-Based
Ordering Visualforce Pages.

Title
Contract Assets

Filter
None

Card Session Variables


None

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getContracts

© 2021 Vlocity LLC, a Salesforce


company 92
CME CPQ

Input map
Input Map Variable Value
accountId {{attrs.accountId}}

Result JSON Path

records

REST API Information


Get Contracts for Account

/services/apexrest/vlocity_cmt/v2/accounts/{{attrs.accountId}}/contracts

States
Contract Assets

Template
comp-assets-contract-load (template)

Actions
None

Flyout
comp-assets-contract-layout

Conditions
None

Image

cpq-cart-item-details (template)
The cpq-cart-items-details template provides the structure for the cards in the Line Items Details dialog
box.

Template Type
Cards

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 93
CME CPQ

Image

cpq-cart-item-lookup (layout)
The cpq-cart-item-lookup layout renders the Cart Item Lookup Field dialog box.

Template
cpq-cart-item-lookup (layout)

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getAvailableSites

Input Map
Input Map Variable Value
cartId {{params.id}}
id {{params.lineItemId}}
lookupField {{params.fieldName}}

Result JSON Path


None

© 2021 Vlocity LLC, a Salesforce


company 94
CME CPQ

REST API Information


Get Available Sites

For more information, see Get Available Sites.

GET /vlocity_cmt/v2/cpq/carts/{{params.id}}/sites?
id={{params.lineItemId}}&lookupField={{params.fieldName}}

Cards
Empty

Image

cpq-cart-item-lookup (template)
The cpq-cart-item-lookup template provides the structure and user interface elements for the Cart Item
Lookup Field dialog box.

Template Type
Containers

Code
HTML

© 2021 Vlocity LLC, a Salesforce


company 95
CME CPQ

Image

cpq-cart-promotions (card)
The cpq-cart-promotions card renders each individual applied promotion in the cart.

NOTE
In Vlocity CMT Summer '17, Major release, Version 100.0.900.60, the card is cpq-cart-
applied-promotions-card. In Vlocity CMT Summer '17, Minor release, 100.1.900.72-73 and
later, the card is cpq-cart-promotions.

Title
Cpq Applied Promotion Card

Filter
None

Card Session Variables


None

© 2021 Vlocity LLC, a Salesforce


company 96
CME CPQ

Data Source
None

Remote Class
None

Remote Method
None

Input map
None

Result JSON Path


None

REST API Information


None

States
• CustomView_Basic
• BasicView_Basic

Template
cpq-card-blank (template)

Actions
None

Flyout
None

Conditions
None

Image

cpq-cart-promotions (layout)
The cpq-cart-promotions layout renders the list of applied promotions in the cart.

© 2021 Vlocity LLC, a Salesforce


company 97
CME CPQ

NOTE
In Vlocity CMT Summer '17, Major release, Version 100.0.900.60, the layout is cpq-cart-
applied-promotions-view. In Vlocity CMT Summer '17, Minor release, 100.1.900.72-73 and
later, the layout is cpq-cart-promotions.

Template
cpq-cart-promotions (template)

Layout Session Variables


None

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getPromotionsAppliedToCart

Input map
Input Map Variable Value
cartId {{params.id}}
pagesize 10

Result JSON Path


records

REST API Information


Get Promotions Applied to Cart

For more information, see Get Promotions Applied to Cart.

GET /services/apexrest/vlocity_cmt/v2/cpq/carts/{{params.id}}/promotions?
subaction=getPromotionsAppliedToCart&pagesize=10

Cards
cpq-cart-promotions (card)

© 2021 Vlocity LLC, a Salesforce


company 98
CME CPQ

Image

cpq-cart-promotions (template)
The cpq-cart-promotions template retrieves the list of applied promotions in the cart.

In Vlocity Communications, Media, and Energy Summer '18, cpq-cart-promotions has been changed to
provide multi-language support to translate Promotion Name.

NOTE
In Vlocity Communications, Media, and Energy Summer '17, Major release, Version
100.0.900.60, the template is cpq-cart-applied-promotions-view. In Vlocity
Communications, Media, and Energy Summer '17, Minor release, 100.1.900.72-73 and
later, the template is cpq-cart-promotions.

Template Type
Containers

© 2021 Vlocity LLC, a Salesforce


company 99
CME CPQ

Code
HTML, CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

<div ng-show="record[field.fieldName].dataType != 'DATETIME'">


{{record[field.fieldName].value}}

<div ng-show="record[field.fieldName].dataType != 'DATETIME'">


{{record[field.fieldName].value | CPQTranslateFilter:'Promotion.Name'}}"

cpq-config-attr-custom-action-template1 and cpq-config-attr-custom-action-


template2
The cpq-config-attr-custom-action-template1 and cpq-config-attr-custom-action-template 2 templates
support custom actions in the Vlocity Cart information panel. Specifically, these templates add a lookup field
for a phone number.

© 2021 Vlocity LLC, a Salesforce


company 100
CME CPQ

In Vlocity Communications, Media, and Energy Summer '18, cpq-config-attr-custom-action-template1 and


cpq-config-attr-custom-action-template2 have been changed to use the namespace prefixed
c__CustomActionThirdPartyTest instead of CustomActionThirdPartyTest.

Template Type
Cards

Code
HTML, CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the JavaScript in the Card
Designer.

cpq-config-attr-custom-action-template1
modalScope.customActionIframeSrc = '/apex/CustomActionThirdPartyTest?
targetOrigin=' + targetOrigin + '&messageType=' + messageType +
'&attributeId=' + attributeId;

In CME Summer '18, replace the JavaScript above with the following JavaScript:

modalScope.customActionIframeSrc = '/apex/c__CustomActionThirdPartyTest?
targetOrigin=' + targetOrigin + '&messageType=' + messageType +
'&attributeId=' + attributeId;"

cpq-config-attr-custom-action-template12
modalScope.customActionIframeSrc = '/apex/CustomActionThirdPartyTest?
targetOrigin=' + targetOrigin + '&messageType=' + messageType +
'&attributeId=' + attributeId;

In CME Summer '18, replace the JavaScript above with the following JavaScript:

modalScope.customActionIframeSrc = '/apex/c__CustomActionThirdPartyTest?
targetOrigin=' + targetOrigin + '&messageType=' + messageType +
'&attributeId=' + attributeId;

© 2021 Vlocity LLC, a Salesforce


company 101
CME CPQ

cpq-header (card)
The cpq-header-card displays the content of the cart header. This card has three states.

Title
cpq-header

Filter
None

Card Session Variables


None

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getCarts

Input Map
Input Map Variable Value
cartId {{params.id}}
price false
validate false

Result JSON Path


result.records[0].details.records

REST API Information


Get Cart Summary

GET /services/apexrest/vlocity_cmt/v2/cpq/carts/{{params.id}}?
validate=false&price=false

States
• Active Opportunity
• Active Quote
• Active Order

© 2021 Vlocity LLC, a Salesforce


company 102
CME CPQ

Template
cpq-base-header-card (template)

Actions
All three states:

• View Record
• Edit Record

Active Order only:

• Generate Document PDF


• Send for eSignature
• New Order

Flyout
None

Conditions
• Active Opportunity: ['ObjectType'] = 'Opportunity'
• Active Quote: ['ObjectType'] = 'Quote'
• Active Order: ['ObjectType'] ='Order'

Image

cpq-header (layout)
The cpq-header layout provides the header for the cart.

Template
cpq-base-header (template)

Data Source
No source/layout

Cards
cpq-header (card)

Image

© 2021 Vlocity LLC, a Salesforce


company 103
CME CPQ

cpq-base-header-payment-choice (template)
The cpq-base-header-payment-choice template renders the Payment Choice drop-down list in Vlocity
Cart.

Template Type
Containers

Code
CSS/SCSS

Image

cpq-input-custom-template-sample
The cpq-input-custom-template-sample template is an example of a custom template for a field.

Template Type
Cards

Code
HTML, CSS/SCSS

Image

cpq-left-sidebar (layout)
The cpq-left-sidebar layout displays the Products list and Promotions list in Vlocity Cart.

Template
cpq-left-sidebar (template)

Layout Session Variables


None

© 2021 Vlocity LLC, a Salesforce


company 104
CME CPQ

Data Source
None

Remote Class
None

Remote Method
None

Input map
None

Result JSON Path


None

REST API Information


None

Cards
None

© 2021 Vlocity LLC, a Salesforce


company 105
CME CPQ

Image

cpq-left-sidebar (template)
The cpq-left-sidebar template is a wrapper for the cpq-product-list and cpq-promotions-list cards and
layouts.

In Vlocity Communications, Media, and Energy Summer '18, cpq-left-sidebar has been changed to pass
userLocale to both the Product List and Promotion List.

© 2021 Vlocity LLC, a Salesforce


company 106
CME CPQ

Template Type
Containers

Code
HTML, CSS/SCSS

Image

© 2021 Vlocity LLC, a Salesforce


company 107
CME CPQ

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

First Change

<div class="slds-col cpq-items-container scroll" ng-


show="importedScope.showList.products">
<vloc-layout layout-name="cpq-product-list" ctrl="CPQItemsController"
tabView="{{importedScope.productsTab}}" include-
ineligible="{{importedScope.featureSettings.enableRuleBasedQualifications}}"></
vloc-layout>
</div>
<div class="slds-col cpq-items-container scroll" ng-
show="importedScope.showList.products">
<vloc-layout layout-name="cpq-product-list" cpq-user-
locale="{{$root.vlocity.userSfLocale}}" ctrl="CPQItemsController"
tabView="{{importedScope.productsTab}}" include-
ineligible="{{importedScope.featureSettings.enableRuleBasedQualifications}}"></
vloc-layout>
</div>

Second Change

<div class="slds-col cpq-items-container scroll" ng-


show="importedScope.showList.promotions" ng-
if="importedScope.featureSettings.enablePromotions">
<vloc-layout layout-name="cpq-promotions-list" ctrl="CPQItemsController"
tabView="{{importedScope.promotionsTab}}" include-
ineligible="{{importedScope.featureSettings.enableRuleBasedQualifications}}"></
vloc-layout>
</div>
<div class="slds-col cpq-items-container scroll" ng-
show="importedScope.showList.promotions" ng-
if="importedScope.featureSettings.enablePromotions">
<vloc-layout layout-name="cpq-promotions-list" cpq-user-
locale="{{$root.vlocity.userSfLocale}}" ctrl="CPQItemsController"
tabView="{{importedScope.promotionsTab}}" include-
ineligible="{{importedScope.featureSettings.enableRuleBasedQualifications}}"></
vloc-layout>
</div>"

cpq-product-addon (layout)
The cpq-product-addon layout provides the information necessary when a product includes additional
items.

© 2021 Vlocity LLC, a Salesforce


company 108
CME CPQ

Template
cpq-product-addon (template)

Data Source
Parent

Cards
cpq-product-addon-item (card)

Image

cpq-product-addon (template)
The cpq-product-addon template provides the structure necessary to display information when a product
includes additional items.

Template Type
Containers

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 109
CME CPQ

Image

cpq-product-addon-item (card)
The cpq-product-addon-item displays the information necessary when a product includes additional items,
including the line items, child products, promotions, and grouping items.

Title
Add On

Filter
None

Card Session Variables


None

Data Source
None

States
Add-on

© 2021 Vlocity LLC, a Salesforce


company 110
CME CPQ

Template
cpq-product-addon-item-separate-section

Actions
None

Flyout
None

Conditions
None

Image

cpq-product-addon-item-separate-section (template)
The cpq-product-addon-item-separate-section template provides the structure for the line items in a cart
when some products include additional items.

Template Type
Cards

© 2021 Vlocity LLC, a Salesforce


company 111
CME CPQ

Code
HTML, CSS/SCSS

Image

cpq-product-cart (layout)
The cpq-product-cart layout renders the cart, including any relevant error messages.

Template
cpq-product-cart (template)

Layout Session Variables

Name Value
nextProducts payload.actions.nextproducts
messages payload.messages

Data Source
Dual

© 2021 Vlocity LLC, a Salesforce


company 112
CME CPQ

Remote Class
CpqAppHandler

Remote Method
getCartsItems

Input Map
Input Value
Map
Variable
cartId {{params.id}}
fields vlocity_cmt__BillingAccountId__c,vlocity_cmt__ServiceAccountId__c,Quantity,vlocity_cmt__RecurringTotal__c,vlocity_cmt__OneTimeTotal__c,

vlocity_cmt__OneTimeManualDiscount__c,vlocity_cmt__RecurringManualDiscount__c,vlocity_cmt__ProvisioningStatus__c,

vlocity_cmt__RecurringCharge__c,vlocity_cmt__OneTimeCharge__c,ListPrice,vlocity_cmt__ParentItemId__c,vlocity_cmt__BillingAccountId__r.Na

vlocity_cmt__ServiceAccountId__r.Name,vlocity_cmt__PremisesId__r.Name,vlocity_cmt__InCartQuantityMap__c
pagesize 10

NOTE
The pagesize must be greater than one. If the pagesize is set to one, when loading
more line items or deleting a product, Vlocity Cart may stop responding.

Result JSON Path


records

REST API Information


Get Line Items

For more information, see Get Line Items by ID.

GET /services/apexrest/vlocity_cmt/v2/cpq/carts/{{params.id}}/items?
pagesize=10&fields=vlocity_cmt__BillingAccountId__c,vlocity_cmt__ServiceAccount
Id__c,Quantity,vlocity_cmt__RecurringTotal__c,vlocity_cmt__OneTimeTotal__c,vloc
ity_cmt__OneTimeManualDiscount__c,vlocity_cmt__RecurringManualDiscount__c,vloci
ty_cmt__ProvisioningStatus__c,vlocity_cmt__RecurringCharge__c,vlocity_cmt__OneT
imeCharge__c,ListPrice,vlocity_cmt__ParentItemId__c,vlocity_cmt__BillingAccount
Id__r.Name,vlocity_cmt__ServiceAccountId__r.Name,vlocity_cmt__PremisesId__r.Nam
e,vlocity_cmt__InCartQuantityMap__c

© 2021 Vlocity LLC, a Salesforce


company 113
CME CPQ

Cards
cpq-product-cart-item (card)

Image

cpq-product-cart (template)
The cpq-product-cart template provides the structure for the cart.

In Vlocity Communications, Media, and Energy Summer '18, cpq-product-cart has been changed to use a
custom label that matches the custom view name.

Template Type
Containers

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 114
CME CPQ

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

<a ng-show=""$root.customViews.currentCustomView !== $index""


href=""javascript:void(0);"" role=""menuitemcheckbox"" tabindex=""0"">
<span class=""slds-
truncate"">{{importedScope.customLabels[customView.viewName]}}</span>
</a>
<a ng-show=""$root.customViews.currentCustomView !== $index""
href=""javascript:void(0);"" role=""menuitemcheckbox"" tabindex=""0"">
<span class=""slds-truncate"">
{{importedScope.customLabels[customView.viewName]}}
</span>
</a>

cpq-product-cart-config (layout)
The cpq-product-cart-config layout renders the configuration panel in the cart, including only the close and
Save buttons.

© 2021 Vlocity LLC, a Salesforce


company 115
CME CPQ

Template
cpq-product-cart-config

Cards
Empty

© 2021 Vlocity LLC, a Salesforce


company 116
CME CPQ

Image

cpq-product-cart-config (template)
The cpq-product-cart-config template provides the structure for the configuration panel in the cart.

In Vlocity Communications, Media, and Energy Summer '18, cpq-product-cart-config has been changed.

© 2021 Vlocity LLC, a Salesforce


company 117
CME CPQ

• Disabled editing a text field when the order is active.


• Corrected the syntax of .#{$namespace}-error-msg in SCSS.

Template Type
Containers

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 118
CME CPQ

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML or CSS in the Card
Designer.

© 2021 Vlocity LLC, a Salesforce


company 119
CME CPQ

HTML Change
In Winter '18, keep the following HTML:

<div class="slds-form-element" ng-repeat="editableItem in


importedScope.editableItemList">
<label class="slds-form-element__label">{{::editableItem.label}}
<span ng-if="editableItem.dataType === 'PERCENT'"> %</span>
</label>
<div class="slds-form-element__control">
<input ng-if="::editableItem.dataType === 'STRING'" type='text'
class="slds-input" ng-model='editableItem.value' ng-model-options="{ updateOn:
'default blur', debounce: { 'default': 800, 'blur': 0 } }"
ng-change="importedScope.refreshEditableField(editableItem , true);"/>
<input ng-if="::(editableItem.fieldName === 'Quantity' ||
editableItem.dataType === 'CURRENCY' || editableItem.dataType === 'PERCENT')"
type='number' step='any' class="slds-input" ng-model='editableItem.value' ng-
model-options="{ updateOn: 'default blur', debounce: { 'default': 800, 'blur':
0 } }"
ng-
disabled="importedScope.isAsset(importedScope.configItemObject,editableItem.fie
ldName)"
ng-change="importedScope.refreshEditableField(editableItem, true);"
ng-keydown="importedScope.checkQuantityField(editableItem.fieldName,
$event.key)"/>
<span class="cpq-error-msg">{{editableItem.qtyValidationMessage}}</span>
</div>
</div>
div class="slds-form-element" ng-repeat="editableItem in
importedScope.editableItemList">
<label class="slds-form-element__label">{{::editableItem.label}}
<span ng-if="editableItem.dataType === 'PERCENT'"> %</span>
</label>
<div class="slds-form-element__control">
<input ng-if="::editableItem.dataType === 'STRING'" type='text' class="slds-
input" ng-model='editableItem.value'
ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 800,
'blur': 0 } }"
ng-disabled="importedScope.configItemObject.orderActive"
ng-change="importedScope.refreshEditableField(editableItem , true);"/>
<input ng-if="::(editableItem.fieldName === 'Quantity' ||
editableItem.dataType === 'CURRENCY' || editableItem.dataType === 'PERCENT')"
type='number' step='any' class="slds-input"
ng-model='editableItem.value'
ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 800,
'blur': 0 } }"
ng-

© 2021 Vlocity LLC, a Salesforce


company 120
CME CPQ

disabled="importedScope.isAsset(importedScope.configItemObject,editableItem.fie
ldName)"
ng-change="importedScope.refreshEditableField(editableItem, true);"
ng-keydown="importedScope.checkQuantityField(editableItem.fieldName,
$event.key)"/>
<span class="cpq-error-msg">{{editableItem.qtyValidationMessage}}</span>
</div>undefined</div>

CSS Change
#{$namespace}-error-msg {

In Summer '18, replace the CSS statement above with the following CSS statements:

.#{$namespace}-error-msg {
color: $error;"

cpq-product-cart-item (card)
The cpq-product-cart-item card displays each line item in a cart.

Title
Cart Item

Filter
None

Card Session Variables


None

Data Source
None

States
cart Item

Template
cpq-product-cart-item (template)

Actions
None

Flyout
None

Conditions
None

© 2021 Vlocity LLC, a Salesforce


company 121
CME CPQ

Image

cpq-product-cart-item (template)
The cpq-product-cart-item template provides the structure for the Line Item Details dialog box.

The cpq-product-cart-item template also provides the structure for each root-level line item in the cart.

In Vlocity Communications, Media, and Energy Summer '18, cpq-product-cart-item has been changed:

• Provides multi-language support to translate Product Name and Promotion Name.


• Disables the manual adjustment and payment choice buttons when an order is active.

Template Type
Cards

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 122
CME CPQ

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

First Change
<!-- Name -->
<div ng-if="customField.name === 'Name'">
<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'switch'"
extra-classes="'slds-button__icon_left'"
ng-class="{'cpq-fix-slds-close-switch' : !childProdState.show}"></slds-button-
svg-icon>
<span class="slds-assistive-text">Toggle</span>
<span class="cpq-product-name">{{obj.PricebookEntry.Product2.Name}}</span>

© 2021 Vlocity LLC, a Salesforce


company 123
CME CPQ

<span title="{{obj[$root.nsPrefix+'Action__c'].value}}">
<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'bookmark'"
extra-classes="'slds-button__icon_left'" class="cpq-product-item-bookmark-
{{obj[$root.nsPrefix+'Action__c'].value.toLowerCase() || 'null'}}"></slds-
button-svg-icon>
</span>
<span class="cpq-product-name" cpq-
translate="Product2.Name">{{obj.PricebookEntry.Product2.Name}}</span>
</button>
<div class="cpq-item-no-children" ng-show="!(obj.lineItems.records ||
obj.childProducts.records || obj.productGroups.records || (attrs.lineItemModal
&& obj.attributeCategories.records.length > 0))">
<span>{{obj.PricebookEntry.Product2.Name}}</span>
<span title="{{obj[$root.nsPrefix+'Action__c'].value}}">
<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'bookmark'"
extra-classes="'slds-button__icon_left'" class="cpq-product-item-bookmark-
{{obj[$root.nsPrefix+'Action__c'].value.toLowerCase() || 'null'}}"
title="Hooray"></slds-button-svg-icon>
</span>
</div>undefined</div>undefined<!— Name -->undefined<div ng-
if="customField.name === 'Name'" class="cpq-product-name-block">
<button class="slds-button cpq-item-has-children" aria-controls="tree0-node1"
ng-click="childProdState.show = !childProdState.show"
ng-hide="!(obj.lineItems.records || obj.childProducts.records ||
obj.productGroups.records || (attrs.lineItemModal &&
obj.attributeCategories.records.length > 0))">
<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'switch'"
extra-classes="'slds-button__icon_left slds-float_left'" ng-class="{'cpq-fix-
slds-close-switch' : !childProdState.show}"></slds-button-svg-icon>
<span class="slds-assistive-text">Toggle</span>
<span class="cpq-product-name" cpq-
translate="Product2.Name">{{obj.PricebookEntry.Product2.Name}} </span>
</button>
<div class="cpq-item-no-children"
ng-show="!(obj.lineItems.records || obj.childProducts.records ||
obj.productGroups.records || (attrs.lineItemModal &&
obj.attributeCategories.records.length > 0))"
cpq-translate="Product2.Name">
{{obj.PricebookEntry.Product2.Name}}
</div>
<!-- Icons -->
<div class="cpq-product-icon-block">
<div title="{{obj[$root.nsPrefix+'Action__c'].value}}">
<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'bookmark'"
class="cpq-product-item-bookmark- {{obj[$root.nsPrefix
+'Action__c'].value.toLowerCase() || 'null'}}"></slds-button-svg-icon>

© 2021 Vlocity LLC, a Salesforce


company 124
CME CPQ

</div>
</div>undefined</div>

Second Change
<button class="slds-button slds-button_icon-border" aria-haspopup="true"
title="{{::importedScope.customLabels.CPQPaymentChoice}}"
ng-if="obj[customField.fieldName]['actions']['switchpaymentmode']"

<button class="slds-button slds-button_icon-border" aria-haspopup="true"


title="{{::importedScope.customLabels.CPQPaymentChoice}}"
ng-if="obj[customField.fieldName]['actions']['switchpaymentmode']"
ng-disabled="obj.orderActive"

Third Change
<div class="slds-button-group" role="group">
<button class="slds-button slds-button_icon-border" ng-
disabled="obj.orderActive"
<button class="slds-button slds-button_icon-border"
title="{{::importedScope.customLabels.CPQChangePrice}}"
ng-if="obj[customField.fieldName]['actions']['applyadjustment']"
<div class="slds-popover__body cpq-price-actions-popover__body">
<div class="slds-button-group" role="group">
<button class="slds-button slds-button_icon-border"
title="{{::importedScope.customLabels.CPQChangePrice}}"
ng-if="obj[customField.fieldName]['actions']['applyadjustment']"
ng-disabled="obj.orderActive"

Fourth Change
<div ng-repeat="promoItem in obj[customField.fieldName].records" ng-attr-
title="{{promoItem.Name}}" class="cpq-promo-text-wrap" ng-class="{'cpq-promo-
name-strike': importedScope.isPromoActionDisconnect(promoItem)}">
{{promoItem.Name}}{{$last ? '' : ', '}}
<div ng-repeat="promoItem in obj[customField.fieldName].records" ng-attr-
title="{{promoItem.Name}}" class="cpq-promo-text-wrap" ng-class="{'cpq-promo-
name-strike': importedScope.isPromoActionDisconnect(promoItem)}">
<span cpq-translate="Promotion.Name">{{promoItem.Name}}</span>
{{$last ? '' : ', '}}
</div>

cpq-product-cart-item-cell-detail (flyout)
The cpq-product-cart-item-cell-detail flyout displays the Price Details dialog box.

Template
cpq-product-cart-item-cell-detail (template)

© 2021 Vlocity LLC, a Salesforce


company 125
CME CPQ

Layout Session Variables


None

Data Source
None

Remote Class
None

Remote Method
None

Input map
None

Result JSON Path


None

REST API Information


None

Cards
None

Image

© 2021 Vlocity LLC, a Salesforce


company 126
CME CPQ

cpq-product-cart-item-cell-detail (template)
The cpq-product-cart-item-cell-detail template provides the structure for the Price Details dialog box.

In Vlocity Communications, Media, and Energy Summer '18cpq-product-cart-item-cell-detail provides multi-


language support to translate price list entry text.

Template Type
Cards

Code
HTML, CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

<th scope="row" class="cpq-detail-row">


<div class="cpq-cell-header">{{record.Description}}</div>
</th>
<th scope="row" class="cpq-detail-row">
<div class="cpq-cell-header" cpq-
translate="PriceListEntry.DisplayText">{{record.Description}}</div>
</th>

© 2021 Vlocity LLC, a Salesforce


company 127
CME CPQ

cpq-product-cart-item-cell-payment-choice (template)
The cpq-product-cart-item-cell-payment-choice template renders the Payment Choice drop-down list for a
single line item in Vlocity Cart.

In Vlocity Communications, Media, and Energy Summer '18, cpq-product-cart-item-cell-payment choice


provides multi-language support to translate Product Name.

Template Type
Cards

Code
HTML

Images
Payment Choice Icon

Figure 12. Payment Choice Dialog Box

© 2021 Vlocity LLC, a Salesforce


company 128
CME CPQ

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

<div class="slds-form-element__control">
<span class="slds-form-element__static slds-text-heading_small">
<strong>{{parent.Product2.Name}}</strong>
</span>
</div>
<div class="slds-form-element__control">
<span class="slds-form-element__static slds-text-heading_small">
<strong cpq-translate="Product2.Name">{{parent.Product2.Name}}</strong>
</span>
</div>

cpq-product-cart-item-cell-pricing (flyout)
The cpq-product-cart-item-cell-pricing flyout displays the Apply Adjustment dialog box.

Template
cpq-product-cart-item-cell-pricing (template)

Layout Session Variables


None

Data Source
None

Remote Class
None

Remote Method
None

Input map
None

Result JSON Path


None

REST API Information


None

Cards
None

© 2021 Vlocity LLC, a Salesforce


company 129
CME CPQ

Image

cpq-product-cart-item-cell-pricing (template)
The cpq-product-cart-item-cell-pricing template provides the structure for the Apply Adjustment dialog
box.

In Vlocity Communications, Media, and Energy Summer '18, cpq-product-cart-item-cell-pricing reuses the
adjustment plan and policy area in the template for both adjustment by values and adjustment by code.

Template Type
Cards

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 130
CME CPQ

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

In CME Summer '18, add the following HTML:

<!-- Adjustment Plan and Policy Block --> code after <!-- End Adjustment Code
-->

cpq-product-cart-item-child (card)
The cpq-product-cart-item-child card displays each child-level product line item in Vlocity Cart.

Title
Child Products

Filter
None

Card Session Variables


None

© 2021 Vlocity LLC, a Salesforce


company 131
CME CPQ

Data Source
None

Remote Class
None

Remote Method
None

Input map
None

Result JSON Path


None

REST API Information


None

States
Child Products

Template
None

Actions
None

Flyout
None

Conditions
None

Image

cpq-product-cart-item-child (layout)
The cpq-product-cart-item-child layout displays child-level product information in Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 132
CME CPQ

NOTE
The cpq-product-cart-item-child layout was once named cpq-product-cart-item-child.

Template
cpq-product-cart-item-child (template)

Layout Session Variables


None

Data Source
Parent

Remote Class
None

Remote Method
None

Input map
None

Result JSON Path


None

REST API Information


None

Cards
cpq-cart-item-child-products

Image

cpq-product-cart-item-child (template)
The cpq-product-cart-item-child template provides the structure for the child-level product information in the
cart.

© 2021 Vlocity LLC, a Salesforce


company 133
CME CPQ

NOTE
The cpq-product-cart-item-child template was once named cpq-cart-item-product-children.

In Vlocity Communications, Media, and Energy Summer '18, cpq-product-cart-item-child has been
changed:

• Provides multi-language support to translate Product Name and Promotion Name.


• Disables manual adjustment and payment choice buttons when an order is active.
• Disables the icons for manual adjustment, payment choice, and detail pricing information, using the new
function checkActionsAndCardinality when viewing the line item in the dialog box.

Template Type
Layout

Code
Parent

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

First Change
<div ng-if="customField.name === 'Name'" class="cpq-item-child-product-name-
wrapper">
<button ng-click="childProdState.show =
importedScope.determineChildProdOpenOrCloseAfterClick(childProd,
childProdState.show); importedScope.fullScreen(attrs.ariaLevel,
childProdState.show)" class="slds-button cpq-item-has-children" aria-
controls="tree0-node1" ng-
hide="importedScope.determineIfChildProdOpenOrCloseIconShouldBeHidden(childProd
)" ng-init="childProdState.show =
importedScope.determineChildProdOpenOrCloseInitially(childProd)">
<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'switch'"

© 2021 Vlocity LLC, a Salesforce


company 134
CME CPQ

extra-classes="'slds-button__icon_left'" ng-class="{'cpq-fix-slds-close-
switch' : !childProdState.show}"></slds-button-svg-icon>
<span class="slds-assistive-text">Toggle</span>
<span class="cpq-product-name js-cpq-cart-product-hierarchy-path-
{{childProd.productHierarchyPath}}">{{(childProd.PricebookEntry.Product2.Name
|| childProd.Product2.Name)}}</span>
<span title="{{childProd[$root.nsPrefix+'Action__c'].value}}">
<slds-button-svg-icon sprite="'utility'" size="'small'"
icon="'bookmark'" extra-classes="'slds-button__icon_left'" class="cpq-product-
item-bookmark-{{childProd[$root.nsPrefix+'Action__c'].value.toLowerCase() ||
'null'}}"></slds-button-svg-icon>
</span>
</button>
<div class="cpq-item-no-children" ng-show="!
importedScope.checkIfChildProdHasChildren(childProd)">
{{(childProd.PricebookEntry.Product2.Name || childProd.Product2.Name)}}
<span title="{{childProd[$root.nsPrefix+'Action__c'].value}}">
<slds-button-svg-icon sprite="'utility'" size="'small'"
icon="'bookmark'" extra-classes="'slds-button__icon_left'" class="cpq-product-
item-bookmark-{{childProd[$root.nsPrefix+'Action__c'].value.toLowerCase() ||
'null'}}"></slds-button-svg-icon>
</span>
</div>
</div>
<div ng-if="customField.name === 'Name'" class="cpq-product-name-block cpq-
item-child-product-name-wrapper">
<button ng-click="childProdState.show =
importedScope.determineChildProdOpenOrCloseAfterClick(childProd,
childProdState.show); importedScope.fullScreen(attrs.ariaLevel,
childProdState.show)" class="slds-button cpq-item-has-children" aria-
controls="tree0-node1" ng-
hide="importedScope.determineIfChildProdOpenOrCloseIconShouldBeHidden(childProd
)" ng-init="childProdState.show =
importedScope.determineChildProdOpenOrCloseInitially(childProd)">
<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'switch'"
extra-classes="'slds-button__icon_left slds-float_left'" ng-class="{'cpq-fix-
slds-close-switch' : !childProdState.show}"></slds-button-svg-icon>
<span class="slds-assistive-text">Toggle</span>
<span class="cpq-product-name js-cpq-cart-product-hierarchy-path-
{{childProd.productHierarchyPath}}" cpq-
translate="Product2.Name">{{(childProd.PricebookEntry.Product2.Name ||
childProd.Product2.Name)}}</span>
</button>
<div class="cpq-item-no-children" ng-show="!
importedScope.checkIfChildProdHasChildren(childProd)" cpq-
translate="Product2.Name">

© 2021 Vlocity LLC, a Salesforce


company 135
CME CPQ

{{(childProd.PricebookEntry.Product2.Name || childProd.Product2.Name)}}
</div>
<!-- Icons -->
<div class="cpq-product-icon-block">
<div title="{{childProd[$root.nsPrefix+'Action__c'].value}}">
<slds-button-svg-icon sprite="'utility'" size="'small'"
icon="'bookmark'" class="cpq-product-item-bookmark-{{childProd[$root.nsPrefix
+'Action__c'].value.toLowerCase() || 'null'}}"></slds-button-svg-icon>
</div>
</div>
</div>

Second Change
<button class="slds-button slds-button_icon-border" aria-haspopup="true"
title="{{::importedScope.customLabels.CPQPaymentChoice}}"
ng-if="childProd[customField.fieldName]['actions']['switchpaymentmode']"

<button class="slds-button slds-button_icon-border" aria-haspopup="true"


title="{{::importedScope.customLabels.CPQPaymentChoice}}"
ng-if="childProd[customField.fieldName]['actions']['switchpaymentmode']"
ng-disabled="obj.orderActive"

Third Change
<div class="slds-popover__body cpq-price-actions-popover__body">
<div class="slds-button-group" role="group">
<button class="slds-button slds-button_icon-border" ng-
disabled="obj.orderActive"
title="{{::importedScope.customLabels.CPQChangePrice}}"
ng-if="childProd[customField.fieldName]['actions']['applyadjustment']"
ng-click="importedScope.openAdjustmentModal(childProd[customField.fieldName],
'applyadjustment', childProd)">
<div class="slds-popover__body cpq-price-actions-popover__body">
<div class="slds-button-group" role="group">
<button class="slds-button slds-button_icon-border"
title="{{::importedScope.customLabels.CPQChangePrice}}"
ng-if="childProd[customField.fieldName]['actions']['applyadjustment']"
ng-disabled="obj.orderActive"

Fourth Change
<button class="slds-button slds-button_icon-border" aria-haspopup="true"
title="{{::importedScope.customLabels.CPQPaymentChoice}}"
ng-if="childProd[customField.fieldName]['actions']['switchpaymentmode']"

<button class="slds-button slds-button_icon-border" aria-haspopup="true"

© 2021 Vlocity LLC, a Salesforce


company 136
CME CPQ

title="{{::importedScope.customLabels.CPQPaymentChoice}}"
ng-if="childProd[customField.fieldName]['actions']['switchpaymentmode']"
ng-disabled="obj.orderActive"

Fifth Change
<div ng-repeat="promoItem in childProd[customField.fieldName].records" ng-attr-
title="{{promoItem.Name}}" class="cpq-promo-text-wrap"
ng-class="{'cpq-promo-name-strike':
importedScope.isPromoActionDisconnect(promoItem)}">
{{promoItem.Name}}{{$last ? '' : ', '}}

<div ng-repeat="promoItem in childProd[customField.fieldName].records" ng-


attr-title="{{promoItem.Name}}" class="cpq-promo-text-wrap"
ng-class="{'cpq-promo-name-strike':
importedScope.isPromoActionDisconnect(promoItem)}">
<span cpq-translate="Promotion.Name">{{promoItem.Name}}
</span>
{{$last ? '' : ', '}}
</div>

Sixth Change
<button cpq-dropdown-handler="lineActions.show = false" aria-haspopup="true"
class="slds-button slds-button_icon-border-filled cpq-item-actions-dropdown-
button"
title="{{::importedScope.customLabels.CPQShowActions}}"
ng-if="(childProd.actions.updateitems && !attrs.lineItemModal) ||
(childProd.actions.addtocart && importedScope.checkCardinalityForAdd(obj,
childProd)) || (childProd.actions.cloneitem &&
importedScope.checkCardinalityForClone(obj, childProd)) ||
importedScope.checkCardinalityForDelete(obj, childProd)"

<button cpq-dropdown-handler="lineActions.show = false" aria-haspopup="true"


class="slds-button slds-button_icon-border-filled cpq-item-actions-dropdown-
button"
title="{{::importedScope.customLabels.CPQShowActions}}"
ng-if="importedScope.checkActionsAndCardinality(obj, childProd,
attrs.lineItemModal)"

Seventh Change
<button ng-click="childProdState.show = !childProdState.show;
importedScope.fullScreen(attrs.ariaLevel, childProdState.show)" class="slds-
button cpq-item-has-children" aria-controls="tree0-node1" ng-hide="!
(childProd.lineItems.records || childProd.childProducts.records ||
childProd.productGroups.records)">

© 2021 Vlocity LLC, a Salesforce


company 137
CME CPQ

<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'switch'"


extra-classes="'slds-button__icon_left'" ng-class="{'cpq-fix-slds-close-
switch' : !childProdState.show}"></slds-button-svg-icon>
<span class="slds-assistive-text">Toggle</span>
<span class="cpq-product-name">{{(childProd.PricebookEntry.Product2.Name ||
childProd.Product2.Name)}}</span>
</button>
<div class="cpq-item-no-children" ng-show="!(childProd.lineItems.records ||
childProd.childProducts.records ||
childProd.productGroups.records)">{{(childProd.PricebookEntry.Product2.Name ||
childProd.Product2.Name)}}</div>
<button ng-click="childProdState.show = !childProdState.show;
importedScope.fullScreen(attrs.ariaLevel, childProdState.show)" class="slds-
button cpq-item-has-children" aria-controls="tree0-node1" ng-hide="!
(childProd.lineItems.records || childProd.childProducts.records ||
childProd.productGroups.records)">
<slds-button-svg-icon sprite="'utility'" size="'small'" icon="'switch'"
extra-classes="'slds-button__icon_left'" ng-class="{'cpq-fix-slds-close-
switch' : !childProdState.show}"></slds-button-svg-icon>
<span class="slds-assistive-text">Toggle</span>
<span class="cpq-product-name" cpq-
translate="Product2.Name">{{(childProd.PricebookEntry.Product2.Name ||
childProd.Product2.Name)}}</span>
</button>
<div class="cpq-item-no-children"
ng-show="!(childProd.lineItems.records || childProd.childProducts.records ||
childProd.productGroups.records)"
cpq-translate="Product2.Name">
{{(childProd.PricebookEntry.Product2.Name || childProd.Product2.Name)}}
</div>

Eighth Change
<span ng-class="{'cpq-item-no-children' : !
importedScope.checkIfChildProdHasChildren(childProd)}">{{::
(childProd.PricebookEntry.Product2.Name || childProd.Product2.Name)}}</span>
<span ng-class="{'cpq-item-no-children' : !
importedScope.checkIfChildProdHasChildren(childProd)}"
cpq-translate="Product2.Name">{{::(childProd.PricebookEntry.Product2.Name ||
childProd.Product2.Name)}}</span>

cpq-product-config-custom-action (layout)
The cpq-product-config-custom-action layout can render custom actions in the CPQ user interface. You can
use the cpq-product-config-custom-action layout when you must customize the default look and feel of a
field, or when you must add your own custom implementation. You can also use this layout when an

© 2021 Vlocity LLC, a Salesforce


company 138
CME CPQ

attribute requires an external data source to populate it. For example, for a telephone reservation, you can
call out to an external system.

Template
cpq-product-config-custom-action

Cards
Empty

© 2021 Vlocity LLC, a Salesforce


company 139
CME CPQ

Image

cpq-product-config-custom-action (template)
The cpq-product-config-custom-action template is associated with the cpq-product-config-custom-action
layout. It provides a very basic structure on which you can base custom actions.

In the example provided, any attribute in the Cat3 category uses the custom action to automatically
generate a phone number or to look phone numbers up using a custom Visualforce page.

© 2021 Vlocity LLC, a Salesforce


company 140
CME CPQ

Type
Containers

Code
HTML, CSS/SCSS

Example HTML
<div class="slds-grid slds-grid--vertical cpq-product-cart-config">
<div class="slds-col slds-no-flex cpq-product-cart-config-header">
<div class="slds-grid slds-grid--align-end">
<button class="slds-button slds-button--icon" ng-
click="importedScope.close()">
<slds-button-svg-icon sprite="'utility'" size="'large'"
icon="'close'"></slds-button-svg-icon>
<span class="slds-assistive-text">Close</span>
</button>
</div>
</div>
<!-- scroll class is added for ionic scroll-->
<div class="slds-col cpq-product-cart-config-form scroll">
<div>
<div ng-if="importedScope.attributesObj &&
importedScope.attributesObj.length > 0 && !
importedScope.reRenderAttributesForm">
<vlocity-dynamic-form name="productconfig" form-on-
change="importedScope.getModifiedAttributes(e, null, true);"
ng-model="importedScope.attributesObj" map-
object="{{importedScope.mapObject()}}" class="slds-form--stacked" form-auto-
save="true">
</vlocity-dynamic-form>
</div>
<div ng-if="importedScope.attributesObj &&
importedScope.attributesObj.length === 0">
No configurable attributes for this item.
</div>
</div>
<div class="slds-m-top--x-large" ng-init="showInfo = true">
<div class="slds-section" ng-class="{'slds-is-open': showInfo, 'slds-is-
closed': !showInfo}">
<h3 href="javascript:void(0);" class="slds-section__title" ng-
click="showInfo = !showInfo">
<button type="button" class="slds-button slds-section__title-
action">
<slds-button-svg-icon sprite="'utility'" icon="'switch'" extra-
classes="'slds-section__title-action-icon slds-button__icon--left'"></slds-

© 2021 Vlocity LLC, a Salesforce


company 141
CME CPQ

button-svg-icon>
Additional Setting
</button>
</h3>
<div class="slds-section__content">
<div class="slds-form--stacked">
<div class="slds-form-element" ng-repeat="lookupItem in
importedScope.lookupItemList">
<span class="slds-form-element__label slds-text-body--
regular">{{::lookupItem.label}}</span>
<div class="slds-form-element__control slds-input-has-fixed-
addon">
<span class="slds-form-
element__static">{{lookupItem.displayValue}}</span>
<span class="slds-form-element__addon">
<button type="button" class="slds-button slds-p-
horizontal--xx-small" ng-
click="importedScope.launchLineItemLookup(lookupItem)">
<slds-button-svg-icon sprite="'utility'" icon="'edit'"></
slds-button-svg-icon>
<span class="slds-assistive-text">Display Lookup Values</
span>
</button>
</span>
</div>
</div>
<div class="slds-form-element" ng-repeat="editableItem in
importedScope.editableItemList">
<label class="slds-form-
element__label">{{::editableItem.label}}<span ng-if="editableItem.dataType ===
'PERCENT'"> %</span></label>
<div class="slds-form-element__control">
<input ng-if="::editableItem.dataType === 'STRING'" type='text'
class="slds-input" ng-model='editableItem.value' ng-model-options="{ updateOn:
'default blur', debounce: { 'default': 800, 'blur': 0 } }"
ng-change="importedScope.refreshEditableField(editableItem ,
true);"/>
<input ng-if="::(editableItem.fieldName === 'Quantity' ||
editableItem.dataType === 'CURRENCY' || editableItem.dataType === 'PERCENT')"
type='number' step='any' class="slds-input" ng-model='editableItem.value' ng-
model-options="{ updateOn: 'default blur', debounce: { 'default': 800, 'blur':
0 } }"
ng-change="importedScope.refreshEditableField(editableItem,
true);"/>
<span class="error-msg">{{editableItem.qtyValidationMessage}}</
span>

© 2021 Vlocity LLC, a Salesforce


company 142
CME CPQ

</div>
</div>
</div>
</div>
</div>
</div>
<!--Display save button only when editable fields are available-->
<div class="slds-form-element cpq-product-cart-config-form-savebar" ng-
if="importedScope.attributesObj && importedScope.attributesObj.length >0 ||
importedScope.lookupItemList && importedScope.lookupItemList.length >0 ||
importedScope.editableItemList && importedScope.editableItemList.length >0">
<div class="slds-spinner_container" ng-show="importedScope.isConfigSubmit">
<div class="slds-spinner--brand slds-spinner slds-spinner--small" aria-
hidden="false" role="alert">
<div class="slds-spinner__dot-a"></div>
<div class="slds-spinner__dot-b"></div>
</div>
</div>
</div>
</div>

Example CSS
/*** CPQ Theme VARIABLES ***/
@import "cpq-theme-variables";
/*** MIXINS ***/
@import "cpq-mixin";
/*** STYLES ***/
.vlocity {
.cpq-product-cart-config {
background-color: $cpq-product-container-bg-color;
position: absolute;
top: $cpq-cart-container-tabs-height + $cpq-cart-container-tabs-top-
margin;
right: $cpq-padding-large-horizontal/2;
bottom: 0;
left: $cpq-padding-large-horizontal/2;
.cpq-product-cart-config-header {
padding: $cpq-padding-large-vertical $cpq-padding-large-horizontal;
}
.cpq-product-cart-config-form {
margin-bottom: 60px;
overflow-y: scroll;
margin-top: -$cpq-padding-large-vertical;
padding: 0px $cpq-padding-large-horizontal $cpq-padding-large-
vertical*2;

© 2021 Vlocity LLC, a Salesforce


company 143
CME CPQ

.cpq-product-cart-config-form-savebar {
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
padding: 15px 15px 18px;
background: $white;
}
.error-msg {
color: $error;
font-size: $cpq-product-cart-config-error-font-size;
margin-top: $cpq-product-cart-config-error-margin-top;
}
}
}
}

© 2021 Vlocity LLC, a Salesforce


company 144
CME CPQ

Image

cpq-product-details (card)
The cpq-product-details card displays the details for one product in the Product Details dialog box.

Title
Product details

© 2021 Vlocity LLC, a Salesforce


company 145
CME CPQ

Filter
None

Card Session Variables


None

Data Source
None

States
Product details

Template
cpq-product-item-details (template)

Actions
None

Flyout
None

Conditions
None

Image

cpq-product-filters (layout)
The cpq-product-filters layout renders the filterable attributes list panel, including the Reset and Apply
buttons.

Template
cpq-product-filters (template)

Layout Session Variables


None

© 2021 Vlocity LLC, a Salesforce


company 146
CME CPQ

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getCartsAttributes

Input Map
Input Map Variable Value
cartId {{params.id}}

Result JSON Path


records[0].attributeCategories.records

REST API Information


Get Filterable Attributes

For more information, see Get Filterable Attributes.

GET /services/apexrest/vlocity_cmt/v2/cpq/carts/{{params.id}}/attributes

Cards
Empty

© 2021 Vlocity LLC, a Salesforce


company 147
CME CPQ

Image

cpq-product-filters (template)
The cpq-product-filters template provides the structure for the filterable attributes list panel, including the
Reset and Apply buttons.

Template Type
Containers

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 148
CME CPQ

Image

cpq-product-item (card)
The cpq-product-item card displays each product in the product list the cart.

Title
ProductItem

Filter
None

Card Session Variables


None

Data Source
None

© 2021 Vlocity LLC, a Salesforce


company 149
CME CPQ

States
active

Template
cpq-product-item (template)

Actions
None

Flyout
cpq-product-item-more (layout)

Conditions
None

Image

cpq-product-item (template)
The cpq-product-item template provides the structure for each product in the product list in the cart.

In Vlocity Communications, Media, and Energy Summer '18,cpq-product-item has been changed:

• Provides multi-language support to translate Product Name.


• Provides multi-language support to translate price list entry text for RecurringPrice__c, UnitPrice, and
OneTimeLoyaltyPrice__c.

Template Type
Cards

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 150
CME CPQ

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

First Change
<div class="slds-col slds-small-size_10-of-12 slds-medium-size_10-of-12 slds-
large-size_10-of-12">
<p class="slds-tile__title slds-truncate cpq-product-name">
{{::obj.Name.value}}</p>
</div>
<div class="slds-col slds-small-size_10-of-12 slds-medium-size_10-of-12 slds-
large-size_10-of-12">
<p class="slds-tile__title slds-truncate cpq-product-name" cpq-
translate="Product2.Name">{{::obj.Name.value}}</p>
</div>

Second Change
<span class=""slds-text-body_small"">
{{::importedScope.getPriceValue(obj, importedScope.nsPrefix
+'RecurringPrice__c')}}
</span>
<span class=""slds-text-body_small"" cpq-
translate=""PriceListEntry.DisplayText"">
{{::importedScope.getPriceValue(obj, importedScope.nsPrefix
+'RecurringPrice__c')}}
</span>

Third Change
<span class="slds-text-body_small">
{{::importedScope.getPriceValue(obj, 'UnitPrice')}}
</span>
<span class="slds-text-body_small" cpq-translate="PriceListEntry.DisplayText">

© 2021 Vlocity LLC, a Salesforce


company 151
CME CPQ

{{::importedScope.getPriceValue(obj, 'UnitPrice')}}
</span>

Fourth Change
<span ng-if="::obj[$root.nsPrefix + 'OneTimeLoyaltyPrice__c']">
<span class="slds-text-body_small">&nbsp;
{{::importedScope.customLabels.CPQOr}}</span>
<span class="slds-text-body_small cpq-loyalty-points">&nbsp;
{{::obj[$root.nsPrefix + 'OneTimeLoyaltyPrice__c'].value}}</span>
<span class="slds-text-body_small cpq-loyalty-points">{{::obj.LoyaltyCode}}</
span>
</span>
<span ng-if="::(obj[$root.nsPrefix + 'OneTimeLoyaltyPrice__c'].value ||
obj.LoyaltyCode)">
<span class="slds-text-body_small">&nbsp;
{{::importedScope.customLabels.CPQOr}}&nbsp;</span>
<span class="slds-text-body_small cpq-loyalty-points" cpq-
translate="PriceListEntry.DisplayText">{{::(obj[$root.nsPrefix +
'OneTimeLoyaltyPrice__c'].value || obj.LoyaltyCode) }}</span>
</span>

Fifth Change
<span class="slds-text-body_small cpq-loyalty-points">
{{::obj.LoyaltyCode}}
</span>
<span class="slds-text-body_small cpq-loyalty-points" cpq-
translate="PriceListEntry.DisplayText">
{{::(obj[$root.nsPrefix + 'OneTimeLoyaltyPrice__c'].value ||
obj.LoyaltyCode) }}
</span>

Sixth Change
<li ng-repeat="msg in obj.messages" class="slds-p-vertical_xx-small">
<span class="cpq-error-msg" ng-if="msg.severity ===
'ERROR'">{{msg.message}}</span>
<span class="cpq-warning-msg" ng-if="msg.severity !==
'ERROR'">{{msg.message}}</span>
</li>
<li ng-repeat="msg in obj.messages" class="slds-p-vertical_xx-small">
<span class="cpq-error-msg" ng-if="msg.severity === 'ERROR'" cpq-
translate="Product2.Name">{{msg.message}</span>
<span class="cpq-warning-msg" ng-if="msg.severity !== 'ERROR'" cpq-
translate="Product2.Name">{msg.message}</span>
</li>

© 2021 Vlocity LLC, a Salesforce


company 152
CME CPQ

cpq-product-item-details (template)
The cpq-product-item-details template provides the structure for each product in the Product Details dialog
box.

In Vlocity Communications, Media, and Energy Summer '18, cpq-product-item-details has been changed:

• Provides multi-language support to translate Product Name and Product Description.


• Provides multi-language support to translate price list entry text for both RecurringPrice__c and
OneTimeLoyaltyPrice__c.
• Supports retrieving Vlocity attachments for images using the new function
getProductAttachments().
• Adjusted SCSS.

Template Type
Cards

Code
HTML, CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

First Change

<div class="slds-tile__title slds-text-heading_medium">


{{::obj.Name.value}}
</div>
<div class="slds-tile__title slds-text-heading_medium" cpq-
translate="Product2.Name">
{{::obj.Name.value}}
</div>

© 2021 Vlocity LLC, a Salesforce


company 153
CME CPQ

Second Change
<div class="cpq-product-item-table-row-item cpq-product-item-table-flex-recur
cpq-cart-item-attr-value">
{{::importedScope.getPriceValue(obj, importedScope.nsPrefix
+'RecurringPrice__c')}}
</div>
<div class="cpq-product-item-table-row-item cpq-product-item-table-flex-recur
cpq-cart-item-attr-value"
cpq-translate="PriceListEntry.DisplayText">
{{::importedScope.getPriceValue(obj, importedScope.nsPrefix
+'RecurringPrice__c')}}
</div>

Third Change
<div class="cpq-product-item-table-row-item cpq-product-item-table-flex-
onetime cpq-cart-item-attr-value">
{{::importedScope.getPriceValue(obj, 'UnitPrice')}}
<span ng-if="::obj[$root.nsPrefix + 'OneTimeLoyaltyPrice__c']">&nbsp;
{{::importedScope.customLabels.CPQOr}}
<span class="cpq-loyalty-points">&nbsp;{{::obj[$root.nsPrefix +
'OneTimeLoyaltyPrice__c'].value}}</span>
<div class="cpq-product-item-table-row-item cpq-product-item-table-flex-
onetime cpq-cart-item-attr-value">
{{::importedScope.getPriceValue(obj, 'UnitPrice') |
CPQTranslateFilter:'PriceListEntry.DisplayText'}}
<span ng-if="::obj[$root.nsPrefix + 'OneTimeLoyaltyPrice__c']"> &nbsp
{{::importedScope.customLabels.CPQOr}}&nbsp;
<span class="cpq-loyalty-points" cpq-
translate="PriceListEntry.DisplayText"> {{::obj[$root.nsPrefix +
'OneTimeLoyaltyPrice__c'].value}}</span>

Fourth Change
<div class="slds-tile__detail slds-text-body_small">
{{::obj.Product2.Description}}
</div>
<div class="slds-tile__detail slds-text-body_small" cpq-
translate="Product2.Description">
{{::obj.Product2.Description}}
</div>

Fifth Change
<ul class="scroll">
<!--Supporting only images as of now-->

© 2021 Vlocity LLC, a Salesforce


company 154
CME CPQ

<li ng-repeat="media in obj.Attachments">


<ul class="scroll">
<!--Supporting only images as of now-->
<li ng-repeat="media in ::importedScope.getProductAttachments(obj)">

SCSS Change
.#{$namespace}-product-item-table-row-item {
display: flex;
flex-flow: row nowrap;
flex: 1 0 auto;

In Summer '18, replace the CSS statements above with the following:

.#{$namespace}-product-item-table-row-item {
display: flex;
flex-flow: row nowrap;
flex: 1 0 33%;

cpq-product-item-more (layout)
The cpq-product-item-more layout renders the Product Details dialog box.

Template
cpq-product-item-more (template)

Layout Session Variables


None

Data Source
Dual

Remote Class
CpqAppHandler

Remote Method
getCartsProductsById

Input Map
Input Map Variable Value
cartId {{params.id}}
id {{parent.Id.value}}
includeAttachment true

© 2021 Vlocity LLC, a Salesforce


company 155
CME CPQ

Result JSON Path


records

REST API Information


Get Products

For more information, see Get List of Products.

GET /vlocity_cmt/v2/cpq/carts/{{params.id}}/products?
id={{parent.Id.value}}&includeAttachment=true

Cards
cpq-product-details (card)

Image

cpq-product-item-more (template)
The cpq-product-item-more template provides the base structure for the Product Details dialog box.

Template Type
Flyout

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 156
CME CPQ

Image

cpq-product-list (layout)
The cpq-product-list layout renders the product list in the cart.

In Vlocity Communications, Media, and Energy Summer '18, cpq-product-list has been changed—
localeCode is passed as a parameter to the data source for multi-language support.

Template
cpq-product-list (layout)

Layout Session Variables

Name Value
totalSize payload.totalSize
nextProducts payload.actions.nextproducts

Data Source
Dual

Remote Class

CpqAppHandler

Remote Method

getCartsProducts

Input Map

Input Map Variable Value


cartId {{params.id}}
fields IsActive,Id,Name,UnitPrice,ProductCode,vlocity_cmt__RecurringPrice__c
pagesize 10
localeCode {{attrs.cpqUserLocale}}

© 2021 Vlocity LLC, a Salesforce


company 157
CME CPQ

Result JSON Path


records

REST API Information


Get Products

For more information, see Get Products.

GET /vlocity_cmt/v2/cpq/carts/{{params.id}}/products?
hierarchy=2&pagesize=10&fields=IsActive,Id,Name,UnitPrice,ProductCode,vlocity_c
mt__RecurringPrice__c

Cards
cpq-product-item (card)

© 2021 Vlocity LLC, a Salesforce


company 158
CME CPQ

Image

cpq-product-list (template)
The cpq-product-list template provides the structure for the product list in the cart.

Template Type
Containers

Code
HTML, CSS/SCSS

© 2021 Vlocity LLC, a Salesforce


company 159
CME CPQ

Image

cpq-promotion-item (card)
The cpq-promotion-item card renders each individual promotion line item in Vlocity Cart.

Title
promotionItem

Filter
None

© 2021 Vlocity LLC, a Salesforce


company 160
CME CPQ

Card Session Variables


None

Data Source
None

Remote Class
None

Remote Method
None

Input map
None

Result JSON Path


None

REST API Information


None

States
active

Template
cpq-promotion-item

Actions
None

Flyout
None

Conditions
None

Image

cpq-promotion-item (template)
The cpq-promotion-item template provides the structure for an individual promotion line item in Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 161
CME CPQ

In Vlocity Communications, Media, and Energy Summer '18, cpq-promotion-item has been changed to
provide multi-language support to translate Promotion Name, Promotion Code, and Promotion Description.

Template Type
Cards

Code
HTML, CSS/SCSS

Image

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

First Change
<div class="slds-col slds-small-size_10-of-12 slds-medium-size_10-of-12 slds-
large-size_10-of-12">
<p class="slds-tile__title slds-truncate cpq-promotion-
name">{{::obj.Name}}</p>
</div>
<div class="slds-col slds-small-size_10-of-12 slds-medium-size_10-of-12 slds-
large-size_10-of-12">
<p class="slds-tile__title slds-truncate cpq-promotion-name" cpq-
translate="Promotion.Name">{{::obj.Name}}</p>
</div>

Second Change
<div>
<span class="cpq-promotion-
label">{{::importedScope.customLabels.CPQPromoCode | uppercase}}: </span>
<span class="slds-text-body_small"> {{::obj[$root.nsPrefix+'Code__c']}}</
span>
</div>
<div>
<span class="cpq-promotion-
label">{{::importedScope.customLabels.CPQPromoCode | uppercase}}: </span>
<span class="slds-text-body_small" cpq-translate="Promotion.Code">

© 2021 Vlocity LLC, a Salesforce


company 162
CME CPQ

{{::obj[$root.nsPrefix+'Code__c']}}</span>
</div>

Third Change

<div>{{::obj.Description__c}}</div>
<div cpq-translate="Promotion.Description">{{::obj.description}}</div>

Fourth Change

<li ng-repeat="msg in obj.messages" class="slds-p-vertical_xx-small">


<span class="cpq-error-msg" ng-if="msg.severity === 'ERROR'">
{{msg.message}}</span>
<span class="cpq-warning-msg" ng-if="msg.severity !== 'ERROR'">
{{msg.message}}</span>
</li>
<li ng-repeat="msg in obj.messages" class="slds-p-vertical_xx-small">
<span class="cpq-error-msg" ng-if="msg.severity === 'ERROR'" cpq-
translate="Promotion.Name"> {{msg.message}}</span>
<span class="cpq-warning-msg" ng-if="msg.severity !== 'ERROR'" cpq-
translate="Promotion.Name"> {{msg.message}}</span>
</li>

cpq-promotions-list (layout)
The cpq-promotions-list layout renders the Promotions list in Vlocity Cart.

In Vlocity Communications, Media, and Energy Summer '18 and later releases, localeCode is passed as a
parameter to the data source for multi-language support.

Template
cpq-promotions-list (template)

Layout Session Variables

Name Value
totalSize payload.totalSize
nextPromotion payload.actions.nextpromotions

Data Source
Dual

Remote Class

CpqAppHandler

© 2021 Vlocity LLC, a Salesforce


company 163
CME CPQ

Remote Method
getCartsPromotions

Input map
Input Map Variable Value
cartId {{params.id}}
includeIneligible {{attrs.includeIneligible}}
localeCode {{attrs.cpqUserLocale}}

Result JSON Path


records

REST API Information


GET /services/apexrest/{namespace}/v2/cpq/carts/{{params.id}}/promotions?
includeIneligible={{attrs.includeIneligible}}

Cards
cpq-promotion-item (card)

© 2021 Vlocity LLC, a Salesforce


company 164
CME CPQ

Image

cpq-promotions-list (template)
The cpq-promotions-list template provides the structure for the Promotions list in Vlocity Cart.

Template Type
Containers

© 2021 Vlocity LLC, a Salesforce


company 165
CME CPQ

Code
HTML, CSS/SCSS

Image

cpq-slds-prompt (layout)
The cpq-slds-prompt layout contains the cpq-slds-prompt template, which can be customized to create
prompts in Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 166
CME CPQ

Template
cpq-slds-prompt (template)

Layout Session Variables


None

Data Source
No source

Cards
None

Image
None

cpq-slds-prompt (template)
The cpq-slds-prompt template enables you to customize prompts in Vlocity Cart.

Template Type
Containers

Code
HTML

Image

cpq-theme-variables (template)
The cpq-theme-variables template contains variables used in other templates.

Template Type
Mixin

Code
CSS/SCSS

Image
n/a

© 2021 Vlocity LLC, a Salesforce


company 167
CME CPQ

Example 5. Example CSS for cpq-theme-variables

/***
***** CPQ THEME VARIABLES ****
Add only the theme file here. Don't add any code here.
It's easier to swap the theme here rather than swapping in every other
template.
If you swap the theme here, all templates will automatically get the latest.

NOTE

Note: You need to re save all the templates once you change the
theme. Also, if you change theme files, refresh the browser and
then save the templates.

***/
@import "cpq-base-theme-variables";

cpq-total-bar (layout)
The cpq-total-bar layout renders the total bar in the cart.

Template
cpq-total-card (template)

Layout Session Variables


None

Data Source
Dual

Remote Class

CpqAppHandler

Remote Method

getCarts

© 2021 Vlocity LLC, a Salesforce


company 168
CME CPQ

Input Map
Input Map Variable Value
cartId {{params.id}}
price true
validate true

Result JSON Path


records[0].details.records[0]

REST API Information


Get Cart Details

For more information, see Get Cart Details.

GET /services/apexrest/vlocity_cmt/v2/cpq/carts/{{params.id}}?
validate=true&price=true

Cards
cpq-total-bar-card

Image

cpq-total-bar (template)
The cpq-total-bar template provides the structure for the total bar in the cart.

In Vlocity Communications, Media, and Energy Summer '18, cpq-total-bar has had alignment changes to
one action, displayName, removed.

Template Type
Containers

Code
HTML, CSS/SCSS

Image

© 2021 Vlocity LLC, a Salesforce


company 169
CME CPQ

Upgrade from Vlocity CME Winter '18 to Vlocity CME Summer '18
When upgrading from Vlocity Communications, Media, and Energy Winter '18 to Vlocity Communications,
Media, and Energy Summer '18, you must make the following changes to the HTML in the Card Designer.

<span ng-show="records.actions &&


records.actions.checkout">{{::$root.vlocity.getCustomLabel(action.displayName,
action.displayName)}}</span>
<span ng-show="records.actions &&
records.actions.checkout">{{::$root.vlocity.getCustomLabel(action.displayName)}
}</span>

cpq-total-bar-card
The cpq-total-bar-card card renders the total bar in the cart.

Title
Total Card

Filter
None

Card Session Variables


None

Data Source
None

States

• Active Opportunity
• Active Quote
• Active Order

Template
cpq-total-card (template)

Actions

• For an Opportunity, Create Quote.


• For a Quote, Create Order.
• For an Order, Create Assets.

Flyout
None

© 2021 Vlocity LLC, a Salesforce


company 170
CME CPQ

Conditions
• ['ObjectType'] = 'Opportunity'
• ['ObjectType'] = 'Quote'
• ['ObjectType'] = 'Order'

Image

cpq-total-card (template)
The cpq-total-card template provides the text and buttons, as well as their styling, for the total bar in the
cart.

Template Type
Cards

Code
HTML, CSS/SCSS

Image

Asset-Based Ordering
An asset is a standard Salesforce object that represents an item of commercial value, such as a product or
service sold by your company or a competitor, that an account or contact owns. Vlocity extensions to the
Asset object support special features such as discounts, bundle pricing, cancellation fees, and customer
preferences.

Asset-based ordering is based on a customer's existing products and services. Assets are subscribed to
services and products.

Assets are created during the CPQ order management process. Whether an asset is created right away
depends on the product or service.

The asset provisioning status indicates the current state of the product or service:

• New: The order has been placed, but it has not been provisioned or activated.
• Active: The customer currently enjoys the asset. Until a service starts, an asset is not active.
• Deleted: The product or service is no longer available to the customer.

© 2021 Vlocity LLC, a Salesforce


company 171
CME CPQ

Many customer orders impact the products and services that the customer has already purchased. A
customer may want to modify their assets by:

• Adding a service, such as enabling international roaming from a smartphone.


• Adding a product, such as adding another smartphone to a family phone plan.
• Updating a service, such as changing the Internet speed for their residential broadband service.
• Disconnect a service, such as canceling a cable service.

Vlocity supports the creation of quotes and orders against a set of customer assets. In the first stage of
order capture, an opportunity moves to a quote and then to an order. With the completion of the order, the
order becomes an asset. If the customer wants to change the asset, revert the asset back to order status.

You change an existing asset by moving it to either:

• A quote, and once the quote is complete, move the quote to an order, and then an asset
• An order, and once the order is complete, move the order to an asset.

Vlocity provides the ability to work across line items (XLI). Using Field Mapper, you map fields in the
Opportunity, Order, Quote, and Asset objects. For more information, see Map Fields for Asset-Based
Ordering.

Using Object Mapper, you can move data to and from any object. For more information, see Map Objects
for Asset-Based Ordering.

Move, Add, Change, Delete (MACD)


Changing an asset to an order or a quote initiates a guided process that moves one or more assets
between service locations.

MACD stands for:

• Move: Move products or services from one location to another.


• Add: Add new products or services.
• Change: Change existing products or services.
• Delete, disconnect, or discontinue existing products or services.

The customer sets the move in and move out dates, selects the move location, and generates an order to
disconnect assets from the original location and connect them to the new location.

© 2021 Vlocity LLC, a Salesforce


company 172
CME CPQ

Asset-based ordering ensures that data is accurately captured through any channel or device. You can add
first-level assets using a new opportunity to quote to order to asset cycle.

Asset Reference IDs


Vlocity uses the asset reference ID and the provisioning status to track the asset across objects in the
asset-based ordering (ABO) life cycle.

Each line item in an order has an asset reference ID. If the assets are created or mastered in Salesforce,
Vlocity populates the asset reference ID with a Global Unique Identifier (GUID). If the assets are created or
mastered in an external system, Vlocity populates the asset reference ID with the external reference ID.

The typical order flow includes a quote. The quote line item has an ID, such as Q001. When the quote
becomes an order, the order line item has an ID, such as O001. When the order becomes an asset, the
asset reference ID is based on the order line item ID (O001).

When the asset is used to create a quote, the quote line item ID changes, such as Q002. The asset
reference ID remains the same: O001. When that quote becomes an order, the order line item ID changes,
such as O002. The asset reference ID remains the same: O001. When you use the
RetireABOAssetImplementation, a new asset is created. When you use the
DefaultABOAssetImplementation, the old asset is updated. Either way, the asset reference ID remains the
same, O001.

Figure 13. Asset-Based Ordering Process with IDs

© 2021 Vlocity LLC, a Salesforce


company 173
CME CPQ

See Also

• ABOAssetInterface
• DefaultABOAssetImplementation
• RetireABOAssetImplementation
• UseAssetReferenceIdForParentAndRoot

Selecting the Asset-Based Ordering Implementation


Asset-based ordering uses Vlocity interfaces and implementations.

Clicking the Submit Order button triggers the ABOAssetInterface implementation.

Vlocity provides two ABOAssetInterface implementations:

• DefaultABOAssetImplementation: The asset is updated and the provisioning status becomes


active. This implementation does not create two asset records.
• RetireABOAssetImplementation: The current asset is replaced by a new asset. The old asset has
the provisioning status retired, and the new asset has the provisioning status active. This implementation
always creates more than one asset record.

TIP
The FieldMapperInterface is triggered when copying a set of fields on one object to a
mapped set of fields on another object. Field Mapper is central to the asset-based ordering
process. See Map Fields for Asset-Based Ordering.

To set the asset-based ordering implementation:

1. Go to the Interface Implementations tab.


2. From the View picklist, select All.
3. Click Go.

4. Click ABOAssetInterface.
5. Next to the appropriate implementation, click Edit.

© 2021 Vlocity LLC, a Salesforce


company 174
CME CPQ

6. On the Interface Implementation Detail Edit page, select Active.


7. Click Save.

You can also create your own implementation. See Interfaces, Implementations, and Services.

Submitting an Order and Creating Assets


Submitting an order calls the asset-based ordering interface implementation, which creates assets from the
order.

You begin the ordering process by creating an opportunity or a quote. The opportunity becomes a quote,
and the quote becomes an order. Each line item in an object has an ID. When the order is converted to an
asset, the provisioning status becomes active and the asset reference ID is set, based on the Order Line
Item object ID. See Asset Reference IDs.

After the first order and first asset have been created, you can change the asset to a quote or an order. As
the process continues, the provisioning status changes. When that order becomes a subsequent asset,
what happens to the asset depends on the ABOAssetInterface implementation. See Select the Asset-
Based Ordering Implementation.

When using asset-based ordering, the following fields must be populated on an OrderItem:

• Name
• AccountId
• Price
• Product2Id
• Quantity
• vlocity_cmt_LineNumber_c
• vlocity_cmt_OneTimeTotal_c
• vlocity_cmt_RecurringTotal_c
• vlocity_cmt_ProvisioningStatus_c
• vlocity_cmt_PricebookEntryId_c
• vlocity_cmt_ServiceAccountId_c
• vlocity_cmt_BillingAccountId_c

To submit an order and create assets using Vlocity Cart, make any necessary changes and click Create
Assets.

© 2021 Vlocity LLC, a Salesforce


company 175
CME CPQ

Converting an Asset to a Quote or an Order


Vlocity supports creating quotes and orders against a set of one or more customer assets.

In all cases of asset-based ordering, you change an existing asset by moving it to:

• A quote, and once the quote is complete, you move the quote to an order
• An order

To convert an asset to a quote or an order:

1. Go to the Account record detail page.


2. Scroll down to the appropriate Asset list.
3. Select the Asset to change.

NOTE
If the Asset is part of a bundle or hierarchy, all of the Assets in that bundle or hierarchy
are selected.

4. Click Change to Quote or Change to Order.

When changing an asset to a quote or order, the line item quantities are disabled. This is because it is not
possible to change the line item quantities while converting an asset to a quote or an order.

Details Required for Asset-Based Orders


The following table lists the details required for asset-based orders. The fields listed below exist on the
Asset sObject.

Field Name Description


Name The asset name
AccountId The account ID
Price The asset price
Product2Id The product line item ID
Quantity The item quantity
(Pricelist fields) Details about the appropriate Vlocity price list
vlocity_cmt__LineNumber__c Line item number
vlocity_cmt__OneTimeTotal__c One-time total charge for the item
vlocity_cmt__RecurringTotal__c Recurring total charge for the item
vlocity_cmt__ProvisioningStatus__c Provisioning status, such as Active
vlocity_cmt__PricebookEntryId__c Salesforce price book entry ID
vlocity_cmt__ServiceAccountId__c The service account ID
vlocity_cmt__BillingAccountId__c The billing account ID
vlocity_cmt__AssetReferenceId__c The asset reference ID

© 2021 Vlocity LLC, a Salesforce


company 176
CME CPQ

Field Name Description


vlocity_cmt__ProductHierarchyPath__c The path to the product in the Vlocity product hierarchy. Required to render in cards or
Vlocity Cart.
vlocity_cmt__RootItemId__c The root line item ID. Required to render in cards or Vlocity Cart.

Asset-Based Ordering Visualforce Pages


There are three standard Visualforce pages and six Visualforce pages based on the Vlocity Cards
framework.

TIP
Vlocity recommends using the cards-based Visualforce pages. The standard Visualforce
pages only list an account's assets, individually, without any indication of product hierarchy.
The cards-based Visualforce pages include product hierarchy.

Asset-based ordering uses three Visualforce pages, which appear on the Account object:

• AllAssets includes all assets for this account.


• BillingAssets includes only the assets where the billing account is the same as the parent account. That
is, BillingAssets displays assets where the Asset.Billing Account = Account, where Account is the
current account you are viewing.
• AssetConfiguration includes only the assets in this service location for this account.

The following cards-based Visualforce pages appear on the Account, Opportunity, Order, or Quote objects:

• All Assets (CardFramework) includes all assets for this account.


• Billed Assets (CardFramework) includes only the assets where the billing account is the same as the
parent account.
• Service Assets (CardFramework) includes only the assets in this service location for this account.
• Review Order Cart readonly (CardFramework) includes all assets in this order.
• Review Opportunity Cart readonly (CardFramework) includes all assets in this opportunity.
• Review Quote Cart readonly (CardFramework) includes all assets in this quote.

To see the entire page name, you may need to hover over the page name in the object palette.

© 2021 Vlocity LLC, a Salesforce


company 177
CME CPQ

NOTE
As the names imply, the Review Order Cart readonly, Review Opportunity Cart readonly,
and Review Quote Cart readonly pages are read only. You cannot change the assets from
these Visualforce pages.

Assets with the provisioning status deleted are not displayed on the Asset Visualforce pages.

Figure 14. Service Assets Visualforce Page

Figure 15. Billing Assets Visualforce Page

Figure 16. All Assets Visualforce Page

© 2021 Vlocity LLC, a Salesforce


company 178
CME CPQ

Figure 17. All Assets Cards-Based Visualforce Page

Figure 18. Review Order Cart (Read Only) Visualforce Page

By default, the service account and billing account are the same as the asset's account. However, accounts
can be related to one another, so the billing account and service account may be different from one
another.

Multiple assets may have the same billing account, but different service accounts.

Mapping Fields for Asset-Based Ordering


Asset-based ordering uses Field Mapper to move data between opportunities, orders, quotes, and assets.

Field Mapper maps fields from one object to another to move it between objects. Vlocity provides a base
set of field mappings as part of the Vlocity Communications, Media, and Energy package. You must map
any additional fields to and from the following objects, as required:

• Opportunity to Quote
• Quote to Order
• Order to Asset

© 2021 Vlocity LLC, a Salesforce


company 179
CME CPQ

• Asset to Quote Line Item


• Asset to Order Product
• Opportunity Product to Quote Line Item
• Quote Line Item to Order Product

You can reset default field mappings by running the Field Maps Maintenance job.

To map fields for asset-based ordering:

1. Go to the Field Mapper tab.


2. From the Source Object picklist, select Opportunity.
3. From the Destination Object picklist, select Quote.

4. Click Load Settings.


Fields on the left are fields in the source object—Opportunity. Fields on the right are fields in the
destination object—Quote. The specific fields you see depends on how your org is set up.
To map a field from the opportunity to the quote, you must select the fields to map from the Opportunity
list on the left and select the field from the Quote on the right.
5. Click Add.
6. In the Fields Map list, click Select.
The Field Selection dialog box opens.

© 2021 Vlocity LLC, a Salesforce


company 180
CME CPQ

7. Select the appropriate field.


The option you select in the first column may expose more columns.
8. Continue to select the appropriate fields.
9. Repeat steps 5 through 8 for each field to map.
10. When you are done mapping fields, click Save.

© 2021 Vlocity LLC, a Salesforce


company 181
CME CPQ

11. From the Source Object picklist, select Quote.


12. From the Destination Object picklist, select Order.
13. Repeat steps 4 through 10. Continue this procedure until you have mapped all of the object fields.

Mapping Objects for Asset-Based Ordering


Using Object Mapper, you can move items, such as line item attachments and custom child objects
throughout the asset-based ordering cycle.

Object Mapper moves data from one object to another. The Object Mapper can take more objects through
the asset-based ordering process. Object Mapper maps child line items and their related objects and fields.

For example, you may have created an object Subsidiary as a child of the line item object. You can specify
that Subsidiary is moved with the line item objects.

By default, asset-based ordering takes quotes, orders, assets, and their associated line items through the
process. You can add more objects using Object Mapper. If you do not specify an object mapping, only the
header and header line items are moved. If you specify an object map but the field mappings do not exist,
the process will not fail. However, a log entry notes this issue.

TIP
You can reset the object maps using the Object Maps Maintenance job under Vlocity CMT
Administration → Maintenance Jobs → Object Maps Maintenance job.

© 2021 Vlocity LLC, a Salesforce


company 182
CME CPQ

Object Mapper uses the custom object Custom Object Map (CustomObjectMap__c) to store the object
mapping, which has the following custom fields:

Table 1. Custom Fields of the Custom Object Map Object


Custom Field Description Example
Source Parent Object Stores the source parent object name. Opportunity

SourceParentObject__c
Destination Parent Object Stores the destination parent object name. Quote

DestinationParentObject__c
Source Child Object Stores the source child object name OpportunityLineItem

SourceChildObject__c
Destination Child Object Stores the destination child object name. QuoteLineItem

DestinationChildObject__c
Parent Source Reference Field Stores parent source reference field OpportunityId in OpportunityLineItem

PartentSourceReferenceField__c
Parent Destination Reference Field Stores child target reference field QuoteId in QuoteLineItem

ParentDestinationreferenceField__c

NOTE
Vlocity cannot create objects related to the OpportunityLineItem object. This is a
Salesforce limitation. See Child Object to Opportunity Product in the Salesforce Help.

To map objects:
1. Go to the Object Mapper tab.

© 2021 Vlocity LLC, a Salesforce


company 183
CME CPQ

2. Select the Source Parent Object, for example, Quote.


3. Select the Destination Parent Object, for example, Order.
4. From Source Object, select the child object to map.
5. From Destination Object, select the child object to map.
6. From Parent source reference field, select the parent object field to map.
7. From Destination source reference field, select the destination object field to map.

8. To add more mappings, click Add.

© 2021 Vlocity LLC, a Salesforce


company 184
CME CPQ

NOTE
If you click Add in error, to delete the mapping, click the trash icon to the right of the
picklists. When the message opens, click Delete.

9. When you are done mapping child objects, click Save.

Delete Object Mappings


You can use the Object Mapper to delete object mappings.

To delete object mappings:

1. Go to App Launcher → Object Mapper.


2. Select the Source Parent Object element to edit.
3. Select the Destination Parent Object element to edit.
The mappings for those objects appear.

4. To the right of the mapping to delete, click the trash icon.


5. When the message opens, click Delete.
6. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 185
CME CPQ

Editing Object Mappings


You can use the Object Mapper edit object mappings.

To edit object mappings:

1. Go to App Launcher → Object Mapper.


2. Select the Source Parent Object element to edit.
3. Select the Destination Parent Object element to edit.
The mappings for those objects appear.

4. To add more mappings, click Add.


5. To change mappings, select the appropriate Source Object, Destination Object, Parent Source
Reference Field, and Parent Destination Reference Field.
6. Click Save.

Mapping Fields Using Field Mapper


Field Mapper is a custom field mapping tool to map fields between the Opportunity, Quote, Order, and
Asset objects.

Vlocity Communications, Media, and Energy supports cross-line item (XLI) actions, in which line items
move from an opportunity to a quote to an order to an asset and then back again. The actions move order
information between objects and support moving data to or from any object.

© 2021 Vlocity LLC, a Salesforce


company 186
CME CPQ

Field Mapper supports the CPQ process to enable data movement between objects. You can move order
information between objects. You can move additional fields to each object by mapping fields from one
object to fields on another object. Using Field Mapper, you can move any field from any source object to
any field of the same type in any destination object.

From the Service Assets related list on an Account record, you can change one or more assets back to an
order or a quote.

When an order is complete, you can create assets from the products within an order.

You can create a quote from an opportunity.

For information on resetting the mappings to the out of box defaults and picking up any new fields that have
been added to the data model, see Field Maps Maintenance.

© 2021 Vlocity LLC, a Salesforce


company 187
CME CPQ

Adding a New Field to Field Mapper


Field Mapper is preconfigured to map all the available fields between objects. If you add fields to the Asset,
Opportunity, Quote, or Order objects, use Field Mapper to map them between objects.

To add a new mapping:


1. Go to the Field Mapper tab.
2. Select the Source Object and Destination Object—for example, OpportunityLineItem, OrderItem,
Asset, or QuoteLineItem.

3. Click Load Settings.


The Fields Map displays the fields that can be mapped. Fields on the left are fields in the source object
—in this example, Opportunity. Fields on the right are fields in the destination object—Quote. The
specific fields you see depend on how your org is set up.
To map a field from an opportunity to a quote, you must select the fields to map from the opportunity
list on the left and select the field from the quote on the right.
4. Click Add.
5. In the Fields Map list, click Select.
The Field Selection dialog box opens.

© 2021 Vlocity LLC, a Salesforce


company 188
CME CPQ

6. Click Select.
7. Select the new field on the source object.

NOTE
You can also select a relational field on the source object—for example,
Product2.Name.

8. The option you select in the first column may expose more columns. If so, select the appropriate
option.
9. Repeat steps 5 through 8 for each field to map.

© 2021 Vlocity LLC, a Salesforce


company 189
CME CPQ

10. Click Save.


11. Select the field in the destination object to map.

NOTE
Except for ID fields, which can be mapped to fields of type reference, fields can only
be mapped to fields of the same type.

12. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 190
CME CPQ

13. To add filters to mapped fields, go to Add a Filter to the Field Mapper.

Adding a Filter to Field Mapper


You can filter or limit source fields based on the configured conditions.

Filters are inclusive and the conditions can be defined in a formula expression. If a formula is not indicated,
the filters will be joined through an and statement.

To add a filter to Field Mapper:

1. Go to the Field Mapper tab.


2. Select the Source Object and Destination Object—for example, OpportunityLineItem, OrderItem,
Asset, or QuoteLineItem.
3. Click the Filters List tab.
4. Click Add.
5. From the first picklist, select the field by which to filter.
6. From the second picklist, select the operator.
7. In the field, enter the field value.
8. Repeat steps 4 through 7 for all filter fields.
9. Click Save.

For example, the following image shows the filters to map fields from an opportunity to a quote if Status ≠
"active" and SLA = "Low".

Editing Field Mappings


You can go to the Field Mapper and select the field mappings you want to edit for the objects involved.

Field Mapper creates entries in the Custom Field Map custom setting. However, to edit field mappings, you
go back into Field Mapper and select field mappings to edit such as for the Opportunity object and the
Contract object.

© 2021 Vlocity LLC, a Salesforce


company 191
CME CPQ

To edit field mappings:

1. Go to the Field Mapper tab.


2. From the Source Object list, select the source object with the fields to edit.
3. From the Destination Object list, select the destination object with the fields to edit.
4. Click Load Settings.
Fields on the left are fields in the source object. Fields on the right are fields in the destination object.
The specific fields you see depends on how your org is set up.
5. Follow the instructions in Add a New Field to the Field Mapper to select fields.
6. When you are done editing fields, click Save.

In-Flight Amendments
When you create and submit an order, the order status changes to in-progress, and Vlocity Order
Management (OM) processes it and fulfills the order. An in-flight order is an order (an original or
supplemental order) that is submitted and is not fulfilled. In Winter '20 and later, the In-Flight Amendments
feature enables you to amend or cancel your order by using supplemental or follow-on orders. If the order
or order items you submitted is still in progress and if the order or order items have not passed the point of
no return (PONR), Vlocity CPQ allows you to amend or cancel the order by creating a supplemental order.
If OM has fulfilled the order, you can amend the order by creating a follow-on order and submit the changes
to be queued until OM fulfills the original order. See Supplemental Orders and Follow-On Orders. Your
organization defines the PONR, as explained in Configuring the Point of No Return (PONR).

Supplemental Orders
A supplemental order is an order that Vlocity CPQcreates when you amend or cancel an in-flight order that
has not passed PONR. For example, when you submit an order in the Vlocity Cart, the order status
changes to in-progress for OM to process it further. However, if you want to make changes to the order you
submitted, such as change the color of the iPhone you selected or add a product, Vlocity CPQ creates a
supplemental order. You can amend, discard, or cancel a supplemental order. A supplemental order
replaces the original in-flight order, and Vlocity CPQ stops processing the original order after the
supplemental order is submitted. See Amend In-Flight Orders.

© 2021 Vlocity LLC, a Salesforce


company 192
CME CPQ

Vlocity CPQ creates a supplemental order only if an in-flight order has not passed PONR. When an order
passes PONR, you can neither modify nor cancel the order. See Follow-On Orders.

The In-Flight Order Amendment feature allows you to amend an in-flight supplemental order. A
supplemental order is said to be in-flight when you submit the supplemental order to OM but want to amend
the order before the order is fulfilled.

You can use supplemental orders in the following scenarios:

• You want to revise a submitted order. When you amend the order, Vlocity CPQ creates a supplemental
order and its status is set to Ready-to-submit. When you submit the order after making changes, the
original in-flight order is superseded, and the supplemental order is activated in Vlocity Order
Management.

© 2021 Vlocity LLC, a Salesforce


company 193
CME CPQ

• You want to revise a submitted order but later decided not to do so. When you amend the order, Vlocity
CPQ creates a supplemental order and its status is set to Ready-to-submit. After you submit it, you can
discard the supplemental order if needed. After you discard a supplemental order, the original order
status changes back to In-Progress.

• You created an order but want to cancel that order after you submitted it. When you cancel the order,
Vlocity CPQ creates a supplemental order with a cancel-request in progress. When you confirm the
cancellation, the original in-flight order is superseded and the original order is canceled. See Cancel an
In-Flight Order.

© 2021 Vlocity LLC, a Salesforce


company 194
CME CPQ

Follow-On Orders
When an in-flight order or order items have passed PONR, you can no longer modify the order or order
items. After an order line item passes PONR, it is grayed out, and you cannot change that order line item.
In such a scenario, Vlocity CPQ creates a follow-on order. A follow-on order captures the changes that you
want to submit after the original order is fulfilled. When you submit a follow-on order, it is queued in CPQ
until the original order is fulfilled and is then processed by Order Management. See Amend In-Flight
Orders.

See Also

• In-flight Amendments in Order Management

© 2021 Vlocity LLC, a Salesforce


company 195
CME CPQ

Amend In-Flight Orders


Any order that is in the process of fulfillment is referred to as an In-flight order. Using the Amending In-Flight
Orders feature, you can modify your order after you have submitted it. It helps you fine-tune your order
before order management completes its fulfillment.

If you want to cancel the original order, see Cancel an In-Flight Order.

1. From the App Launcher, search for Orders and open it.
2. From the orders list, select an order to amend.
3. In the tab for the order, select Amend from the menu.

You can also select Amend from the Vlocity Cart for the order.
CPQ creates a supplemental order with the order status set to Ready to Submit. The original order
status changes to Amend Requested.
4. As required, add, modify, or delete the cart line items. You can also modify, add, or cancel a promotion
and discount that applies to a line item.
You can modify a line item only if it has not passed the point of no return (PONR). PONR is a state in
the order fulfillment process after which you cannot modify an order, including a promotion or discount
that applies.
See In-Flight Amendments.

© 2021 Vlocity LLC, a Salesforce


company 196
CME CPQ

NOTE
After you complete amending the supplemental order, you can also discard the
changes before you submit the order for fulfillment.

To discard the changes you made to the order, from the cart actions, click the arrow
and then click Discard. CPQdiscards the supplemental order and the original order is
activated for order fulfillment. See Order Statuses in CPQ.

5. When you complete amending the supplemental order, click Submit order.
After you submit an amended order, the following status changes occur on the supplemental and the
original orders:
• OM accepts the order: The supplemental order status changes to In-Progress and the original order
is superseded.
• OM rejects the order: The supplemental order is rejected and the original order is activated.
• OM provisionally accepts the order: The supplemental order is provisionally accepted, its status is
set to In-progress, and the original order status changes to superseded. OM validates the submitted
order before accepting the order.
• OM provisionally accepts then rejects the order: The supplemental order is provisionally accepted.
However, OM rejects the supplemental order as it cannot process it for fulfillment. The original order
is activated.

NOTE
If the order is a follow-on order, the order is queued until the original order is fulfilled
by OM. See In-Flight Amendments.

See Also
• Cancel an In-Flight Order
• View Status Notifications for In-Flight Orders
• View Amendment History for In-Flight Orders

Cancel an In-Flight Order


You can cancel a submitted order if it has not passed the point of no return (PONR).

You submitted an order and Order Management (OM) accepted it for order fulfillment. If you want to cancel
the whole order or a few order line items within the order, you can send a cancellation request to the order
management system if the order or order items have not passed PONR. CPQ system creates a
supplemental order for canceling the order. When the cancellation is accepted by OM, the original order is
superseded, and the supplemental order is canceled.

© 2021 Vlocity LLC, a Salesforce


company 197
CME CPQ

To cancel an in-flight order using a supplemental order:

1. On the App Launcher, search for Orders and open it.


The Orders page opens.
2. From the orders list, select an order to cancel.
The order must be submitted and in the In-progress state.
3. In the tab for the order, select Cancel from the menu.

You can also select Cancel from the Vlocity Cart for the order.
4. In the cancellation request window, click Next.
The system submits the cancellation request to OM. When OM accepts the cancellation, the original
order is canceled.

See Also

• In-Flight Amendments

© 2021 Vlocity LLC, a Salesforce


company 198
CME CPQ

• Order Statuses in CPQ

Order Statuses in CPQ


In Vlocity CPQ, an order changes status several times before order management processes and fulfills the
order. The following table lists the available order statuses in Vlocity CPQ.

Order Status Indicates that...


Ready To Submit The order is created and is ready for order capture. It is not submitted to order management.
(Draft)
In Progress The order is submitted to order management, and order management has accepted the order for fulfillment.
Activated The order was submitted. and order management has fulfilled the order. This is one of the final states.
Cancel The order was submitted to order management, and order management had accepted it. But you want to cancel
Requested the order. The system creates a supplemental order for cancellation and submits it to OM.
Canceled Prior to Winter '20, canceling an order creates a supplemental order with the intent of canceling the original order.
When the supplemental order is accepted by OM the original order is assigned a status of Canceled while the
supplemental order is assigned a status of Completed.

For Winter '20 and later, the system creates a supplemental order with the intent of canceling the original order.
When the supplemental order is canceled the original order is superseded.
Queued The order is submitted and queued for order fulfillment.
Amend The original order was submitted to order management and accepted for fulfillment. You then amend the in-flight
Requested order. A supplemental order with an intent to amend is created and is submitted to order management.
Superseded The supplemental order is fulfilled successfully. When an order has a supplemental order that order management
accepts for the fulfillment, the original order is assigned a status of Superseded.

See Amend In-Flight Orders.


Rejected The order is rejected by order management as the order passed Point of No Return (PONR).

See In-Flight Amendments.


Frozen The order can no longer be changed. An order has this status between a request for a cancel or amend and the
creation of a supplemental order. An order might have this status for a short time, and you might not this status.
Submitted The order is submitted, and order management responds with the Provisionally Accepted message, which
indicates that order management accepts the order for further processing before completing the fulfillment
process.
Discarded The system discards the supplemental order when you do not intend to proceed with the changes you made to
the order. The original in-flight order is activated for order fulfillment.

View Amendment History for In-Flight Orders


You can view the supplemental and follow-on orders associated with an order.

1. In the App Launcher, search for Orders and open it.


2. From the Orders list, open an order.
3. In the tab for the order, select Amendment History from the menu.

© 2021 Vlocity LLC, a Salesforce


company 199
CME CPQ

Results
The Order Amendment History opens for the selected order.

See Also
• In-Flight Amendments
• View Status Notifications for In-Flight Orders
• Order Statuses in CPQ
• Cancel an In-Flight Order
• Amend In-Flight Orders

View Status Notifications for In-Flight Orders


After submitting or amending an order, you can check its status.

© 2021 Vlocity LLC, a Salesforce


company 200
CME CPQ

Vlocity CPQ provides notification messages after you submit a supplemental order:

• Whether the order management system rejected or accepted an order item or supplemental order.
• What the status of an order or order item is, such as Activated or In Progress.
• Whether a supplemental order was converted to a follow-on order.

1. In the App Launcher, search for Orders and open it.


2. From the orders list, select an order.
3. In the tab for the order, select Status Notifications from the menu.
You can also view an order's status notifications from the Vlocity Cart for the order. An OM Notifications
page shows the status notifications for all orders in the Vlocity CPQ.

Results
The Order Management Notifications page shows the following information:

• The order ID, which includes a link to the Order Details page
• The message type, such as Order Activated
• The message content
• The date and time when the message was created
• The account associated with the order
• The account status, such as Activated
For descriptions of the different states, see Order Statuses in CPQ.

See Also

• Cancel an In-Flight Order


• Amend In-Flight Orders
• View Amendment History for In-Flight Orders

Manage In-Flight Orders


On the Orders tab, you can cancel, amend, and discard orders, and you can show status notifications and
amendment history. You do not need to be in Vlocity Cart.

Prior to Fall '20, you had to cancel an in-flight order from the Cart.

Before You Begin


1. Create and submit an order.

© 2021 Vlocity LLC, a Salesforce


company 201
CME CPQ

1. From the Orders tab, open a submitted order.


2. From the list, you can select options for in-flight orders.
• Cancel order — Send a cancellation request to order management for a base order that has not
passed PONR. See Cancel an In-Flight Order.
• Amend order — Modify a submitted order that is In Progress but hasn't passed PONR. This creates
a supplemental order that supersedes the base order. If an order has passed PONR, you have the
option to create a follow-on order. See Amend In-Flight Orders.
• Discard order — Delete a supplemental order before it is submitted.
• Show Status Notifications — See the notification messages for an order. See View Status
Notifications for In-Flight Orders.
• Show Amendment History — View a base order and its supplemental and follow-on orders. See
View Amendment History for In-Flight Orders.

See Also
• In-Flight Amendments

In-Flight Order Cancellation


Vlocity CPQ supports the cancellation of in-flight orders.

NOTE
This topic covers order cancellation for Vlocity releases Summer '18 through Fall '19. For
Winter '20 and later releases, see Cancel an In-Flight Order.

Supported Cancellation Flows


When you cancel a submitted order, CPQ sends another order, known as a supplemental order, to the
order management system. The supplemental order links to the original order from which the request was
initiated and holds the reference to the original order. The original order becomes the superseded order.
The order management system takes the supplemental order.

When Vlocity CPQ contacts the order management system and initiates the cancel request, it determines
whether the order has passed the point of no return (PONR) and updates the PONR fields on the order
header.

The CPQ interface expects a success or failure status on the supplemental order back from the order
management system. CPQ then processes the success or failure response and updates the status of the
supplemental order to, for example, Canceled.

When canceling a submitted order, the first few steps in the process are:

© 2021 Vlocity LLC, a Salesforce


company 202
CME CPQ

1. The original order has a status of Draft and is ready to submit.


2. The user clicks Submit Order.
3. The order progresses, with a status of Draft.
4. The user clicks Cancel Order.
5. A cancellation request is sent to the order management system to cancel the submitted order. At the
same time, a supplemental order is created.

The order cancellation is then processed according to one of the following scenarios:

Cancel Success:

1. The order management system returns a status indicating that the original order has been canceled
successfully.
2. The original order is canceled, and the supplemental order is completed with a status of Activated.

Cancel Failed:

1. The order management system returns a status indicating that the original order cannot be canceled.
Therefore, the cancellation has failed.
2. The original order continues to progress with a status of In Progress. The supplemental order is not
processed by the order management system and is deleted.

Cancel Retry Success when Order Management needs more time:

1. CPQ waits for the order management system to return a synchronous call with a Success status. CPQ
does this by listening on the Streaming channel. The Streaming channel is a Salesforce feature that
monitors changes to Salesforce data. CPQ uses the Streaming channel for long-running cancel order
requests. The CPQ interface listens on the Streaming channel to check with the order management
system for the status of the supplemental order. The server is responsible for telling the client, which
has subscribed to Streaming Channel, when the request is complete, so the client does not have to
keep trying to contact the server. The server posts the response on the Streaming channel.
2. The original order is canceled, and the supplemental order is completed with a status of Activated.

Cancel Retry Fail when Order Management needs more time:

1. The order management system may require more time to process and complete the cancellation
request before returning a synchronous call with a failed status. During this time, the order in CPQ
remains In Progress. Once the Failed status is returned, the supplemental order is deleted.
2. The original order continues to progress, with a status of Draft. The supplemental order is not
processed by the order management system and is deleted.

© 2021 Vlocity LLC, a Salesforce


company 203
CME CPQ

Setting Up the Order Management Interface Implementation

NOTE
This section covers the Order Management Interface for Vlocity CME releases Summer
'18 through Fall '19. For CME Winter '20 and later releases, see Order Management
Integration.

Ensure you have installed the latest package and performed the required post-installation steps, including:

• Refresh Vlocity Cards and Templates.


• Verify that the XOMSupplementalOrderLifeCycle interface implementation is active.
• Create a remote site setting. See Creating a Remote Site Setting for Cancelling Orders.

To set up the Order Management interface implementation:

1. Navigate to Interface Implementations.


2. Select XOMSupplementalOrderLifeCycle. The Interface Implementation page for
XOMSupplementalOrderLifeCycle appears.
3. Click an available implementation.
4. Click the Active checkbox if you want this to be the active implementation. Click Save when done.
You can also create a new interface implementation, set it to active, then select it from the available
Implementation list.

Cancellation Process
Prior to CME Winter '20, when canceling an order, the following methods are invoked:

1. preValidate
Once Vlocity Cart's Cancel Order button is clicked, the UI calls the
SupplementalOrderService.preValidate interface, which then calls
XOMSuccessSupplementalOrderLifeCycle.preValidate to get a response from the order management
system. XOMSuccessSupplementalOrderLifeCycle.preValidate retrieves order status and changes
allowed from the order and returns true or false based on whether cancel order is allowed on the order.
This process checks whether the PONR for an order has been reached. PONR is evaluated based on
the order status and changes allowed field on the header. If the order status is In Progress and
changes allowed is true, PONR is returned as true. Otherwise, it is false.
In case PONR has not been reached for the order requested for cancellation, the order is canceled and
a supplemental order is created and submitted to the order management system.
preValidate has the following parameters:
• Input parameter: cartId = ID of the original order
• Output parameter: PONRStatus = true/false

© 2021 Vlocity LLC, a Salesforce


company 204
CME CPQ

The preValidate API determines if an order can be canceled. The API calls the Order Management
(XOM) system to retrieve the real-time PONR status.
• Action URL: /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/prevalidate
• HTTP method: POST
• Method name: preValidate
• REST handler: APIPrevalidateCartsCPQV2
• Apex remote service: CpqAppHandler
• Response format: JSON
Sample Request

POST /services/apexrest/vlocity_cmt/v2/cpq/carts/8011I000000KnqDQAS/
prevalidate

Sample Response

{
"totalSize": 1,
"records": [
{
"actions": {
"cancelcart": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011I000000KqTPQA0/cancel"
},
"remote": {
"params": {
"cartId": "8011I000000KqTPQA0",
"methodName": "cancelCart"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"user_vlocity_cmt__IsChangesAllowed__c": true,
"user_vlocity_cmt__OrderStatus__c": "In Progress"
}
]
}
2. submitCancelOrder

© 2021 Vlocity LLC, a Salesforce


company 205
CME CPQ

Once you click the Cancel Order confirmation button, the UI calls the CPQ interface
SupplementalOrderService.createAndSubmitCancelOrder. This interface calls
XOMSuccessSupplementalOrderLifeCycle.submitCancelOrder.
XOMSuccessSupplementalOrderLifeCycle.submitCancelOrder creates the second order (supplemental
order), appends the order ID of the original order, submits the supplemental order to the order
management systems, and returns the supplemental order ID in the response.
submitCancelOrder has the following parameters:
• Input parameter: cartId = ID of the supplemental order
• Output parameters:
• cancelOrderId = ID of the supplemental order
• submitStatus = complete/failed
The Cancel Order API cancels an order, creates a supplemental order, and submits it to the order
management (XOM) system. Once the order management system processes the supplemental order,
the API updates the original order to Canceled.
• Action URL: /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/cancel
• HTTP method: POST
• Method name: cancelCart
• REST handler: APICancelCartsCPQV2
• Apex remote service: CpqAppHandler
• Apex remote input map: {}
• Response format: JSON
Sample Request

POST /services/apexrest/vlocity_cmt/v2/cpq/carts/8011I000000KnqDQAS/cancel

BODY {}
Sample Response

{
"totalSize": 1,
"messages": [
{
"code": "305",
"severity": "INFO",
"message": "Your order has been cancelled."
}
],
"records": [
{
"displaySequence": -1,
"vlocity_cmt__OrderStatus__c": "Cancelled",
"vlocity_cmt__IsChangesAllowed__c": false
}
]
}

© 2021 Vlocity LLC, a Salesforce


company 206
CME CPQ

3. submit
XOMSupplementalOrderLifeCycle.submit submits the order to the order management system.
submit has the following parameters:
• Input parameter: cartId = ID of the order
• Output parameter: submitStatus = Complete/Failed
The Cancel Requested status appears on the Cart:

4. createSupplementalOrder
Call this method if you want the ability to cancel the original request. For releases prior to CME Winter
'20, any supplemental order is treated as an order cancellation.

CPQ Data Model Changes for Order Cancellation


The following fields extend the Vlocity CPQ data model to support cancellation requests for submitted
orders:

• Changes Accepted: The order management system acknowledges changes requested have been
accepted.
• Changes Allowed: The order management system notifies CPQ if the order has passed PONR. If so,
changes are not allowed. Changes Allowed enables the Cancel Order button on the Vlocity Cart.
Changes Accepted and Changes Allowed can both be left unchecked, but only one can be checked.
• Superseded Order: Links to the original order from which the request was initiated, and holds the
reference to the original order on the supplemental order.
• Order Status: Vlocity CPQ order status, which can be Ready To Submit, In Progress, Activated, Cancel
Requested, Cancelled and Completed. The status is automatically set to Ready To Submit for a new
order.

© 2021 Vlocity LLC, a Salesforce


company 207
CME CPQ

See Also
• Cancel Order
• Cancel a Submitted Order
• Create Supplemental Order
• Freeze Order
• Submit a Cancel Order Request

Future-Dated Orders and Order Queuing in CPQ


You create a Future-Dated Order (FDO) when you want to create an order today but provision it in the
future.

For example, a user is about to move from one home to another and wants to transfer the existing cable TV
service to the new home. However, the user plans to move within three days and requests the move of the
cable TV service to be completed after three days, that is, if today is Dec 1st, the user wants the move to
be completed on Dec 3rd.

Using the Future-Dated Orders feature, you can create a new order or modify an existing order that can be
submitted in the future. You can create a new order with the requested start date in the future or change an
existing order and set the requested start date in the future. When you submit a future-dated order, the
order moves into the queued order list.

NOTE
An order is queued only when the requested start date is in the future.

To create and view future-dated orders and order queuing:

1. Enable order queuing.


1. Log in to Salesforce.

2. Using the Lightning App Launcher , search for Vlocity CMT Administration and open it.
3. Click Enable Features under Custom Settings.
4. Enable the Future-Dated Order queue option.
It is disabled by default. Click OK when prompted.
2. Create a future-dated order.

a. Using the Lightning App Launcher , search for Orders and open it.
The Orders page opens.
b. Click New to create a new order.
See Creating an Order Using Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 208
CME CPQ

c. In the Requested Start Date field enter a future date.


d. Click Save.
A future-dated is created.
3. Submit the future-dated order.
1. On the Orders tab, click the future-dated order you created.
The Orders page opens.
2. Click Configure Order.
The Vlocity cart opens.
3. Select a price list, for example, B2C.
4. Select the product(s) you want to add to the future-dated order.
5. Click Add to Cart.
6. When you finalize your order, click Submit Order.
The order gets into the queued order list as its requested start date is in the future.
4. View queued orders.
1. Go to Vlocity App Launcher, search for Queued Orders and open it.
The Queued Orders page displays order information such as order name, status, account name,
requested start date-time, and action.

2. It is possible to submit a queued future-dated order before its requested start date by clicking the
Force Submit action. A confirmation message appears stating that the assigned requested start
date will be ignored and the order will be submitted. The order is then removed from the queued
order list.
You can submit all orders at a time by clicking Submit All on the Queued Orders page. This
triggers a batch job schedule to submit all orders. You can use this option in case a batch job
submission is missed.
See Scheduling a Submit-Batch Job for Queued Orders.

NOTE
You can search for queued orders by the order number, order id, or account name
using the search option on the Queued Orders page.

Scheduling a Submit-Batch Job for Queued Orders


The queued orders are submitted on a future date specified in the Requested Start Date field. For
submitting a queued order, you must schedule and run a batch job.

To schedule a submit-batch job:

© 2021 Vlocity LLC, a Salesforce


company 209
CME CPQ

1. Go to Vlocity App Launcher, search for Queued Orders and open it.
2. On the Queued Orders tab, select the future-dated queued order for which you want to schedule a
submit job.
3. Click Schedule Submit Job.
The Queued order dialog box is displayed.
4. Enter a Cron expression. A Cron expression is a time-based job scheduler typically used to execute
some routine. Cron expressions allow you to configure the frequency in which a batch job should run.
A default Cron value, 0 0 * * * ? is configured that runs the batch job every hour.

Table 2. Examples of Cron values to use for batch scheduling


Expression Description
0013**? Runs every day at 1 PM
0 0 22 ? * 6L Runs the last Friday of every month at 10 PM
0 0 10 ? * MON-FRI Runs Monday through Friday at 10 AM
0 0 20 * * ? 2010 Runs every day at 8 PM during the year 2010
5. Click Schedule. The batch job starts and a Scheduled successfully message appears.
6. To check the scheduled batch job details, click Schedule Submit Job again. You will see the batch job
details such as Scheduled on, Current job status, Next fire time, Previous fire Time, and Cron
expression. You can reschedule a batch job by using the same or a different Cron value.

© 2021 Vlocity LLC, a Salesforce


company 210
CME CPQ

Creating a Change Order


When you change an order, existing assets are marked with an orange flag. You can change an order
through an account's assets. You select the assets and change them to a new order. A change order is also
known as a future-dated order.

To change an order:

1. Go the Account record detail page.


2. Scroll down to the Asset Visualforce page.
3. Select the assets to update.
4. Click Change to Order.
The Creating Future Dated Orders OmniScript opens.
Future-dated orders are orders that execute in the future. Vlocity Cart displays only those items,
including promotions, that are effective for that date.
5. Select a request date.
6. Click Next.

A new order opens in Vlocity Cart.

You can see existing promotions on the Promotions tab. From there, you can cancel promotions and search
the Promotions list for more promotions to update or add.

Cancel a Submitted Order


With CPQ, customers have the ability to cancel their submitted orders prior to having the order reach the
point of no return (PONR). After an order is submitted to downstream fulfillment systems, the order is
locked.

NOTICE
This topic applies to releases prior to Winter '20. For the current cancellation instructions,
see Cancel an In-Flight Order.

During the order cancellation process, CPQ consults with the order management system to check whether
PONR is reached for requested changes, and checks if order cancellation is completed successfully.

When you click Submit Order, CPQ invokes a Vlocity Action upon successful return, Vlocity Cart is
refreshed, the order status changes to In Progress, and the Submit button in the Total bar, along with the
entire Vlocity Cart, is read-only (grayed out). The Cancel Order button is shown in the Order Header
section.

© 2021 Vlocity LLC, a Salesforce


company 211
CME CPQ

Before You Begin


Ensure you have installed the latest package and performed the required post-installation steps, including:

• Refresh Vlocity Cards and Templates.


• Verify the Interface Implementation XOMSupplementalOrderLifeCycle is active. To create interface implementation details, see
Configuring the Cancel Order Feature.

• After submitting an order, click the Cancel Order button, which is available on the hybrid CPQ page.

Results
The following events occur:

• A synchronous API call returns an error if the order has reached PONR. The error is displayed on the UI
indicating it is too late to cancel the order.
• If PONR has not been reached, the API returns a new order ID. This new order is in Pending
Cancellation status while the order on which the Cancel request was initiated is in Superseded status.
• The page reloads and Vlocity Cart is refreshed. The order status shows Canceled upon successful
cancellation. The newly created supplemental order is read-only. All the buttons, including Submit Order,
are grayed out and not clickable.

© 2021 Vlocity LLC, a Salesforce


company 212
CME CPQ

If the order cancellation failed, you receive an error message similar to that shown in the following
example:

See Also
Configuring the Cancel Order Feature.

Opportunity, Quote, and Order Managers (Deprecated)


Vlocity Communications, Media, and Energy agents use the Opportunity, Quote, and Order Managers or
Vlocity Cart to create opportunities, quotes, and orders. Vlocity Cart replaces the Opportunity, Quote, and
Order Managers. Information about the managers is included for customers who have not yet upgraded.

© 2021 Vlocity LLC, a Salesforce


company 213
CME CPQ

Setting Up Managers and Review Cart Interfaces


You can customize the review cart interface in the Opportunity, Order, and Quote Managers to display
additional columns.

You can configure the columns in two ways:

• Field sets are available for opportunity and quote line items but not for order line items.
• Custom settings are available for all objects.

If neither fieldsets nor custom settings are present for the object, then the user sees the default set of
columns:

• Product Name
• Quantity
• One Time List
• One Time Discount
• One Time Total
• Monthly List
• Monthly Discount
• Monthly Total
• Provisioning Status
• Premises
• Service Location
• Billing Account

NOTE
The Opportunity, Order, and Quote Managers are being deprecated in favor of the Vlocity
Cards-based user interface, also known as Vlocity Cart.

Customizing the Review Cart Using Field Sets


You can customize the Opportunity Manager and Quote Manager review cart columns by using field sets.
This procedure provides specific steps to configure the Opportunity Manager review cart interface.

To customize the review cart using field sets:

1. From Setup, in the Quick Find box, enter Field Sets.


2. Under Opportunity Products, click Field Sets.
3. Click New.
4. On the New Field Set page, enter the following information:
• Field Set Label is the name presented to users in a managed package.

© 2021 Vlocity LLC, a Salesforce


company 214
CME CPQ

• Field Set Name is the name of the field set on the Visualforce page.
• Where is this used? provides a description of which Visualforce pages use the field set and for
what purpose.

5. Click Save.
6. Drag each field to include in the Opportunity Manager from the palette into the In the Field Set list.
The list sequence is the sequence in which the field sets will appear in the review cart.

7. Click Save.
8. From Setup, in the Quick Find box, enter Custom Settings.
9. Click Custom Settings.
10. Next to FieldsConfiguration, click Manage.
11. Click New.
12. On the FieldsConfiguration Edit page, enter the following information:

© 2021 Vlocity LLC, a Salesforce


company 215
CME CPQ

• Name is a name for the field setting, in this case, Application.OpportunityLineItem.


• Feature is the entity to which this setting applies, in this case, Application.
• FieldSet Name is the field set name, in this case, OpportunityConfiguration.
• Object Name is the object to which this field setting applies, in this case, OpportunityLineItem.
• IsActive indicates whether the field set is active.

13. Click Save.

NOTE
The Opportunity, Order, and Quote Managers are deprecated. Use the Vlocity Cards-
based user interface, also known as Vlocity Cart.

Adding Custom Fields to the Cart


You can add custom non-Vlocity fields for display in Vlocity Cart. To ensure that the custom fields are
properly displayed (not empty), you create a field setting so that getCartsItems (called when the cart is
loaded) and postCartsItems (called when you click add to cart) return the fields so they are displayed in the
UI.

To create a field setting:

1. In your org, go to Setup, search for Custom Settings, and then click Custom Settings.
2. Click the Manage link on Next to Field Settings.
The Field Settings Detail page appears.
3. Click New.
4. Enter the details for the following:
• Name: Enter a name for your field with a maximum of 38 characters. This value must be unique
across objects because Salesforce will not allow you to save duplicate custom settings. As a best
practice, add a short prefix to the API name of your field. For example, use the OI prefix for
OrderItem, QLI for QuoteLineItem, and OLI for OpportunityLineItem.

© 2021 Vlocity LLC, a Salesforce


company 216
CME CPQ

• Feature: Enter CPQV2 to link to the Cart-Based CPQ APIs.


• Field Name: Enter the API name of your field.
• Object Name is the API name of the object, which is typically OpportunityLineItem,
QuoteLineItem, or OrderItem.
5. Click Save.

6. Update the line item. If you have attribute-based pricing with outputs to custom fields, you must
implement the following CpqAppHandler hook or the custom fields will not populate:

/
***************************************************************************
*****************************
* @description This is a hook implementation of the open Vlocity
interface. It acts like a trigger handler for the Vlocity CPQ API.
* @group Vlocity Interface implementations
***************************************************************************
******************************/
@TestVisible
global with sharing class CpqAppHandlerHookImplementation implements
vlocity_cmt.VlocityOpenInterface {
public Boolean InvokeMethod(String methodName, Map <String, Object>
input, Map<String, Object> output, Map <String,Object> options) {
if (methodName.equalsIgnoreCase('putCartsItems.postInvoke')) {
System.debug('######## putCartsItems.postInvoke #########' );
putCartsItems_postInvoke(methodname, input, output, options);
return true;
}
return false;
}
private void putCartsItems_postInvoke(String methodName, Map <String,
Object> input, Map<String, Object> output, Map <String,Object> options){
//System.debug('######## inside putCartsItems_postInvoke #########' );
Vlocity_cmt.JSONResult res = (Vlocity_cmt.JSONResult)
output.get('result');
//System.debug('res-->'+res);
vlocity_cmt.JSONAction priceAction =
res.actions.get('itempricesupdated');
//system.debug('$$$$$before: priceAction-->'+priceAction);
//system.debug('$$$$$before: priceAction.remote.params--

© 2021 Vlocity LLC, a Salesforce


company 217
CME CPQ

>'+priceAction.remote.params);
String fields =
'vlocity_cmt__BillingAccountId__c,vlocity_cmt__ServiceAccountId__c,Quantity
,vlocity_cmt__RecurringTotal__c,vlocity_cmt__OneTimeTotal__c,vlocity_cmt__O
neTimeManualDiscount__c,vlocity_cmt__RecurringManualDiscount__c,vlocity_cmt
__ProvisioningStatus__c,vlocity_cmt__RecurringCharge__c,vlocity_cmt__OneTim
eCharge__c,ListPrice,vlocity_cmt__ParentItemId__c,vlocity_cmt__BillingAccou
ntId__r.Name,vlocity_cmt__ServiceAccountId__r.Name,vlocity_cmt__PremisesId_
_r.Name,vlocity_cmt__InCartQuantityMap__c,vlocity_cmt__EffectiveQuantity__c
,customer_Ceiling_Price__c,customer_Discount_Percentage__c,customer_Floor_P
rice__c,customer_Floor_Percentage__c,customer_Customer_Requested_Percentage
__c,customer_Customer_Requested_Price__c,customer_Approved_Price__c,custome
r_Approved__c,customer_Flag__c,customer_ProductType__c,customer_Quote_Recor
dType__c';
string
priceDetailsfields='vlocity_cmt__RecurringTotal__c,vlocity_cmt__OneTimeTota
l__c,vlocity_cmt__OneTimeManualDiscount__c,vlocity_cmt__RecurringManualDisc
ount__c,vlocity_cmt__RecurringCharge__c,vlocity_cmt__OneTimeCharge__c,ListP
rice,customer_Ceiling_Price__c,customer_Floor_Price__c,customer_Customer_Re
quested_Price__c,customer_Approved_Price__c,customer_Flag__c';
priceAction.remote.params.put('fields', fields);
priceAction.remote.params.put('priceDetailsFields', priceDetailsfields);
//system.debug('$$$$$after: priceAction-->'+priceAction);
//system.debug('$$$$$after: priceAction.remote.params--
>'+priceAction.remote.params);
}
global class CpqHookException extends Exception{}
}
7. Make sure to update the following lines:
• String fields = '...';: Comma-separated list of all your custom fields to display on the cart.
Have this query the Field Settings custom setting and populate from there.
• String priceDetailsfields = '...';: Comma-separated list of only pricing-related fields.
These are typically currency or number fields and not lookup fields. You might have unexpected
behavior if you add non-pricing fields. Add your custom fields one at a time and test after you add
each field.

IMPORTANT
For price-related fields, use currency fields and calculate their value as part of a
pricing plan step. Do not use formula fields for pricing.

8. Override the JavaScript controller for cpq-product-cart-item (template) and cpq-product-cart-item-child


(template) to pass the list of fields that are editable.

© 2021 Vlocity LLC, a Salesforce


company 218
CME CPQ

CustomAddFieldsPricingPlanStepImpl Apex Class


If you add custom fields to Vlocity Cart and receive an exception for a custom field that was used in a
custom pricing plan step, you can implement the following Apex classes:

Example 6. CustomAddFieldsPricingPlanStepImpl Apex Class


global with sharing class CustomAddFieldsPricingPlanStepImpl implements
vlocity_cmt.VlocityOpenInterface {
global Boolean invokeMethod(String methodName,
Map<String, Object> input,
Map<String, Object> output,
Map<String, Object> options) {
if (methodName == 'QueryCustomFieldValues') {
queryCustomFieldValues(input, output, options);
return true;
}
return false;
}

private void queryCustomFieldValues(Map<String, Object> input,


Map<String, Object> output,
Map<String, Object> options) {
List<String> customFields = new List<String> {
'TestCustom__c',
'TestCustom2__c'
};

// Get the cart line items from the pricing context


List<SObject> itemList = (List<SObject> )
vlocity_cmt.PricingPlanService.getFromPricingContext('LineItemList');

if (itemList == null || itemList.isEmpty()) return;

// Only do for OrderItem


if (itemList[0].getSObjectType().getDescribe().getName() != 'OrderItem')
return;

Boolean doQuery = false;

// test for existence of the field


try {
for (String customField: customFields) {
Object val = itemList[0].get(customField);
System.debug('***' + customField + ' ' + val);
}
} catch (Exception ex) {

© 2021 Vlocity LLC, a Salesforce


company 219
CME CPQ

System.debug(ex.getMessage());
doQuery = true;
}
if (!doQuery) return;

Map<Id, SObject> itemMap = new Map<Id, SObject> (itemList);

Set<Id> ids = itemMap.keySet();


for (SObject obj: Database.query('Select Id, ' + String.join(customFields,
',') + ' from OrderItem where Id in :ids')) {
SObject item = itemMap.get(obj.Id);
if (item != null) {
for (String customField: customFields) {
item.put(customField, obj.get(customField));
}
}
}

//test it
try {
for (String customField: customFields) {
Object val = itemList[0].get(customField);
System.debug('***' + customField + ' ' + val);
}
} catch (Exception ex) {
System.debug(ex.getMessage());
}
}
}

Example 7. CustomAddFieldsPricingPlanStepImplTest Apex Class for Testing


@isTest
private class CustomAddFieldsPricingPlanStepImplTest {

static testMethod void testAddFields() {


try {
List<SObject> sObjList = new List <SObject> ();

// Create products
Product2 prod1 = new Product2(Name = 'Product 1', ProductCode = 'PROD1');
sObjList.add(prod1);

Product2 prod2 = new Product2(Name = 'Product 2', ProductCode = 'PROD2');


sObjList.add(prod2);

© 2021 Vlocity LLC, a Salesforce


company 220
CME CPQ

insert sObjList;
sObjList.clear();

// Create Price Book Entries


Pricebook2 testPricebook = new Pricebook2(Id =
Test.getStandardPricebookId(), Name = 'TestPricebook', IsActive = true);
PricebookEntry pbe1 = new PricebookEntry(Pricebook2Id = testPricebook.Id,
Product2Id = prod1.Id, UnitPrice = 10, vlocity_cmt__RecurringPrice__c = 5,
IsActive = true);
sObjList.add(pbe1);

PricebookEntry pbe2 = new PricebookEntry(Pricebook2Id = testPricebook.Id,


Product2Id = prod2.Id, UnitPrice = 20, vlocity_cmt__RecurringPrice__c =
10, IsActive = true);
sObjList.add(pbe2);

insert sObjList;
sObjList.clear();

Account testAccount = new Account();


testAccount.Name = 'Test Account';
insert testAccount;

Order testOrder = new Order(Name = 'Test Order', EffectiveDate =


System.today(), status = 'Draft', AccountId = testAccount.Id, Pricebook2Id =
testPricebook.Id);
insert testOrder;

OrderItem orderItem = new OrderItem();


orderItem.OrderId = testOrder.Id;
orderItem.PricebookEntryId = pbe1.Id;
orderItem.Quantity = 1;
orderItem.UnitPrice = 10;
orderItem.vlocity_cmt__LineNumber__c = '0001';
orderItem.vlocity_cmt__Action__c = 'Add';
orderItem.vlocity_cmt__ProvisioningStatus__c = 'New';
orderItem.TestCustom__c = 'Hello';
orderItem.TestCustom2__c = 'World';
sObjList.add(orderItem);

OrderItem orderItem2 = new OrderItem();


orderItem2.OrderId = testOrder.Id;
orderItem2.PricebookEntryId = pbe2.Id;
orderItem2.Quantity = 1;
orderItem2.UnitPrice = 20;
orderItem2.vlocity_cmt__LineNumber__c = '0001.0001';

© 2021 Vlocity LLC, a Salesforce


company 221
CME CPQ

orderItem2.vlocity_cmt__Action__c = 'Add';
orderItem2.vlocity_cmt__ProvisioningStatus__c = 'New';
orderItem.TestCustom__c = 'Good';
orderItem.TestCustom2__c = 'Morning';
sObjList.add(orderItem2);

insert sObjList;
sObjList.clear();

Test.startTest();
List<SObject> itemList = [SELECT Id, PricebookEntry.Id,
PricebookEntry.Product2.Name, Quantity, vlocity_cmt__LineNumber__c,
vlocity_cmt__Action__c, vlocity_cmt__ProvisioningStatus__c from OrderItem
where OrderId =: testOrder.Id
];
Map <String, Object> input = new Map<String, Object>();
Map <String, Object> output = new Map<String, Object>();
Map <String, Object> options = new Map<String, Object>();
CustomAddFieldsPricingPlanStepImpl pStep = new
CustomAddFieldsPricingPlanStepImpl();

vlocity_cmt.PricingPlanService.putInPricingContext('LineItemList',
itemList);

pStep.invokeMethod('QueryCustomFieldValues', input, output, options);

Test.stopTest();
} catch (Exception e) {
System.debug('Exception: ' + e.getMessage());
throw e;
}
}
}

See Also

• Create Custom Settings in the Salesforce help


• If a field name is the same as managed package field name on the same object, a ClassCastException
could happen in a trigger

Adding a New Column to Vlocity Cart


With Vlocity Cart, you can view and configure opportunities, quotes, and orders. Vlocity Cart is constructed
using a variety of layouts, cards, and templates. Any change to the cards, layouts, and templates affects
the views of opportunities, quotes, and orders.

© 2021 Vlocity LLC, a Salesforce


company 222
CME CPQ

The cards contained in a layout and template are responsible for rendering the cart and tailoring the cart to
your needs, such as hiding columns and adding new columns. By examining the data source configured on
the card layout, you can see that it calls a CPQ API named CpqAppHandler.getCartsItems(). This
returns all the products currently in Vlocity Cart. The API takes several arguments, including the fields
parameter that controls which fields are returned in the API for each product.

© 2021 Vlocity LLC, a Salesforce


company 223
CME CPQ

Viewing CPQ getCartsItems Data


To view the data returned from the CpqAppHandler.getCartsItems() method:

© 2021 Vlocity LLC, a Salesforce


company 224
CME CPQ

1. Create a test order and add some products to Vlocity Cart.


2. Capture the internal Salesforce object identifier from the URL for the order.
3. Update the test data source settings in the cpq-product-cart layout with this ID and select View
Data.

cpq-getCartsItems-sample.json is an example of the data pulled back from the API. A subset of
the response is presented to the cards through the Result JSON Path = records configured in
the layout.

Cloning CPQ Cart Layout and Cards


To make changes to Vlocity Cart and the cards it contains, you need to clone the cards:

1. Open the active cpq-product-cart card layout.


2. Change only the Layout Author, keeping the Layout Name and Layout Type as-is.

3. Click Clone. This creates a new layout that you can customize.
4. Open the active card within the layout and deactivate it. You need to clone this card to customize it.

© 2021 Vlocity LLC, a Salesforce


company 225
CME CPQ

5. Click Clone. If you are using the CME VDO instance, do not clone the card that indicates Version
Legacy because this card is no longer used and will cause issues in Vlocity Cart, such as opening a
blank page.
After cloning the card layout, it should contain an active card named cpq-product-cart-item. You can
ignore any inactive versions of this card that appear.
6. Set the card name to cpq-product-cart-item and update the card author.

7. Activate the card.


8. Activate the layout.

Adding a New Column Based on a Regular Field


To add a new column based on a regular field to the CPQ cart:

1. Clone the cpq-product-cart layout and its cpq-product-cart-item card as detailed above so you can
make changes to it.
2. If necessary, deactivate the layout and the card.
3. On the Layout, locate the fields parameter. This is a comma-separated list of product fields that are
queried as part of the API call to getCartsItems().
• If the field you want to add to your cart is being queried, you can add it to the card state. Examine
the fields parameter to see if the field you want appears. The following is an example from a CME
org but it may differ based on vertical or version:

vlocity_cmt__BillingAccountId__c,vlocity_cmt__ServiceAccountId__c,Quantity
,vlocity_cmt__RecurringTotal__c,vlocity_cmt__OneTimeTotal__c,vlocity_cmt__
OneTimeManualDiscount__c,vlocity_cmt__RecurringManualDiscount__c,vlocity_c
mt__ProvisioningStatus__c,vlocity_cmt__RecurringCharge__c,vlocity_cmt__One
TimeCharge__c,ListPrice,vlocity_cmt__ParentItemId__c,vlocity_cmt__BillingA
ccountId__r.Name,vlocity_cmt__ServiceAccountId__r.Name,vlocity_cmt__Premis

© 2021 Vlocity LLC, a Salesforce


company 226
CME CPQ

esId__r.Name,vlocity_cmt__InCartQuantityMap__c,vlocity_cmt__EffectiveQuant
ity__c
• If the field does not appear in the list, you can append it to the list. The following example shows how
to add a custom field named vlocity_cmt__LineNumber__c.

vlocity_cmt__BillingAccountId__c,vlocity_cmt__ServiceAccountId__c,Quantity
,vlocity_cmt__RecurringTotal__c,vlocity_cmt__OneTimeTotal__c,vlocity_cmt__
OneTimeManualDiscount__c,vlocity_cmt__RecurringManualDiscount__c,vlocity_c
mt__ProvisioningStatus__c,vlocity_cmt__RecurringCharge__c,vlocity_cmt__One
TimeCharge__c,ListPrice,vlocity_cmt__ParentItemId__c,vlocity_cmt__BillingA
ccountId__r.Name,vlocity_cmt__ServiceAccountId__r.Name,vlocity_cmt__Premis
esId__r.Name,vlocity_cmt__InCartQuantityMap__c,vlocity_cmt__EffectiveQuant
ity__c,vlocity_cmt__LineNumber__c

To see which fields are available, navigate to Setup > Object Manager > Order Product, Quote Line
Item, or Opportunity Product.
The data source for this layout is of type Dual. This means the API query is performed using Apex
when running on a desktop computer, while a REST call is performed while running on a mobile
device. If you want your new columns to be available on both desktop and mobile versions of Vlocity
Cart, then add the fields to the endpoint under the Mobile Hybrid ApexRest configuration section:

4. Locate the appropriate card state to update.


Determine if your org is set up to use Loyalty by navigating to Vlocity CME Administration > Enable
Features > Loyalty.
• If Loyalty is enabled, update the card state named CustomView_CPQ_AdvancedPricingLoyalty.
• If Loyalty is not enabled, update the card state named CustomView_CPQAdvancedPricing.

© 2021 Vlocity LLC, a Salesforce


company 227
CME CPQ

5. Add the new column to the card state. Each regular field is presented to the cards using the JSON
object.
6. Within the card state, configure the entry as shown in the example diagram.

Rather than obtaining the label used in the cart from the JSON data, you can hard-code the label to
something more suitable.

After activating the card and layout, the resulting cart page should look as shown in the following example:

© 2021 Vlocity LLC, a Salesforce


company 228
CME CPQ

Adding a New Column Based on a Lookup Field


Rendering a lookup field requires some customization of the underlying card state templates:

1. Clone the cpq-product-cart layout and cpq-product-cart-item card so you can make changes to
them.
2. Deactivate the layout and the card.
3. On the layout, locate the fields parameter. This is a comma-separated list of product fields that are
queried as part of the API call to getCartsItems(). These fields contain the ID of another object within
the Salesforce data model. Instead of displaying the raw ID of that object, you can display a user-
friendly value, such as the object's name.
To query the appropriate field, add the lookup field name (replace __c with __r) and the name of the
field on the lookup object in which you are interested. You may see some examples of this already
configured, such as:

vlocity_cmt__BillingAccountId__r.Name,vlocity_cmt__ServiceAccountId__r.Name
,vlocity_cmt__PremisesId__r.Name

If you want another field, such as the type of service account, you can add it using the same syntax:

vlocity_cmt__BillingAccountId__c,vlocity_cmt__ServiceAccountId__c,Quantity,
vlocity_cmt__RecurringTotal__c,vlocity_cmt__OneTimeTotal__c,vlocity_cmt__On
eTimeManualDiscount__c,vlocity_cmt__RecurringManualDiscount__c,vlocity_cmt_
_ProvisioningStatus__c,vlocity_cmt__RecurringCharge__c,vlocity_cmt__OneTime
Charge__c,ListPrice,vlocity_cmt__ParentItemId__c,vlocity_cmt__BillingAccoun
tId__r.Name,vlocity_cmt__ServiceAccountId__r.Name,vlocity_cmt__PremisesId__
r.Name,vlocity_cmt__InCartQuantityMap__c,vlocity_cmt__EffectiveQuantity__c,
vlocity_cmt__LineNumber__c,vlocity_cmt__ServiceAccountId__r.Type

The data source for this layout is of type Dual. This means the API query is performed using Apex
when running on a desktop computer, while a REST call is performed while running on a Mobile
device. To make your new columns available on both desktop and mobile versions of Vlocity Cart, add
the fields to the endpoint under the Mobile Hybrid ApexRest configuration section. Ensure the fields
are not already present:

© 2021 Vlocity LLC, a Salesforce


company 229
CME CPQ

4. Locate the appropriate card state to update.


Determine if your org is set up to use Loyalty by navigating to Vlocity CME Administration > Enable
Features > Loyalty.
• If Loyalty is enabled, update the card state named CustomView_CPQ_AdvancedPricingLoyalty.
• If Loyalty is not enabled, update the card state named CustomView_CPQAdvancedPricing.
5. Add the new column to the card state. Lookup fields are presented to cards using a different JSON
structure than regular fields. Due to this difference, you cannot rely on the same card state
configuration above to display this field in the Cart. This is because the out of the box templates for
rendering the columns examines the data type, such as string, input, currency, loyalty, and promo, to
determine how to display each value. When a data type of string is encountered, the template accepts
the data structure within the regular field.

© 2021 Vlocity LLC, a Salesforce


company 230
CME CPQ

To work around this limitation, add the lookup field within the card state.

© 2021 Vlocity LLC, a Salesforce


company 231
CME CPQ

6. Locate the card state named cart Item that uses a template named cpq-product-cart-item. This
template renders the top-level cart items. There a separate, similar template for rendering child-level
cart items that you will need to update later.
7. From the card state, click the template to open it.
8. Clone the template and ensure you keep the same template name, cpq-product-cart-item, but
change the Author.
9. Within the template's HTML section, scroll down until you find the following section:

<!-- Promotions -->


<div ng-if="customField.type === 'promo'">
<div ng-repeat="promoItem in obj[customField.fieldName].records"
ng-attr-title="{{promoItem.Name}}" class="cpq-promo-text-wrap"
ng-class="{'cpq-promo-name-strike':
importedScope.isPromoActionDisconnect(promoItem)}">
<span cpq-translate="Promotion.Name">{{promoItem.Name}}</span>
{{$last ? '' : ', '}}
</div>
</div>
10. Directly under this section, paste the following HTML so that the template can handle the new lookup
data type for the card state.

© 2021 Vlocity LLC, a Salesforce


company 232
CME CPQ

<!-- Lookups -->


<div ng-if="customField.type ===
'lookup'">{{obj[customField.fieldName]
[customField.name.substring(customField.name.lastIndexOf('[\'') + 2,
customField.name.lastIndexOf('\']'))]}}</div>
11. Activate the template cpq-product-cart-item.
After activating the Card and Layout, the resulting Cart page should look as follows:

If the new columns do not appear, try clearing your browser cache.
The Service Account Name is only displayed for the top-level items in the cart because child-level
items use a separate template. Therefore, you need to update child-level items as well.

To update child-level items:

1. Locate the active template named cpq-product-cart-item-child. Clone this template. Keep the name
as-is, but change the Author.
2. Within the template's HTML section, scroll down until you find the following section:

<!-- Promotions -->


<div ng-if="customField.type === 'promo'">
<div ng-repeat="promoItem in obj[customField.fieldName].records"
ng-attr-title="{{promoItem.Name}}" class="cpq-promo-text-wrap"
ng-class="{'cpq-promo-name-strike':
importedScope.isPromoActionDisconnect(promoItem)}">
<span cpq-translate="Promotion.Name">{{promoItem.Name}}</span>
{{$last ? '' : ', '}}
</div>
</div>
3. Directly under this section, paste the following HTML so the template can handle the new lookup data
type for the card state. This HTML is almost identical to the HTML for the top-level cart items but with
an important difference: It references an object of 'childProd' instead of 'obj'. Ensure you paste this
code into the correct template

<!-- Lookups -->


<div ng-if="customField.type ==='lookup'"{{childProd[customField.fieldName]

© 2021 Vlocity LLC, a Salesforce


company 233
CME CPQ

[customField.name.subst ring(customField.name.lastIndexOf('[\'') + 2,
customField.name.lastIndexOf('\']'))]}}</div>
4. Activate the cpq-product-cart-item-child template.
After activating the Card and Layout, the resulting Cart page should look as follows.

If the new columns do not appear, try clearing your browser cache.

Configure the Review Cart Using Custom Settings


Field sets are not available on the Order and OrderItem objects in Salesforce. To customize the Order
Manager columns, you must use custom settings.

To add fields to the Order Manager review cart using custom settings:

1. From Setup, in the Quick Find box, enter Custom Settings.


2. Click Custom Settings.
3. Next to Field Settings, click Manage.
4. Click New.
5. On the Field Settings Edit page, enter the following information:
• Name is a name for the field setting, in this case, Application.OrderItem.Quantity.
• Feature is the entity to which this setting applies, in this case, Application.
• Field Name is a name for the new field, in this case, Quantity.
• IsEditable indicates whether the end user can edit the field.
• Object Name is the object to which this field setting applies, in this case, OrderItem.
• Inclusion indicates whether the field setting is included.

© 2021 Vlocity LLC, a Salesforce


company 234
CME CPQ

6. Repeat steps 4 and 5 for each column.


7. Verify the changes in the Order Manager Review Cart.

The sequence in which you create the custom settings determines the sequence in which the columns
appear in the Review Cart.

NOTE
The Opportunity, Order, and Quote Managers are being deprecated in favor of the Vlocity
Cards-based user interface, also known as Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 235
CME CPQ

Customize the Summary Header for the Opportunity, Order, and Quote
Managers
You can configure the Opportunity, Order, and Quote Manager Visualforce components to include a
summary header. You can also customize the fields that appear in the summary header.

Figure 19. Example Summary Header

1. Enable the summary header.


For more information, see Enable the Summary Header Using Custom Settings or Enable the
Summary Header Using Field Sets.
2. Customize the summary header.
For more information, see Configure the Summary Header Using Custom Settings.

Enabling the Summary Header Using Custom Settings


You can use custom settings to enable the Summary Header for Order Manager, Opportunity Manager, and
Quote Manager. Once enabled, you can select an order and the Summary Header appears.

The steps in this exercise are for the Order Manager, but the same steps apply to the Opportunity and
Quote Managers.

To enable the summary header:

1. From Setup, click Develop and then click Custom Settings.


2. Next to the CPQ Configuration Setup setting, click Manage.
3. Click New.
4. Enter the appropriate values. The name must be in the format Feature.Object.ShowSummary. For
example, the name Application.Order.ShowSummary indicates that this setting enables the
summary header in the Order Manager in the Application User Interface.
5. In the Setup Value field, enter True.
6. Click Save.
7. Go to an Order and verify that the Summary Header appears.

© 2021 Vlocity LLC, a Salesforce


company 236
CME CPQ

NOTE
To disable the Summary Header, change the Setup Value to False or delete this record for
the custom setting.

Enable the Summary Header Using Field Sets


You can use field sets to enable the Summary Header for the Opportunity Manager and Quote Manager.
Once enabled, you can select an Opportunity and you can see the header with the fields that you added to
the field set.

The steps in this exercise are for the Opportunity Manager, but the same steps apply to the Quote
Manager.

1. Enable the summary header in the user interface. For more information, see Enable the Summary
Header Using Custom Settings.
2. From Setup, click Customize, and then click Opportunities, and then click Field Sets.
3. Click New.
4. Create a new field set by providing a name and label, for example, OpportunityConf.
5. Select any of the fields in the sequence in which to display them:

© 2021 Vlocity LLC, a Salesforce


company 237
CME CPQ

NOTE
You must select the fields in the sequence in which to display them. You cannot
rearrange the fields later.

6. Click Save.
7. From Setup, click Develop, and then click Custom Settings.
8. Next to FieldsConfiguration, click Manage.
9. Create a new record by clicking New.
10. Enter the values as shown in the screenshot.
This example uses a name in the format Feature.Object—for example, Application.Opportunity—
which tells us that this configuration is for an Opportunity object that the Application user interface
uses. However, the format for this name is not constrained. You can enter any unique name.
11. Select IsActive.
You can have many field sets for the same object and feature. The API uses the active field set.
12. Click Save.
13. Go to any Opportunity and you can see the header with the fields that you added to the field set.

For more information about header summary Visualforce page fields, see Header Summary, Mini-Cart, and
Review Cart Fields.

Configure the Summary Header Using Custom Settings


You can use custom settings to configure the summary header for the Opportunity Manager or Quote
Manager. You must use custom settings to configure the Order Manager summary header, because field
sets are not available on the Order object.

1. Enable the summary header. For more information, see Enable the Summary Header Using Custom
Settings or Enable the Summary Header Using Field Sets.
2. From Setup, click Develop, and then click Custom Settings.
3. Next to Field Settings, click Manage.
This is the custom setting that enables you to define fields to use for objects.
4. Click New.
5. Enter the values as shown in the screenshot.
This example uses a name in the format Feature.Object.FieldName —
Application.Order.AccountName—which will add Account Name as one of the fields to show for the
Order Summary, which the application user interface uses. However, the format for this name is not
constrained. You can enter any unique name.

© 2021 Vlocity LLC, a Salesforce


company 238
CME CPQ

6. Using these steps, configure all fields that you want on the layout.

NOTE
You cannot customize the sequence of these fields. The fields are displayed in the
sequence in which you insert them in the custom setting.

Header Summary, Mini-Cart, and Review Cart Fields


The Opportunity, Order, and Quote Visualforce pages, the Mini-Cart, and the Review Cart each contain
several fields by default.

Order Summary Visualforce Page Fields

Callout Field Name Description


Number
n/a Name The customer's name
1 Order Number The order number, from the OrderNumber object
2 Account Name The account name, from the Account.Name object
3 Shipping Address The shipping address, from the ShippingAddress object
4 Ship to Contact The name of the contact to which to ship the order, from the ShipToContact.Name object
Name
5 Email The email address, from the Email__c object
6 Phone The phone number, from the Phone__c object
7 Monthly Total The recurring monthly charge for the line items, from the
EffectiveRecurringTotal__c object, calculated by multiplying the line item's
RecurringCalculatedPrice__c by the EffectiveQuantity__c
8 One Time Total The one-time charge for the line items, from the EffectiveOneTimeTotal__c object,
calculated by multiplying the line item's OneTimeCalculatedPrice__c by the
EffectiveQuantity__c
9 Order Total The monthly total plus the one time total, from the EffectiveOrderTotal__c object

© 2021 Vlocity LLC, a Salesforce


company 239
CME CPQ

Quote Summary Visualforce Page Fields

Callout Field Name Description


Number
n/a Name The customer's name
1 Quote Number The quote number, from the QuoteNumber object
2 Account Name The account name, from the Account.Name object
3 Ship To The shipping address, from the ShippingAddress object
4 Ship to Name The name of the contact to which to ship the order, from the ShippingName object
5 Email The email address, from the Email__c object
6 Phone The phone number, from the Phone__c object
7 Monthly Total The recurring monthly charge for the line items, from the EffectiveRecurringTotal__c,
calculated by multiplying the line item's RecurringCalculatedPrice__c by the
EffectiveQuantity__c
8 One Time Total The one-time charge for the line items, from the EffectiveOneTimeTotal__c object,
calculated by multiplying the line item's OneTimeCalculatedPrice__c by the
EffectiveQuantity__c
9 Quote Total The monthly total plus the one time total, from the EffectiveQuoteTotal__c object

Opportunity Summary Visualforce Page Fields

Callout Field Name Description


Number
n/a Name The customer's name
1 Quote Number The quote number, from the QuoteNumber object
2 Account Name The account name, from the Account.Name object
3 Email The email address, from the Email__c object
4 Phone The phone number, from the Phone__c object
5 Monthly Total The recurring monthly charge for the line items, from the EffectiveRecurringTotal__c,
calculated by multiplying the line item's RecurringCalculatedPrice__c by the
EffectiveQuantity__c
6 One Time Total The one-time charge for the line items, from the EffectiveOneTimeTotal__c object,
calculated by multiplying the line item's OneTimeCalculatedPrice__c by the
EffectiveQuantity__c
7 Quote Total The monthly total plus the one time total, from the EffectiveQuoteTotal__c object

Default Fields in the Mini-Cart or Preview Cart

Callout Field Name Description


Number
1 Product The name of the product as defined in the price book, from the
PricebookEntry.Product2.Name object
2 Qty The quantity ordered, from the Quantity object
3 MRC The monthly recurring charge, from the RecurringTotal__c object, calculated by multiplying the
RecurringCalculatedPrice__c by the line item quantity
4 NRC The nonrecurring charge, also known as the one-time total, from the OneTimeTotal__c object,
calculated by multiplying the OneTimeCalculatedPrice__c by the line item quantity

© 2021 Vlocity LLC, a Salesforce


company 240
CME CPQ

NOTE
The fields in the Mini-Cart or Preview Cart cannot be customized.

Default Fields in the Review Cart

Callout Field Name Description


Number
1 Product Name The name of the product as defined in the price book, from the
PricebookEntry.Product2.Name object
2 Quantity The quantity ordered, from the Quantity object
3 One Time List From the OneTimeCharge__c object, retrieved from the UnitPrice field of the line item's
price book entry
4 One Time Discount The one-time discount price, from the OneTimeDiscountPrice__c object
5 One Time Total The one-time charge for the line items, from the OneTimeTotal__c object, calculated by
multiplying the OneTimeCalculatedPrice__c by the line item quantity
6 Monthly List The monthly recurring charge for the line items, from the RecurringCharge__c object,
retrieved from the RecurringPrice__c field of the line item's price book entry
7 Monthly Discount The monthly recurring discount for the line items, from the RecurringDiscountPrice__c
object
8 Monthly Total The recurring monthly total for the line items, from the RecurringTotal__c object,
calculated by multiplying the RecurringCalculatedPrice__c by the line item quantity
9 Provisioning Status The provisioning status, from the ProvisioningStatus__c object
10 Premises The premises, from the PremisesId__c object
11 Service Location The service location, from the ServiceAccountId__c object
12 Billing Account The account to bill, from the BillingAccountId__c object

Synchronizing a Quote with an Opportunity


All quotes must be associated with opportunities. When you create a quote from an opportunity, you can
change the quote. You can synchronize a quote with its opportunity so that all future updates to quote line
items and opportunity products are synchronized with one another.

Do not use the Salesforce Sync Quote button to sync a quote with an opportunity. Doing so will result in an
error such as the following:

Attempt to de-reference a null object

Vlocity recommends removing the standard Salesforce Sync Quote button to avoid confusion. For more
information, see Page Layouts in the Salesforce Help.

To sync a quote with an opportunity:

1. On the Quote record detail page, in the Quote Manager, click Review Cart.
2. Click Sync to Opportunity.

© 2021 Vlocity LLC, a Salesforce


company 241
CME CPQ

Creating an Order Using the Order Manager


The Order object represents an order for products or services associated with an account. Orders consist of
header information followed by line items of individually ordered products or services. Vlocity
Communications, Media, and Energy fully integrates opportunities, orders, and quotes to accommodate
asset-based ordering. For more information, see Asset-Based Ordering.

NOTE
The Opportunity, Order, and Quote Managers are deprecated. Use the Vlocity Cards-
based user interface, also known as Vlocity Cart.

The Salesforce Help contains several topics about orders, including the following:

• Orders
• Guidelines for Creating Orders
• Order Fields

You can create an order from a quote or create a new order on its own.

WARNING
Do not create an order by cloning a previous order. The Clone button in the Salesforce
Classic (Aloha) interface is not intended to work with Vlocity orders and can cause serious
errors.

To create an order from a quote:


1. Create an Opportunity.
2. Create a Quote.
3. In the Quote Manager, click Create Order.

© 2021 Vlocity LLC, a Salesforce


company 242
CME CPQ

To create a new order:

1. On the Orders tab, click New.


2. Enter the following information:
• Order Start Date is the date on which the order becomes effective.
• Status is the stage the order has reached.
• Account Name is a lookup to the account associated with the order.
For more information about other fields, see Order Fields in the Salesforce Help.

3. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 243
CME CPQ

4. On the Order record detail page, use the Order Manager to add products and services to the order.

• The Filter list provides a list of defined categories you can use to find specific products and services.
Expand any list heading and select the appropriate options.
• The Products list provides a list of products and services that correspond to the options you
selected in the Filter list. To add a product to the cart, click Add to Cart. To configure a product, click
Configure Product. See Configure a Product.
• The Preview list displays the products in the cart. To see the cart contents, click Review Cart. To
submit the order, click Submit Order. If compatibility rules require or recommend other products or
services, an error message appears in the preview.

When using asset-based ordering, the following fields must be populated on an order:

• Name
• AccountId
• Price
• Product2Id
• Quantity
• vlocity_cmt_LineNumber_c
• vlocity_cmt_OneTimeTotal_c
• vlocity_cmt_RecurringTotal_c
• vlocity_cmt_ProvisioningStatus_c

© 2021 Vlocity LLC, a Salesforce


company 244
CME CPQ

• vlocity_cmt_PricebookEntryId_c
• vlocity_cmt_ServiceAccountId_c
• vlocity_cmt_BillingAccountId_c

Configuring a Product
You can configure a product in the Opportunity Manager, Order Manager, Opportunity Manager, or review
cart. You configure a product that has already been added to the catalog. For more information about
setting up products, see Creating a New Product.

Figure 20. Configure Product, Simple Product

© 2021 Vlocity LLC, a Salesforce


company 245
CME CPQ

Figure 21. Configure Product, Product Bundle

To configure a product from the Opportunity Manager, Order Manager, or Quote Manager:

1. In the Opportunity Manager, Order Manager, or Quote Manager, find the product to configure.
2. Click Configure Product.
The Configure Product Visualforce page opens. The criteria you can configure depends on the product
you chose.
3. When you are finished configuring the product, click Add to Cart.

© 2021 Vlocity LLC, a Salesforce


company 246
CME CPQ

To configure a product from the preview:

1. In the Opportunity Manager, Order Manager, or Quote Manager, add the product to the cart.
2. In the Preview list, next to the product to configure, click the Configure Product icon, which
resembles a cog.

3. The Configure Product Visualforce page opens. The criteria you can configure depends on the product
you chose.
4. When you are finished configuring the product, click Save.

NOTE
The Opportunity, Order, and Quote Managers are being deprecated in favor of the Vlocity
Cards-based user interface, also known as Vlocity Cart.

NOTE
The Opportunity, Order, and Quote Managers are being deprecated in favor of the Vlocity
Cards-based user interface, also known as Vlocity Cart.

Overriding Default Functions


To override default JavaScript functions, the descendant class can override certain behavior in the ancestor
class by specifying the modified behavior in protected methods (similar to the object-oriented technique of
Java protected methods).

NOTE
For details about adding pre- and post-processing logic, see Adding Pre- and Post-
Processing Logic.

© 2021 Vlocity LLC, a Salesforce


company 247
CME CPQ

This mechanism enables customers to override a function of the default JavaScript controller. The function
must meet the following criteria:

• The function must be a scope function, that is, $scope.function.


• The function must be defined in the allowlist. Using an allowlist avoids abusive overrides of key
functionality.

You can override the following controllers:

Controller Functions
CPQPromotionItemController $scope.beforeAddToCartHook(payload)
$scope.afterAddToCartHook(payload)
CPQPromotionsController $scope.beforeDeletePromotionItemHook(payload)
scope.afterDeletePromotionItemHook(payload);
CPQCartItemController $scope.beforeAddToCartHook(payload)
$scope.afterAddToCartHook(payload);
$scope.beforeDeleteItemFromCartHook(payload)
$scope.afterDeleteItemFromCartHook(payload)

TIP
Using this approach to override functions decreases maintenance and the risk of missing
functionality in future releases. It also decreases maintenance needs.

To override a controller:

1. Create a new controller.


2. Go the Vlocity Template that contains the function to override.
3. On the HTML Code tab, enter the appropriate markup to initialize the custom controller. For example:
<div ng-controller="customOverrideController"></div>
4. On the JavaScript Code tab, enter the appropriate code to register the custom controller and override
the default function using CPQOverrideService.

Example 8. Sample Controller Override


vlocity.cardframework.registerModule.controller('customOverrideController',
['$scope', 'CPQOverrideService', function($scope, CPQOverrideService) {
#var overrideFunctions = {
'beforeAddToCartHook': function(parent, obj) {
alert('Hurray!');;
}
};

© 2021 Vlocity LLC, a Salesforce


company 248
CME CPQ

CPQOverrideService.addToOverrideList('CPQCartItemController',
overrideFunctions);
}]);

Adding Pre- and Post-Processing Logic


When adding or deleting products or promotions, you can define pre- and post-processing logic to be
executed before and after the cart is modified by defining a method containing the desired logic and
assigning it to the corresponding pre- or post-processing hook.

Example

$scope.beforeAddToCartHook = myBeforeAddToCartHookMethod(myHookPayload)
{...logic goes here...};

The following hooks are available.

CPQPromotionItemController:

• $scope.beforeAddToCartHook(payload);
• $scope.afterAddToCartHook(payload);

CPQPromotionsController:

• $scope.beforeDeletePromotionItemHook(payload);
• $scope.afterDeletePromotionItemHook(payload);

CPQProductItemController:

• $scope.beforeAddToCartHook(payload);
• $scope.afterAddToCartHook(payload);

CPQCartItemController:

• $scope.beforeAddToCartHook(payload);
• $scope.afterAddToCartHook(payload);
• $scope.beforeDeleteItemFromCartHook(payload);
• $scope.afterDeleteItemFromCartHook(payload);
• $scope.getAlternativePaymentFieldMapHook(data);

Creating an Opportunity
Opportunity represents a sale or pending deal. Order capture uses opportunities for business accounts.
Opportunities include details about the stage of an opportunity cycle—for example, in process or
completed. If an opportunity becomes a quote or an order, information from the opportunity moves forward.
Opportunities are identified by their stage, such as prospecting, identifying decision-makers, or negotiation/
review. Opportunities also include the projected success, in percentages. Order capture fully integrates
opportunities, quotes, and orders to accommodate asset-based ordering.

© 2021 Vlocity LLC, a Salesforce


company 249
CME CPQ

To create an opportunity:
1. On the Opportunities tab, click New.
2. Enter the following required information:
• Opportunity Name is a name for the opportunity.
• Account Name is a lookup to the account with which the opportunity is associated.
• Close Date is the date on which you plan to close the opportunity,
• Stage is the current stage of the opportunity.
See Opportunity Fields in the Salesforce Help.

3. Click Save.
4. On the Opportunity record detail page, use the Opportunity Manager to add products and services to
the opportunity.

© 2021 Vlocity LLC, a Salesforce


company 250
CME CPQ

• The Filter list provides a list of defined categories you can use to find specific products and services.
Expand any list heading and select the appropriate options.
• The Products list provides a list of products and services that correspond to the options you
selected in the Filter list. To add a product to the cart, click Add to Cart. To configure a product, click
Configure Product. For more information about configuring products, see Configure a Product.
• The Preview list displays the products in the cart. To see the cart contents, click Review Cart. To
create a quote based on the items in the cart, click Create Quote.

NOTE
If compatibility rules require or recommend other products or services, an error
message appears in the preview. See Compatibility Rules.

Cloning an Opportunity
You can create an opportunity to use as a template for other opportunities and clone it.

To create an opportunity template:


1. Create an opportunity.
2. On the Opportunity record detail page, click Clone.

© 2021 Vlocity LLC, a Salesforce


company 251
CME CPQ

3. Choose Clone with Products or Clone without Products.


4. On the Opportunity Edit page, enter the appropriate information.
For more information, see Opportunity Fields in the Salesforce Help.
5. Click Save.

See Also
See the following topics about opportunities in the Salesforce Help:

• Opportunities
• Guidelines for Creating Opportunities
• Opportunity Fields

Creating a Quote
The Quote object represents a quote, which is a record that includes proposed prices for products and
services. You can create quotes from and sync them with opportunities. You can email quotes as PDF files
to customers. Vlocity Communications, Media, and Energy captures additional information, such as
originating source or campaign, installation ZIP code, state, associated purchase order, and one-time or
recurring charges. Vlocity Communications, Media, and Energy integrates opportunities, orders, and quotes
to accommodate asset-based ordering.

See the following topics about quotes in the Salesforce Help:

• Quotes
• Quotes Fields

To set up a quote:

1. Create an opportunity.
2. In the Opportunity Manager, click Create Quote.

© 2021 Vlocity LLC, a Salesforce


company 252
CME CPQ

All quotes must be associated with opportunities. When you create a quote from an opportunity, you can
change the quote and sync a quote with its opportunity. For more information, see Synchronizing a Quote
with an Opportunity.

© 2021 Vlocity LLC, a Salesforce


company 253
CME CPQ

Pricing Definition

Vlocity enables you to price products and promotions according to your business requirements. You have
the flexibility to adjust prices, use loyalty points, or change prices over time.

Vlocity's pricing solution includes the following benefits:

• Reusability: A component-oriented system with reusable items that are independent from products
• Pricing types: Categories of pricing such as penalties, charges, and adjustments to existing charges
• Frequency: Settings that determine the frequency of the charge
• Updates: Transition from previous prices to updated prices for less expense and disruption

You can complete the following pricing tasks:

• Adjust or override a price without changing the base price.


• Offer customers the option of paying with loyalty points.
• Change the price of a product automatically over time.
• Customize the pricing process by adding steps, such as a step to accommodate tax calculation.

Pricing Components
In order to price a product, you must create price lists, pricing variables, and pricing elements. You can also
create time plans and time policies as needed.

The following pricing components are required:

• Price lists contain the price list entries and pricing elements.
• Pricing variables indicate the type of price.
• Pricing elements contain the amount.

The following pricing components may be required:

• Time plans limit the duration of the pricing.


• Time policies specify when the pricing begins and ends.

Price Lists
You can assign more than one base price to a product by creating price list entries stored in different price
lists. Each price list must be associated with a price book.

Price lists contain:

• The price list entries assigned to products


• The pricing element charges and adjustments available for creating price list entries
• Any context rules that apply to the price list

© 2021 Vlocity LLC, a Salesforce


company 254
CME CPQ

Using multiple price lists, you can assign more than one base price to a product by creating price list entries
stored in different price lists.

For example, you may want to separate customer pricing from wholesale and employee pricing by creating
price lists for each of these categories. You can apply context rules to determine which price list applies.

You can use one price list that contains more than one base price list entry for a single product.

Salesforce requires a price book. Every price list must be associated with a price book. Typically, only one
price book is required. You can associate multiple price lists to one price book.

For more information about price books, see Products Concepts in the Salesforce Help.

Create a Price List


The price list entry defines the product price. When a product has more than one base price list entry in a
price list, you can use a context rule to determine which price to apply to the product.

A child price list inherits all the pricing from its parent price list. You can include exceptions to the parent
price list in the child price list.

You can use multiple price lists. For example, you can separate wholesale pricing from retail pricing by
creating a wholesale price list and a retail price list. You can apply a context rule to a price list so that an
order for a wholesale account always uses the wholesale price list.

To create a price list:

1. Go to the Product Console. For more information, see Navigating to the Vlocity Product Console.
2. Next to Price List, click Create .
3. On the New Price List page, complete the General Properties section.
• Name is a name for the price list.
• Code is a unique code.
• Description is a description for the price list.
• In the Price Book field, search for and select the price book to associate with the price list.
• In the Parent Price List field, if this price list is a child price list, search for and select the parent
price list.
• Sequence specifies a sequence in the list of price lists.
• Currency Code is the currency code used in the price list.
• Loyalty Code is the indicator for loyalty points.
4. Complete the Effectivity section.
• To use the price list , select Is Active .
• Click the Effective From field and select a date the price list becomes effective and available for
use.
5. Click Save.

The following tables explain the fields to complete for a price list.

© 2021 Vlocity LLC, a Salesforce


company 255
CME CPQ

Table 3. General Properties Section


Field Description
Name The price list name.
Code A unique code that identifies the price list. As a best practice, use uppercase and no spaces, for example, PL-
B2B.
Description The description of the price list, for example, Commercial/Business price list.
Price Book The price book with which this price list is associated. You can associate multiple price lists with a single price
book.
Parent Price List The price list that acts as the parent to this price list. When you designate a parent price list, this price list
becomes a child of the parent price list. A child price list inherits all the pricing from its parent price list. You can
include exceptions to the parent price list in the child price list.
Sequence The sequence of the price list in the list of price lists.
Currency Code The currency code used for the price list.
Loyalty Code The loyalty indicator used for loyalty points, typically "PTS". For more information, see Using Loyalty Pricing

Table 4. Effectivity Section


Field Description
Is Active The status of the price list. If selected, you can use the price list.
Effective From The date and time the price list becomes available for use. When you choose the date, the system automatically
populates the time with the current time. If the price does not have a beginning effective date that is current, you
cannot use the price list.
Effective Until The date and time the price list is no longer available for use. When you choose the date, the system adds the
current time.

Effectivity Date Ranges for Price List Entries


The Effective From and Effective Until date and time are set in a price list entry for a charge, adjustment,
or override. These fields define a specific range of dates that the price list entry is available for use. If you
create multiple effectivity ranges, you can assign multiple base prices in the same price list to a product.

You can change the price of a product over time with multiple price list entries that have different, non-
overlapping effectivity date ranges. For example, to reduce the base price of a product by 10% each month,
you can create multiple base price list entries as shown in the following table.

Base Price Effectivity Date Range


$100.00 March 1–30
$90.00 April 1–30
$81.00 June 1–30

You can also use effectivity date ranges to reprice products. As shown in the following table, one product
has multiple base price list entries. When one price list entry expires, the next price list entry becomes
effective.

Base Price Effectivity Date Range


$44.99 Jan 1–Dec 31, 2019

© 2021 Vlocity LLC, a Salesforce


company 256
CME CPQ

Base Price Effectivity Date Range


$54.99 Jan 1–Dec 31, 2020
$62.99 Jan 1–Dec 31, 2021

If effectivity date ranges overlap, you can use context rules to determine which price list entry applies.

Although effectivity date ranges work with the product life cycle, neither is dependent on the other.

Pricing Elements
A pricing element consists of a pricing variable, an amount, and a payment type. Pricing elements can be
either charges or adjustments.

• Charges assign a base price or override a base price.


• Adjustments modify a base price by a percentage or an amount.

When you create a price list entry and you don’t see the price you need in the list of prices with their
currency and types, you must create a new pricing element.

NOTE
If you need to set up pricing elements for usage-based pricing for energy, see Enable
Usage Pricing. To enable usage-based pricing, you must complete a set of steps in a
specific order.

Create a Pricing Element Charge


With a pricing variable, use pricing element charges to assign a base price or to override a base price. You
can define the charge frequency, standard or penalty, price or cost, effectivity, and currency.

1. Go to the Product Console. For more information, see Navigating to the Vlocity Product Console.
2. Find and open the price list where you want to create the pricing element charge.
3. Click Standalone Pricing Elements.
4. Click New.
5. In the configuration panel in the Pricing Variable section, enter the search criteria to find the
appropriate pricing variable to associate with the pricing element charge.
• From the Charge Type picklist, select whether the amount is charged once or on a recurring basis.
• If you selected the recurring charge type, from the Frequency picklist, select the frequency of the
recurrence.
• From the Sub-Type picklist, select whether the charge is a standard charge or a penalty fee.
• From the Type picklist, select whether the charge is a price or a cost.
6. Click Search.
7. In the search results, select the pricing variable to assign to the pricing element. If you do not see the
pricing variable you want, you must create it. See Creating a Pricing Variable.

© 2021 Vlocity LLC, a Salesforce


company 257
CME CPQ

8. Complete the General Properties section.


• Name the pricing element. Make sure the pricing element name indicates as much information about
the price as possible, such as the currency, amount, and whether it is a one-time or recurring charge.
Additionally, if the charge is recurring, specify when it recurs. For example, a recurring monthly
charge of $9.99 could be named $9.99 RM or $9.99 Monthly.
• Enter a unique code. This code identifies the individual pricing element.
• Display Textis the payment type—currency or loyalty points—and the amount.
9. Complete the Currency Value.
• Charge is the amount.
• Currency Code is the currency.
10. Complete the Effectivity section.
• In the Effective From field, select the date the pricing element is available for use.
• Select Active to make the pricing element active and available for use.
11. Click Save.

The following tables explain the fields to complete for creating a pricing element charge.

Table 5. Pricing Variable Section


Field Description
Charge Type Searches for the pricing variables designating recurring or ongoing charges. The options are Recurring and One-
time.
Frequency Appears if you choose the recurring charge type. Select the frequency to find pricing variables that match the
frequency to associate with the pricing element. Indicates the frequency of the recurring charge. The options are
Daily, Weekly, Monthly, Yearly.
Type Finds pricing variables designating whether the charge is a price charged to the customer or a cost for the company.
The options are Price, Cost.

Table 6. General Properties Section


Field Description
Name Indicates the payment type—currency symbol or points, the amount, and whether the amount is charged once or
recurs. For example, for a one-time price of $10, the name could be $10 OT. For a recurring price, the name could be
$10 Monthly.
Code A unique code to identify the pricing element. Make sure there are no spaces or special characters. As a best
practice, use uppercase.
Display Text Enter the currency symbol or loyalty points and the amount, for example, $10 or 100 points. This is the text that
appears in the cart as the price.
Base Price Do not select base price when creating a pricing element charge.

Table 7. Currency Value Section


Field Description
Calculation Type Shows Calculation as the type.
Charge Enter the charge amount.
Currency Code Select the charge currency code.

© 2021 Vlocity LLC, a Salesforce


company 258
CME CPQ

Table 8. Effectivity Section


Field Description
Effective The date and time the pricing element becomes available for use. When you choose the date, the system
From automatically populates the time with the current time. If the pricing element does not have a beginning effective date
that is current, you will not be able to use it and it will not appear in the search results for pricing elements when you
create a price list entry.
Effective The date and time the pricing element is no longer available for use. When you choose the date, the system adds the
Until current time. If you choose an effective until date, the pricing element will not be available after that date.
Active The pricing element status. If Active is selected, the pricing element appears in the search results for pricing
elements when you create a price list entry.

Create a Pricing Element Adjustment


With a pricing element adjustment, you can adjust the base price of any product contained in a product
bundle or a promotion. You also use pricing element adjustments to manually adjust the price of a product
in the cart.

1. Go to the Product Console. For more information, see Navigating to the Vlocity Product Console.
2. Find and open the price list in which to create the pricing element charge.
3. Click Standalone Pricing Elements.
4. Click New.
5. In the Pricing Variable area, enter the search criteria to find the appropriate pricing variable to
associate with the pricing element adjustment.
• From the Charge Type picklist, select whether the adjustment is applied once or on a recurring
basis.
• If you have chosen the recurring charge type, from the Frequency picklist, select the frequency of
the recurrence.
• From the Sub-Type picklist, select whether the charge is a standard adjustment or a penalty fee.
• From the Type picklist, choose whether the adjustment is a price or a cost.
6. Click Search.
7. In the search results, click the pricing variable to assign to the pricing element adjustment. If you do not
see the pricing variable, you must create it. See Creating a Pricing Variable.
8. Complete the General Properties section.
• Name the pricing element adjustment. Make sure the pricing element name indicates as much
information about the adjustment as possible, such as the currency or percentage, amount, and how
often it recurs, if applicable.
• Enter a unique code. This code identifies the individual pricing element. Make sure there are no
spaces or special characters. Hyphens (-) and underscores (_) are allowed.
• In the Display Text field, enter the amount, currency, or percentage, and whether the adjustment is
a price increase or decrease.
9. Complete the Currency Value section.
a. The Calculation Type and Adjustment Method are pre-populated.
b. In the Adjustment field, enter the amount or percentage. If the adjustment is a price decrease,
enter the minus sign (-) before the amount or percentage.
10. Complete the Effectivity section.

© 2021 Vlocity LLC, a Salesforce


company 259
CME CPQ

• Click the Effective From field and select the date the pricing element is available for use.
• Select Active to make the pricing element active and available for use.
11. Click Save.

The following tables explain the fields to complete when creating a pricing element adjustment.

Table 9. Pricing Variable Section


Field Description
Charge Type Searches for the pricing variables designating recurring or ongoing charges. Options are Recurring, One-time.
Frequency Appears if you select the recurring charge type. It indicates the frequency of the recurring charge. Select the
frequency to find pricing variables that match the frequency to associate with the pricing element. Options include
Daily, Weekly, Monthly, Yearly.
Type Finds pricing variables designating whether the charge is a price charged to the customer or a cost for the company.
Options include Price, Cost.

Table 10. General Properties Section


Field Description
Name Indicates currency or percentage, the amount, whether the adjustment is an increase or decrease, and the
recurrence, if any. For example, 20% off monthly, $10 off, 5% increase monthly.
Code A unique code to identify the pricing element adjustment. For example, the code for an adjustment of 20% off monthly
could be named ADJ-20%-OFF-RM.
Display Text Appears when you click an adjusted price in the cart to view the explanation for the pricing change. Enter the amount,
currency or percentage, and whether the adjustment is a price increase or decrease. For example, 20% off
monthly, $10 off, 5% increase monthly.

Table 11. Currency Value Section


Field Description
Calculation Type Pre-populated
Adjustment Method Pre-populated with either percent or the currency, determined by the pricing variable you chose to use. See
Pricing Variables.

Table 12. Effectivity Section


Field Description
Effective The date and time the adjustment becomes available for use. When you choose the date, the system automatically
From populates the time with the current time. If the pricing element does not have a beginning effective date that is current,
you will not be able to use it and it will not appear in the search results for pricing elements when you are adjusting a
base price. See Adjusting the Base Price for a Product in a Bundle.
Effective The date and time the pricing element is no longer available for use. When you choose the date, the system adds the
Until current time. If you choose an effective until date, the pricing element is not available after that date.
Active The pricing element status. If Active is selected, the pricing element appears in the search results for pricing
elements when you are adjusting a base price. See Adjusting the Base Price for a Product in a Bundle.

Modify the Template that Enables Additional Decimal Places in Calculations


To enable multiple decimal places in usage-based pricing, you must change the cpq-base-grid template.
The changes applied to the grid template apply to all its child templates. Also, this template sets the correct

© 2021 Vlocity LLC, a Salesforce


company 260
CME CPQ

decimal separator based on the customer location and currency. It displays the appropriate decimal
separator when calculating the Monthly Recurring Charges (MRC) and Non-Recurring Charges (NRC).

places in usage-based pricing,

For calculating charges on products, typically, two decimal places are used in the calculations. However,
Vlocity Cart allows you to use additional decimal places for calculating one-time and recurring charges of
your products in usage-based pricing. This feature is useful in calculating the prices of products marked
with four decimal places.

For example, a customer wants to purchase 10 GB Internet data for which you apply charges based on per-
unit price. If the per-unit charge is .0020 Cents per MB, you can calculate the data charges accurately using
the additional decimal places.

To enable additional decimal places in calculations:

1. Clone the cpq-base-grid template.


See Clone the cpq-base-grid Template.
2. Clone the cpq-base-grid layout.
See Enable the cpq-base-grid-currency-filter Layout.
3. Enable the cpq-base-grid-currency-filter layout.
See Enable the cpq-base-grid-currency-filter Layout.

Clone the cpq-base-grid Template


To clone the cpq-base-grid template:

1. Log into Salesforce.


2. Go to the Vlocity App Launcher, search for Vlocity Templates and open it.
The Vlocity templates page opens.
3. Search for cpq-base-grid template and expand it.
4. Click on a version that you want to clone.
The cpq-base-grid template opens.
5. Click Clone.
The Clone Template dialog box is displayed.
6. Enter a name for the clone template, for example, cpq-base-grid-currency-filter.
7. Enter a name in the Author field.
8. Click Clone.
A confirmation message appears saying that the template is cloned successfully.
9. In the cloned template container, click the JS tab and copy and paste the following code:

// Override default currency filter to support 4-digits


vlocity.cardframework.registerModule.filter("currency", ['$rootScope',
'ISO_CURRENCY_INFO', function($rootScope, ISO_CURRENCY_INFO) {
// Filter defaults
const defaultCurrencyCode = 'EUR';
const defaultFraction = 2;

© 2021 Vlocity LLC, a Salesforce


company 261
CME CPQ

return function (input, currencyInfo) {


if (input === undefined || input === null || input === '') {
return '';}
let fraction = defaultFraction;
if (String(input).includes('.')) {
const fractionStr = String(input).split('.').pop();
// when the fraction is more then 2 digits and those digits are not 0s
then display these digits in the UI//
otherwise display as a normal currency (2 digits)
if (fractionStr.length > 2 && fractionStr.substr(2) !== '00') {
fraction = 4;
}
}
const isoCurrencyCode = (currencyInfo && currencyInfo.expression) ||
($rootScope.vlocity && $rootScope.vlocity.userCurrency) ||
defaultCurrencyCode;
const currencySymbol = (currencyInfo && currencyInfo.isSymbol &&
currencyInfo.expression) || ISO_CURRENCY_INFO[isoCurrencyCode].text;
const currencyDecimal = ISO_CURRENCY_INFO[isoCurrencyCode].decimal ?
ISO_CURRENCY_INFO[isoCurrencyCode].decimal : '.';
const currencyGroup = ISO_CURRENCY_INFO[isoCurrencyCode].group ?
ISO_CURRENCY_INFO[isoCurrencyCode].group : ','
const [number, decimalFraction] =
parseFloat(input).toFixed(fraction).split('.');
return currencySymbol + ' ' +
number.replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' +
currencyGroup) +
currencyDecimal + decimalFraction;
};
}]);
10. Click Save.
The cloned template now has the four-digit currency calculation information.

Clone the cpq-base-grid Layout


To clone the cpq-base-grid-layout:

1. On the Vlocity App Launcher, search for Vlocity Cards and open it.
The Vlocity Layouts & Cards page opens.
2. Search for cpq-base-grid and click on the arrow to expand it.
3. Click on a cpq-base-grid layout version.
The cpq-base-grid layout page opens.
4. Click Clone.
The Clone Layout dialog box is displayed.
a. Enter a name in the Layout Name field, for example, cpq-base-grid currency filter.
b. Select Layout in the Layout Type field.

© 2021 Vlocity LLC, a Salesforce


company 262
CME CPQ

c. Enter a name in the Layout Author field.


d. Click Save.
5. In the Template field, select the template that you cloned in the previous procedure, for example, cpq-
base-grid-currency-filter.
See Clone the cpq-base-grid Layout.
6. Save the layout.
To enable additional decimal places in calculations, you must specify the layout name that you cloned
in the Visualforce HybridCPQ page.

Enable the cpq-base-grid-currency-filter Layout


To enable the cpq-base-grid-currency layout in the Visualforce HybridCPQ page:

1. Go to Setup.
2. In the Quick Find box, enter Visualforce.
3. Click Visualforce Pages in the search results.
4. Find the HybridCPQ page. To narrow down your search, click on the alphabet 'H'.

5. Click HybridCPQ.
The Visualforce HybridCPQ page opens.
6. To update the layout name, replace cpq-base-grid with the layout name you cloned for the currency
filter, for example, cpq-base-grid-currency-filter.

© 2021 Vlocity LLC, a Salesforce


company 263
CME CPQ

7. Click Save.

Price Details Link for Custom Fields


For new custom fields to have the Price Details link (which allows users to either view price details or
change prices using manual adjustments), you must add a CpqAppHandlerHook implementation class.

The following sample code shows how to inject the fields and priceDetailsFields parameters in the
postCartsItems, postCartsPromoItems, putCartsItems, applyAdjustment, and
deleteAdjustment CpqAppHandler remote action methods. If you have used field names other than
RecurringCharge2 and OneTimeCharge2, you need to adjust the code accordingly. The following
image shows the Price Details link.

The following sample code shows how to inject the fields and priceDetailsFields parameters in the
postCartsItems, postCartsPromoItems, putCartsItems, applyAdjustment, and
deleteAdjustment CpqAppHandler remote action methods.

global with sharing class CpqAppHandlerHookImplementation implements


vlocity_cmt.VlocityOpenInterface {

private static Set<String> itemFields = new Set<String> {


'vlocity_cmt__BillingAccountId__c',
'vlocity_cmt__ServiceAccountId__c',
'Quantity',

© 2021 Vlocity LLC, a Salesforce


company 264
CME CPQ

'vlocity_cmt__RecurringTotal__c',
'vlocity_cmt__OneTimeTotal__c',
'vlocity_cmt__OneTimeManualDiscount__c',
'vlocity_cmt__RecurringManualDiscount__c',
'vlocity_cmt__ProvisioningStatus__c',
'vlocity_cmt__RecurringCharge__c',
'vlocity_cmt__OneTimeCharge__c',
'ListPrice',
'vlocity_cmt__ParentItemId__c',
'vlocity_cmt__PremisesId__c',
'vlocity_cmt__InCartQuantityMap__c',
'vlocity_cmt__EffectiveQuantity__c',
'RecurringCharge2__c',
'OneTimeCharge2__c'
};

private static Set<String> priceDetailFields = new Set<String> {


'vlocity_cmt__OneTimeCharge__c',
'vlocity_cmt__OneTimeCalculatedPrice__c',
'vlocity_cmt__OneTimeTotal__c',
'vlocity_cmt__RecurringCharge__c',
'vlocity_cmt__RecurringCalculatedPrice__c',
'vlocity_cmt__RecurringTotal__c',
'RecurringCharge2__c',
'OneTimeCharge2__c'
};

global Boolean invokeMethod(String methodName, Map<String, Object> input,


Map<String, Object> output, Map<String, Object> options) {
try {
if (methodName.equalsIgnoreCase('postCartsItems.PreInvoke') ||
methodName.equalsIgnoreCase('postCartsPromoItems.PreInvoke') ||
methodName.equalsIgnoreCase('applyAdjustment.PreInvoke') ||
methodName.equalsIgnoreCase('deleteAdjustment.PreInvoke') ||
methodName.equalsIgnoreCase('putCartsItems.PreInvoke')) {
String cartIdStr = (String) input.get('cartId');
if (String.isNotBlank(cartIdStr)) {
if (!input.containsKey('fields') || !
input.containsKey('priceDetailsFields')) {
Set<String> itemFieldsResult = new Set<String> ();
Set<String> priceDetailsFieldsResult = new Set<String> ();
getItemFieldsForParams(cartIdStr, itemFieldsResult,
priceDetailsFieldsResult);

if (!input.containsKey('fields') && !itemFieldsResult.isEmpty()) {


input.put('fields', String.join(new List<String> (itemFieldsResult),

© 2021 Vlocity LLC, a Salesforce


company 265
CME CPQ

','));
}
if (!input.containsKey('priceDetailsFields') && !
priceDetailsFieldsResult.isEmpty()) {
input.put('priceDetailsFields', String.join(new List<String>
(priceDetailsFieldsResult), ','));
}
}
}
}

return true;
} catch (Exception ex) {
System.debug('--- Exception: ' + ex.getMessage());
System.debug('--- Stack Trace: ' + ex.getStackTraceString());
throw ex;
}
}

private void getItemFieldsForParams(String cartIdStr, Set<String>


itemFieldsResult, Set<String> priceDetailsFieldsResult) {
Id cartId = Id.valueOf(cartIdStr);
String cartObjectName = cartId.getSObjectType().getDescribe().getName();
Schema.SObjectType cartItemSObjectType;
if (cartObjectName == 'Quote') {
cartItemSObjectType = QuoteLineItem.sObjectType;
} else if (cartObjectName == 'Order') {
cartItemSObjectType = OrderItem.sObjectType;
} else if (cartObjectName == 'Opportunity') {
cartItemSObjectType = OpportunityLineItem.sObjectType;
}
if (cartItemSObjectType != null) {
Set<String> fieldMapKeys =
cartItemSObjectType.getDescribe().fields.getMap().keySet();
for (String fld: itemFields) {
if (fieldMapKeys.contains(fld.toLowerCase())) {
if (fld == 'vlocity_cmt__BillingAccountId__c')
itemFieldsResult.add('vlocity_cmt__BillingAccountId__r.Name');
else if (fld == 'vlocity_cmt__ServiceAccountId__c')
itemFieldsResult.add('vlocity_cmt__ServiceAccountId__r.Name');
else if (fld == 'vlocity_cmt__PremisesId__c')
itemFieldsResult.add('vlocity_cmt__PremisesId__r.Name');
itemFieldsResult.add(fld);
} else {
System.debug(fld + ' not found in ' +
cartItemSObjectType.getDescribe().getName());

© 2021 Vlocity LLC, a Salesforce


company 266
CME CPQ

}
}

for (String fld: priceDetailFields) {


if (fieldMapKeys.contains(fld.toLowerCase())) {
priceDetailsFieldsResult.add(fld);
} else {
System.debug(fld + ' not found in ' +
cartItemSObjectType.getDescribe().getName());
}
}
}
}
}

To create the CpqAppHandlerHook interface:

1. Go to Apex Classes, and click New.


2. Paste in the sample Apex code above, or create your own version.
3. Go to the Interface Implementations tab and click New.
4. Create a new Interface with the following values:
• Interface Name: CpqAppHandlerHookActive
• Implementation Class: CpqAppHandlerHookImplementation
5. Click Save.
6. In Salesforce Classic, click New Interface Implementation Detail.
In Lightning Experience, click New in the Interface Implementation Detail related list.
7. On the New Interface Implementation Detail page, enter the following information:
• Available Implementation: CpqAppHandlerHookImplementation
• Interface Name: CpqAppHandlerHookActiveCheckedDefaultChecked
8. Click Save.

Pricing Variables
Pricing variables contain metadata that defines the pricing type. When you create a price list entry, you
choose a pricing variable to be part of the price.

Pricing variables include several price settings:

• The pricing is a regular charge or a penalty fee.


• The charge frequency occurs once or on an ongoing basis, such as monthly.
• The price is charged to the customer or to the company as a cost.
• The payment type is currency or loyalty points.

In addition to the built-in pricing variables, you can create custom pricing variables.

© 2021 Vlocity LLC, a Salesforce


company 267
CME CPQ

NOTE
If the default pricing variables are not enabled in your environment, a System Administrator
can enable them by running the EPC Create Default Pricing Variables and Bindings job
in Vlocity CMT Administration. For more information, see Understanding Vlocity EPC
Jobs.

If you need to set up pricing elements for usage-based pricing, see Enable Usage Pricing.
To enable usage-based pricing, you must complete a set of steps in a specific order.

Some pricing variables are linked with pricing elements. When you create a pricing element, you choose
the pricing variable that indicates the price type. See Creating a Pricing Element Charge.

You can bind pricing variables to a field for price calculation. For more information, see Pricing Variable
Bindings.

You can apply one pricing variable to another. For example, the pricing variable to adjust a one-time
standard price applies to the pricing variable One Time Std Price, as shown in the last field of the following
image:

© 2021 Vlocity LLC, a Salesforce


company 268
CME CPQ

When you create a pricing element adjustment, you choose the pricing variable adjustment to use. For
more information, see Creating a Pricing Element Adjustment.

Create a Pricing Variable


When you create a price list entry, you choose a pricing variable to be part of the price. Create a pricing
variable and define the charge type, currency, frequency, and other settings.

1. Go to the Product Console. For more information, see Navigating to the Vlocity Product Console.
2. Next to Pricing Variable, click Create .
3. On the New Pricing Variable page, complete the General Properties section.

© 2021 Vlocity LLC, a Salesforce


company 269
CME CPQ

• Nameis the pricing variable name.


• Code is a unique code.
• Description explains the pricing variable's function.
• Select Active to begin using the pricing variable.
4. Complete the Basic Variable Type section.
• From the Charge Type picklist, select whether the price is a charge, an adjustment, or usage.
• From the Currency Type picklist, select the payment type.
• From the Sub-Type picklist, select whether the price is standard or a penalty fee.
• From the Frequency picklist, if you selected the recurring charge type, select the frequency of the
recurrence.
• From the Type picklist, select price or cost.
• From the Adjustment Method picklist, if you chose the adjustment charge type, select whether the
adjustment is an absolute amount or a percentage.
5. Complete the Detailed Type Info section.
• From the Value Type picklist, select whether the pricing variable is used in a calculation or with a
pricing element.
• From the Scope picklist, if you selected the calculation value type, select whether the pricing
variable is calculated on a line item or in the rollup.
• From the Aggregation picklist, if you selected calculation as the value type, select unit or quantity.
• From the Applies to Variable picklist, if this pricing variable applies to another pricing variable,
select the appropriate pricing variable.
6. Click Save.

The following tables explain the fields to complete when creating a pricing variable.

Table 13. General Properties Section


Field Description
Name The pricing variable name. Be descriptive enough that the name indicates aspects of the pricing variable's functionality.
For example, Recurring Monthly Std Price Total indicates monthly recurrence, a standard price, and that this
variable is used for a total.
Code The unique code that identifies this pricing variable. As a best practice, use uppercase and no spaces, for example
REC_MNT_STD_PRC_TOTAL.
Description Enter a description of the pricing variable's functionality and use.
Active To use the pricing variable, select Active.

Table 14. Basic Variable Type Section


Field Description
Charge Type Options include:

• Recurring: A recurring charge


• One-Time: A one-time charge
• Usage: A usage charge
• Adjustment: An adjustment to a charge

© 2021 Vlocity LLC, a Salesforce


company 270
CME CPQ

Field Description
Currency Type The payment type. Options include

• Currency
• Loyalty Points.
Sub-Type Options include:

• Standard: Standard price


• Fee: A penalty fee
Frequency How frequently the charge recurs. Use these options if you selected the recurring charge type. Options include:

• Daily
• Weekly
• Monthly
• Yearly
Type Options include:

• Price: Charged to the customer


• Cost: Charged to the company
Adjustment If you selected the charge type adjustment, select one of the following options:
Method
• Absolute: The adjustment to the price is an absolute amount that is added to or subtracted from the price.
• Percentage: The adjustment to the price is a percentage of the price that is added to or subtracted from the
price.

Table 15. Detailed Type Info Section


Field Description
Value Type Options include:

• Calculated: Select this option if the pricing variable is used in a calculation, for example, to calculate a line
item.
• Pricing Element: Select this option if the pricing variable is associated with a pricing element used in creating
a price list entry.
Scope If you selected the calculated value type, select one of the following options:

• Line Item: The pricing variable will be used in calculating a line item, including a line item total.
• Rollup: The pricing variable is used in calculating a rollup total.
Aggregation If you chose the calculated value type, select one of the following options:

• Unit: Select this option if the calculation is used for a line item.
• Quantity: Select this option if the calculation is used for a rollup or a line item total.
Applies to If you chose the adjustment charge type, select the pricing variable to which this pricing variable applies. For
Variable example, if you are creating a pricing variable to adjust a yearly recurring standard price, apply it to the pricing
variable created for yearly recurring standard price.

See Also

• Pricing Variables

© 2021 Vlocity LLC, a Salesforce


company 271
CME CPQ

Pricing Variable Bindings


The pricing variable binding binds the pricing variable to a field on the line item of the order, quote, or
contract, or to the asset.

For example, the following image of the pricing variable One Time Std Price shows a list of its pricing
variable bindings.

Not all pricing variables require binding to an object. The need for binding depends on the pricing variable's
function.

Create a Time Plan for a Product's Price


A time plan defines the length of time that pricing applies to a product. Time plans apply to adjustments and
overrides for products in bundles or promotions.

For example, a 2-year subscription to cellular service has a 24-month time plan. Settings for a time plan
include the total duration of time and the unit of measure for the duration of time, such as monthly or yearly.

You can assign a time plan to:

• An adjustment to the base price of a product in a bundle.


• An adjustment to the base price of a product within a promotion.
• An override of the base price of a product in a bundle.
• An override of the base price of a product within a promotion.
• A base price. However, base prices do not typically have time plans or time policies assigned.

To create a time plan to use when creating a price list entry for a product:

1. Go to the Product Console. For more information, see Navigating to the Vlocity Product Console.
2. Next to Time Plan, click Create .
3. Click Standalone Pricing Elements.
4. Complete the General Properties section.
• In the Name field, enter a name for the time plan and include the duration.
• In the Description field, enter a description for the time plan.

© 2021 Vlocity LLC, a Salesforce


company 272
CME CPQ

• In the Total Duration field, enter the number.


• In the Total Duration UoM field, enter the unit of measure for the number you entered in the Total
Duration field.
5. Complete the Effectivity section.
• Click the Effective From field and select a date the time plan is available for use.
• Select Active to make the time plan active and available for use.
6. Click Save.

The following tables explain the fields to complete when creating a time plan.

Table 16. General Properties Section


Field Description
Name The time plan name. Indicate the plan duration and the units of measure for the duration.

For example, a 2-year time plan could be named TP-24M.


Description A description for the plan, such as 2-year time plan or 24-month time plan.
Total Duration A number for the duration period.
Total Duration UoM The duration type for the number you entered in the Total Duration field. Options include:

• Day
• Week
• Month
• Year
• Quarter

Table 17. Effectivity Section


Field Description
Effective The date and time the time plan becomes available for use. When you choose the date, the system automatically
From populates the time with the current time. If the time plan does not have a beginning effective date that is current, you
will not be able to use it and it will not appear when you create a price list entry or an adjustment or override.
Effective The date and time the time plan is no longer available for use. When you choose the date, the system adds the
Until current time. If you choose an Effective Until date, the time plan will not be available for use after that date.
Active The time plan status. If you select Active, the time plan is available for use when you create a price list entry or an
adjustment or override.

Create a Time Policy for a Product's Price


A time policy indicates when the pricing starts and stops being applied. You can set a time policy for a base
price, adjustment, or override.

For example, you can determine that the pricing starts at the beginning of the month or cycle, or when the
product is purchased. In the same way, you can set the pricing to end the last day of the month or at the
end of the cycle.

For the dates to be correctly calculated, a time policy must have a corresponding time plan.

You can assign a time policy to the following components:

© 2021 Vlocity LLC, a Salesforce


company 273
CME CPQ

• Base price
• An adjustment to a recurring base price in a product bundle or promotion
• An override of a recurring base price in a product bundle or promotion

To create a time policy to use when creating a price list entry for a product:

1. Navigate to the Product Console.


2. Next to Time Policy, click Create .
3. Complete the General Properties section.
• In the Name field, enter a name for the time policy and include when the policy starts and ends.
• In the Description field, enter a description for the time plan.
4. Complete the Time Policy section.
5. Complete the Effectivity section.
• Click the Effective From field and select a date the time policy is available for use.
• Select Active to make the time policy active and available for use.
6. Click Save.

The following tables explain the fields to complete when creating a time policy.

Table 18. General Properties Section


Field Description
Name The time policy name. Indicate when the time policy starts and ends, for example, TPOL-ACTSTART-ENDPLAN.
Description A description for the policy, such as Activation to end of plan

Table 19. Time Policy Section


Field Description
Start Determines the method used to calculate the start date for the record
Policy
Options include:

• Purchase Date: Typically, the date on which the customer submits payment and signs the agreement
• Cycle Start Date: The same as Purchase Date. This can be overridden.
• First Day of Month: First day of the month
• Activation Start: Reserved for future use
End Determines the method used to calculate the end date for the record
Policy
Options include:

• End of Plan Duration: The end date equals the start date plus the duration defined in the time plan.
• Cycle End Date: The same as End of Plan Duration. This can be overridden.
• Set by Order Management: Reserved for future use.
• Last Day of Month: The end date equals the start date, plus the duration defined in the time plan, plus any additional
days required to move the result to the end of the corresponding month.
For example, if the start date is March 15 and the duration is six months, the policy ends on September 30.

© 2021 Vlocity LLC, a Salesforce


company 274
CME CPQ

Table 20. Effectivity Section


Field Description
Effective The date and time the time policy becomes available for use. When you choose the date, the system automatically
From populates the time with the current time. If the time policy does not have a beginning effective date that is current,
you will not be able to use it and it will not appear when you create a price list entry or an adjustment or override.
Effective The date and time the time policy is no longer available for use. When you choose the date, the system adds the
Until current time. If you specify an Effective Until date, the time policy is not available for use after that date.
Active The time policy status. If you select Active, the time policy is available when you create a price list entry, an
adjustment, or an override.

Product Pricing
Pricing of products includes creating pricing list entries and assigning prices. You use pricing components
to define the price aspects and then assign them to the product.

When you create a price list entry for a product, you answer questions about the:

• Which price list will store the price list entry?


• Is this a price or a cost?
• How often should the price be applied?
• How much is the price?
• Is this a charge or an adjustment?
• Is this a standard price or a penalty fee?

For a product to appear in the cart's Products list, it must have:

• An assigned price
• An active status
• An orderable status

Create a Price List Entry


Create price list entries from a price list or a product. Use price list entries to assign a price to any product
or product bundle, or to combine the pricing variable with the appropriate pricing element to form the
product's price.

To create a price list entry from the price list:

1. Go to the Product Console. See Navigating to the Vlocity Product Console.


2. Search for and open the price list. For more information on finding a price list, see Price Lists.
3. Click Price List Entries.
4. Click New.
5. In the General Properties area:
a. Search for and open the product.
b. In Display Text, enter the type of payment—currency or loyalty points—and the amount.
c. If the price is a base price, select Base Price. See Assigning a Base Price.
6. Continue to Finishing a Price List Entry.

© 2021 Vlocity LLC, a Salesforce


company 275
CME CPQ

To create a price list entry from the product:

1. Go to the Product Console.


2. Search for and select the product for the price list entry.
3. Click Pricing.
4. Click New.
5. In the General Properties area:
a. Find and select the product to price.
b. In Display Text, enter the type of payment—currency or loyalty points—and the amount.
c. If the price is a base price, select Base Price. For more information about base price, see
Assigning a Base Price.
6. Continue to Finishing a Price List Entry.

Finishing a Price List Entry


To finish creating a price list entry:

1. In the Pricing Variable section, complete the search criteria and click Search. A results list of
available pricing variables appears.
2. In the pricing variable results list, click the appropriate pricing variable. A results list of available pricing
elements appears.
3. In the results list in the Pricing Element section, click the appropriate pricing element.
4. In the Time Plan/Policy section, choose the appropriate time plan and time policy, if applicable.
5. Complete the Effectivity section.
a. In the Effective From field, select a date the price becomes effective.
b. To use the price list entry, select Active to make the price status active.
6. Click Save.

The following tables explain the fields to complete for a price list entry.

Table 21. General Properties Section


Field Description
Price List This is the price list in which to store the price list entry. This option appears if you began creating the price list entry
from the product. For more information about price lists, see Price Lists.
Product The product to price. This option appears if you began creating the price list entry from the price list.
Display Text This text appears along with the name of the product in the Products in the cart. Enter the type of payment—currency
or loyalty points—and the charge amount. For more information about display text, see Display Text for Pricing.
Base Price If you select Base Price, the price becomes the product default price or list price. For more information about base
price, see Assigning a Base Price.
Virtual Price If checked, replaces the parent product’s price with the total price of all the child products.

Table 22. Time Plan/Policy Section


Field Description
Time Plan The time plan that indicates the pricing duration, where appropriate.

© 2021 Vlocity LLC, a Salesforce


company 276
CME CPQ

Field Description
Time Policy The time policy that indicates when the pricing starts and ends, where appropriate.

Table 23. Effectivity Section


Field Description
Effective The date and time the price for the product becomes available for use. When you choose the date, the system
From automatically populates the time with the current time. If the price does not have a current beginning effective date,
you cannot use the price list entry. For more information on effectivity, see Effectivity Date Ranges for Price List
Entries.
Effective Until The date and time the price for the product is no longer available for use. When you choose the date, the system
adds the current time.
Active The status of the price list entry. If Active is selected, the price list entry appears in the cart with the product.

Multiple Price List Entries


You can build pricing changes using multiple price list entries that are assigned to a single product with
different effectivity dates.

Product pricing models can be designed to change over time, rising or falling as dictated by business or
marketing plans.

In this example, there are four price list entries on the B2C Price List, which will enable the price to fall
according to the schedule specified by the product marketing plan.

© 2021 Vlocity LLC, a Salesforce


company 277
CME CPQ

If there is a gap in between the effectivity dates of your price list entries, the product will not display in the
product list of Vlocity Cart during that time period.

In Vlocity Cart, pricing is always applied as of the current date.

Price Assignment
Before you can view a product or promotion in the Product or Promotion lists of Vlocity Cart, you must
assign it with a price. To assign a price, you create a price list entry in a price list. The price list entry
combines a pricing variable with the appropriate pricing element to form the price.

When you view the product in the product list in Vlocity Cart, the product list displays the price list entry that
is flagged as the base price. Then, when the product is added to the cart, the pricing service will select the
"tightest match" price list entry and apply it to the line item. The price that is applied could be:

• The currently effective price list entry


• A price list entry that has a context rule that apply to the price list entry. If context rules apply to the price
list entry, the context-rules altered price will be different than the base price in the Products list in the cart.
• Is from a specific child price list used as a result of a context rule. If the context rules apply to the price
list, the base price shown is not different than the base price in the Products list in the cart.

If a product does not have a price list entry marked as a base price, the product's price appears as zero in
the product list in Vlocity Cart. However, after you add the product to the cart, the assigned price appears
either in the Recurring Charge column or the One Time Charge column. As a best practice, always assign
at least one base price to each product.

Multiple Prices
You can assign more than one price to a product by:

© 2021 Vlocity LLC, a Salesforce


company 278
CME CPQ

• Creating a price in one price list and another price in another price list.
• Creating more than one price in the same price list, and assigning each price an effectivity date range
that does not overlap with any other price list entry date ranges. For more information, see Multiple Price
List Entries.

Status and Expiration of a Price


To use a price list entry, you must ensure:

• The status is Active.


• The Effective From date is not in the future.
• The Effective Until date is not in the past.

Best Practices for Price Display Text


Display text for pricing is required and explains the base price, the adjustment or override to the base price,
and the price of a bundle when there are optional products in the bundle. You'll want to follow our
recommendations for creating display text.

Pricing Information to Include Where Text Appears


Base Price • The payment type—the currency symbol or an indication of loyalty points In the Products list in
• The amount the cart
• The recurrence of the charge, if applicable

Examples: $9.99, $9.99 Monthly, 1500 loyalty points


Adjustment or • Detailed description of adjustment or override In the cart when final
Override Price • What bundle or promotion the adjustment or override is associated with price is clicked
• Any limit to the duration of the adjustment or override

Examples: 20% off monthly for six months with the Mobile Plan bundle or $5 off
with the Mobile Plan bundle
Bundle Price • The currency symbol In the Products list in
• The amount the cart
• If the bundle contains products that are optional for purchase, wording that
includes "minimum" or "starting price"

Examples: $9.99 starting price or $9.99 minimum

Pricing Strategies for Product Bundles


A product bundle has one or more child products. To price bundles, you can set a price for the parent
product or roll up the prices of the child products. You can also apply overrides and adjustments to child
products when they are part of a bundle.

The overall bundle pricing can be accomplished in different ways:

• The parent product has a price other than zero. The parent product price is added to the child product
price.
For example, the parent product of the bundle can be priced at $49.99. It is combined with the child
products to make up the total price.

© 2021 Vlocity LLC, a Salesforce


company 279
CME CPQ

• The parent product has a price of zero. The final bundle price is the total of the price of the child
products.

When bundles contain optional products, the display text may show the total price if all the products are
purchased. However, unless all products are added to the cart, the price in the Products list in the cart won’t
match what you see in the cart. You can change the display text to indicate a range or a starting price for
these types of bundles.

To change the price of a child product in a bundle without changing the base price, you use:

• Adjustments: Percentages or amounts that reduce or increase the base price


• Overrides: Amounts that replace the base price

Adjustments use the base price to calculate the new price. Overrides do not use any calculations.
Overrides simply replace the base price.

When you create an adjustment or an override to the product base price, you create a price list entry that is
stored in the same price list as the base price. As a result, the system will display a message to remind you
there are multiple price list entries in the price list for this product.

When you create product adjustments and overrides for child products, you do so in the bundle's Product
Structure facet.

Price Adjustments and Overrides


You can adjust or override a product’s price without changing the price itself. You can manually adjust or
override a price in the cart, and you can make adjustments using product bundles, promotions, or
adjustment records.

Pricing Adjustments Using Product Bundles


When designing product bundles, you can add products to the bundle and then change their prices when
they appear in that context. When you create an adjustment, you can adjust the price by a percentage or by
an amount. Adjustments use the base price to calculate the final product price. For more information, see
Adjusting the Base Price for a Product in a Bundle.

Overriding the base price doesn't require the base price for calculation, it simply replaces the base price.
The base price, however, remains unchanged. For more information, see Overriding the Base Price for a
Product in a Bundle.

Pricing Adjustments Using Promotions


You can apply a promotion to a product in the cart. This is done at runtime using Vlocity Cart. For more
information, see Using Promotions.

Adjustment Records
For any order, quote, opportunity, or asset, you can review adjustments or overrides made to each line
item's price in Order Pricing, Quote Pricing, Opportunity Pricing , and Account Pricing records. The
adjustments that are recorded could be the result of an applied promotion, a manual adjustment made by

© 2021 Vlocity LLC, a Salesforce


company 280
CME CPQ

an agent, or an adjustment or override made in the context of a product bundle. Possible sources of
adjustment records are described below.

Source Description
Agent An adjustment record created when a user applied a manual pricing adjustment in Vlocity Cart
Offer An adjustment record created from an adjustment or override applied in the context of a product bundle
Promotion An adjustment record created from an applied promotion

By default, adjustment records do not record base prices. If you need to record base prices for reporting or
downstream system requirements, you can optionally enable it using Pricing Plans starting in the Fall '18
release. For more information, see Base Pricing Adjustments.

Adjust the Base Price for a Product in a Bundle


When you create an adjustment to a base price, Vlocity calculates the adjustment amount or percentage
against the base price. Adjustments can be positive or negative, meaning you can use an adjustment to
raise a price or to lower a price. The adjustment you create is also a price list entry. A product must be
contained in a product bundle before you can adjust its price.

You can configure the timing of an adjustment:

• A time plan to limit the duration of the adjustment


• A time policy to determine when the adjustment begins and ends.

To create an adjustment to the base price of a product:

1. Go to the Product Console. See Navigating to the Vlocity Product Console.


2. Search for and open the product bundle.
3. Click Product Structure.
4. Expand the parent product to view the child products.
5. Click the child product row.
6. In the configuration panel, click the Product Pricing tab, then click the Adjustments tab.
7. Click New.
8. In the Price List Entry dialog box, complete the General Properties section:
• Find and select the price list where this price list entry should be stored. The adjustment must be in
the same price list as the base price.
• In the Display Text field, enter a description of the adjustment you are making, including any
duration limits, for example, 20% off monthly for six months.
9. In the Pricing Variable section, complete the search criteria and click Search. A results list of
available pricing variables appears.

© 2021 Vlocity LLC, a Salesforce


company 281
CME CPQ

10. In the pricing variable results list, click the appropriate pricing variable. A results list of available pricing
elements appears. You can choose to adjust the price by a percentage or an amount. For more
information, see Creating a Pricing Element Adjustment.
11. In the results list in the Pricing Element section, click the appropriate pricing element.
12. In the Time Plan/Policy section, choose the appropriate time plan and time policy if applicable.
13. Complete the Effectivity section.
• Click the Effective From field and select the date the adjustment becomes effective for use.
• Select Active to make the price adjustment available for use.
14. Click Save.

The following tables explain the fields to complete when creating an adjustment price list entry.

Table 24. General Properties Section


Field Description
Price List The price list that stores the price list entry. The adjustment must be stored in the same price list as the base price.
For more information, see Price Lists.
Display Text This text appears when the product has been placed in the cart and you click the Price Details button.

As a best practice, clearly describe the adjustment and any duration limit on it.
Base Price Do not select Base Price.
Virtual Price If checked, the parent product’s final price with the total price of all the child products.

Table 25. Time Plan/Policy Section


Field Description
Time Plan Choose the time plan when applicable. For more information, see Create a Time Plan for a Product's Price .
Time Policy Choose the time policy when applicable. For more information, see Create a Time Policy for a Product's Price .

Table 26. Effectivity Section


Field Description
Effective The date and time the adjustment becomes available for use. When you choose the date, the system automatically
From populates the time with the current time. If the price does not have a current beginning effective date, you will not be
able to use the adjustment and no adjustment will appear in the cart. For more information, see Effectivity Date
Ranges for Price List Entries.
Effective The date and time the adjustment for the product is no longer available for use. When you choose the date, the
Until system adds the current time.
Active The adjustment price list entry status. If Active is selected, the adjustment to the base price appears in the cart.
Otherwise, no adjustment appears.

Override the Base Price for a Product in a Bundle


When you create an override to a base price of a product in a bundle, Vlocity replaces the base price with
the override price. No calculation with the base price is necessary. The override you create is also price list
entry. Overrides use the same pricing element charges that base prices use.

You can assign a time plan to limit the override duration and a time policy to determine when the override
begins and ends. A product must be contained in a product bundle before you can override its base price.

© 2021 Vlocity LLC, a Salesforce


company 282
CME CPQ

To create an override to a product's base price:

1. Go to the Product Console.


2. Search for and open the product bundle.
3. Click Product Structure.
4. Expand the parent product to view the child products.
5. Click the child product row.
6. In the configuration panel, click the Product Pricing tab, then click the Adjustments tab.
7. Click New.
8. In the Price List Entry dialog box, complete the General Properties section:
• Find and select the price list to store this price list entry. The override must be in the same price list
as the base price.
• In the Display Text field, enter a description of the override you are creating, including any duration
limits. For example, $5.99 monthly for six months.
9. In the Pricing Variable section, complete the search criteria and click Search. A results list of
available pricing variables appears.
10. In the pricing variable results list, click the appropriate pricing variable. A results list of available pricing
elements appears.
11. In the results list in the Pricing Element section, click the appropriate pricing element. If you do not
see the price, you must create a new pricing element charge. For more information, see Creating a
Pricing Element Charge.
12. In the Time Plan/Policy section, select the appropriate time plan and time policy, if applicable.
13. Complete the Effectivity section.
• Click the Effective From field and select a date the adjustment becomes effective for use.
• Select Active to make the price adjustment available for use.
14. Click Save.

The following tables explain the fields to complete for an adjustment price list entry.

Table 27. General Properties Section


Field Description
Price List The price list in which to store the price list entry. The override must be stored in the same price list as the base price.
For more information, see Price Lists.
Display Text This text appears when the product has been placed in the cart and you click the Price Details button.

As a best practice, clearly describe the adjustment and any duration limit on it.
Base Price Do not select Base Price.
Virtual Price If checked, the parent product’s final price with the total price of all the child products.

Table 28. Time Plan/Policy Section


Field Description
Time Plan Choose the time plan, where appropriate.
Time Policy Choose the time policy, where appropriate.

© 2021 Vlocity LLC, a Salesforce


company 283
CME CPQ

Table 29. Effectivity Section


Field Description
Effective The date and time the override becomes available for use. When you choose the date, the system automatically
From populates the time with the current time. If the price does not have a current beginning effective date, you will not be
able to use the adjustment and no adjustment appears in the cart. For more information, see Effectivity Date Ranges
for Price List Entries.
Effective The date and time the override for the product is no longer available for use. When you choose the date, the system
Until adds the current time.
Active The override price list entry status. If Active is selected, the override of the base price appears in the cart.
Otherwise, no override appears.

Manual Price Changes in the Cart


You can manually change any price in the cart that appears in the Recurring Charge column or the One
Time Charge column by adjusting it with a percentage or amount, or by overriding the price.

This includes any price that has already been changed as a result of a promotion.

When you discount a recurring charge, you can also assign a time plan to limit the discount duration, or a
time policy to determine how the discount begins and ends.

You can also delete any manual changes you have made to prices in the cart. For more information, see
Delete Manual Adjustments and Overrides in the Cart.

NOTE
You cannot make manual changes to prices appearing in the Recurring Total or One Time
Total columns.

Manually Adjust a Price in the Cart


You can apply adjustments to both one-time and recurring pricing. Vlocity calculates an adjustment you
want to make against a base price to determine the final price.

One-Time Price Adjustment


To adjust a one-time price in the cart:

1. In the cart, click the price you want to change.


2. Click the Change Price button.
3. In the Adjustment dialog box, in the ADJUSTMENT VALUE tab, select Percentage or Amount.
4. In the next entry box, enter the adjustment percentage or amount. To discount the price, enter a minus
sign. For example, for 50% off, enter "-50". For $20 off, enter "-20".
5. Click Apply.

© 2021 Vlocity LLC, a Salesforce


company 284
CME CPQ

6. If the dialog box does not immediately close, click Close.


7. To view the explanation for the manual change, click the price.
8. Click the Price Details button. The Details dialog box displays the base price, the adjustment, and the
final price.
9. Click Close to close the Details dialog box.

NOTE
If you create an order, add a product to the cart, or change an asset to an order, and
then you apply a manual adjustment to the line item, the dropdown adjustment will
appear when you refresh the page.

Recurring Price Adjustment


To adjust a recurring price in the cart:

1. In the cart, click the price you want to change.


2. Click the Change Price button.
3. In the Adjustment dialog box, in the ADJUSTMENT VALUE tab, select Percentage or Amount.
4. In the next entry box, enter the adjustment percentage or amount. To discount the price, enter a minus
sign. For example, for 50% off, enter "-50". For $20 off, enter "-20".
5. (Optional) To limit the duration of the change in price, in Adjustment Duration, select the appropriate
time plan.
6. (Optional) To determine when the adjustment begins and ends, in Adjustment Policy, select the
appropriate time policy.
7. Click Apply.
8. If the dialog box does not immediately close, click Close.
9. To view the explanation for the manual change, click the price.
10. Click the Price Details button. The Details dialog box displays the base price, the adjustment, and the
final price.
11. Click Close to close the Details dialog box.

NOTE
If you create an order, add a product to the cart or change asset to order, and apply a
manual adjustment to the line item, the dropdown adjustment will appear when you
refresh the page.

Context Rules for Pricing Adjustments


You can create context rules to control the conditions in which a user can apply a pricing adjustment. For
more information, see Qualification Rules for Pricing Adjustments.

© 2021 Vlocity LLC, a Salesforce


company 285
CME CPQ

Override a Price in the Cart


You can override both one-time and recurring prices. Vlocity does not use the base price to calculate the
override. The price override replaces the price you are changing.

One-Time Price Adjustment


To override a one-time price in the cart:

1. In the cart, click the price you want to change.


2. Click the Change Price button.
3. In the Adjustment dialog box, in the ADJUSTMENT VALUE tab, select Override.
4. In the next entry box, enter the override amount.
5. Click Apply.
6. If the dialog box does not immediately close, click Close.
7. To view the explanation for the manual change, click the price.
8. Click the Price Details button. The Details dialog box displays the base price, the adjustment, and the
final price.
9. Click Close to close the Details dialog box.

Recurring Price Adjustment


To adjust a recurring price in the cart:

1. In the cart, click the price you want to change.


2. Click the Change Price button.
3. In the Adjustment dialog box, in the ADJUSTMENT VALUE tab, select Override.
4. In the next entry box, enter the override amount.
5. (Optional) To limit the duration of the override, in Adjustment Duration, select the appropriate time
plan.
6. (Optional) To determine when the override begins and ends, in Adjustment Policy, select the
appropriate time policy.
7. Click Apply.
8. If the dialog box does not immediately close, click Close.
9. To view the explanation for the manual change, click the price.
10. Click the Price Details button. The Details dialog box displays the base price, the override, and the
final price.
11. Click Close to close the Details dialog box.

Delete Manual Adjustments and Overrides in the Cart


You can delete any manual adjustment to or override of a price in the cart. You cannot delete an adjustment
or override made to a price as a result of a context rule or a promotion.

To delete any manual adjustment to or override of a price in the cart:

1. In the cart, click the price that has been adjusted or overridden.

© 2021 Vlocity LLC, a Salesforce


company 286
CME CPQ

2. Click Price Details .


3. In the Details dialog box, click the X next to the adjustment or override.
4. When the system removes the adjustment or override, click Close to close the Details dialog box.

Enable Usage Pricing


Before you start using the Multi-Site Quote and Order Capture feature, you must enable usage pricing.

To enable usage pricing:

1. Log in to Salesforce and go to the App Launcher.


2. Enter Vlocity CMT Administration Console in the quick find search.
The Vlocity CMT Administration Console is displayed.
3. From the Custom Settings section, select Enable Features.
4. Navigate to the Usage Pricing feature and toggle the switch to enable it.
You will see a confirmation message.
5. Click Enable.
You will see a confirmation message indicating that the feature is enabled.
6. Click OK.

After you enable the usage pricing feature, the following options are available in Vlocity Cart.

NOTE
If you do not enable the Cost and Margin feature, Usage Pricing is only available in
the drop-down menu of Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 287
CME CPQ

Table 30. Usage Pricing Fields Available in Vlocity Cart


Vlocity Cart Tab Available Columns with Available Columns with Usage
Usage Pricing Enabled Pricing and Cost and Margin
Enabled
When you enable the usage pricing feature and the Usage Pricing Usage Pricing + Cost and Margin
cost and margin feature, you will see Usage Pricing +
Cost and Margin in the drop-down menu in Vlocity
Cart.
New columns for each line item in the Cart are • Usage Unit of Measure • Usage Margin
available when you enable Usage Pricing. These are • Usage Price • Usage Price
calculated based on the usage pricing variables you • Usage Price Total • Usage Price Total
defined. • Usage Unit of Measure
New columns in the Total Bar are available when you • Group Usage Total • Group Usage Total
enable Usage Pricing. These are calculated based on • Group Recurring Total • Usage Margin Total
the usage pricing variables you defined. • Group One Time Total • Group Recurring Total
• Recurring Margin Total
• Group One Time Total
• One Time Margin Total
• Group Margin Total

Configure Usage Pricing


Follow this workflow to enable usage pricing and configure the pricing element for charges and costs.

1. Enable usage pricing. See Enable Usage Pricing.


2. Create a pricing element for charges and costs. You must also enable Costs and Margins to create a
pricing element for costs. See Create a Pricing Element for Usage Pricing Charges.
3. Apply the usage pricing element to a product. See Create a Pricing Element for Usage Pricing
Charges.
4. View Vlocity Cards related to usage pricing. See Vlocity Cards for Usage Pricing.

Set Up Dynamic Usage Quantity


You can source the estimated usage quantity of a service at a service point from various custom fields. A
calculation matrix identifies the custom field based on different criteria. You can configure the system to
calculate usage pricing for a service based on the usage quantity recorded in the custom field identified in
the calculation matrix.

For example, you can record the average quarterly usage of electricity at a service point in one custom field
and the average annual usage of electricity in another custom field. You can then set up a calculation
matrix to specify which custom field should be used to source the usage quantity in usage pricing
calculations at runtime.

To set up a dynamic sourcing of usage quantity at a service point:

1. Create a calculation matrix. See Create a Calculation Matrix.


2. Create a calculation procedure. See Create a Calculation Procedure.
3. Select the calculation procedure in the CPQ Configuration set up. See Configure CPQ Configuration
Setup for Usage Quantity.

© 2021 Vlocity LLC, a Salesforce


company 288
CME CPQ

Create a Calculation Matrix


You can set usage quantity for every line item of the service quotes under a group using the calculation
matrix. The Output field picks the service point usage data.

To create a calculation matrix:

1. Log in to Salesforce.
2. On the App Launcher, search for Vlocity Calculation Matrices, and open it.
The Vlocity Calculation Matrices page opens.
3. Click New.
The New Vlocity Calculation Matrix dialog box is displayed.
4. In the Calculation Matrix Name field, enter a name for the calculation matrix, for
example, DynamicUsageQuantityMatrix.
5. Click Save.
6. On the Vlocity Calculation Matrix page, click the Related tab.
7. Click View all and select the calculation matrix version for which you want to create the matrix data.
The Details tab is displayed.
8. In the Table section, click Add Header. Enter the following details:

a. Name: Enter a name for the column header, for example, Average Monthly Consumption.
b. Header type: Defines the column mapping. Select Input if the column obtains data for the
calculation. Select Output if the column returns data from the calculation. You must name the
output column ServiceFieldAPIName for it to work.
c. Data Type: Select a data type, for example, Number.
d. Matrix Display Order: Specify a number, for example, 2. It defines the sequence in which the
column is displayed.

© 2021 Vlocity LLC, a Salesforce


company 289
CME CPQ

e. Click Save Data. Add more Header columns as required.

f. Click Edit Data and enter appropriate data in the matrix. See the following image for example
data.

© 2021 Vlocity LLC, a Salesforce


company 290
CME CPQ

g. Click Save Data.

Create a Calculation Procedure


To create a calculation procedure:

1. From the App Launcher, search for Vlocity Calculation Procedures, and open it.
The Vlocity Calculation Procedures page opens.
2. Click New.
The New Vlocity Calculation Procedure dialog box is displayed.
3. Select the Declarative record type and click Next.
The New Vlocity Calculation Procedure: Declarative dialog box is displayed.
4. Enter a name for the calculation procedure, for example, Usage Quantity Pricing Procedure.
5. Click Save.
6. On the Vlocity Calculation Procedure page, click the Related tab.
7. Click View all and select the calculation procedure that you created.
8. (Optional) Click and expand the Preprocessor Class Name section.
9. (Optional) In the Enter your pre-processor Apex class name below box, enter a pre-processor Apex
class name, for example, UsageConfigPreProcessor.
10. Click and expand the Calculation Steps section.
a. Click Add Step.
b. Select Matrix Lookup.
c. Enter the name of the calculation matrix you created, for example,
DynamicUsageQuantityMatrix.
d. Select Include in Calculation Output on the right.

11. Go to the Calculation Setup section. Click the pencil icon and select Enabled.

© 2021 Vlocity LLC, a Salesforce


company 291
CME CPQ

12. Click Save.

Configure CPQ Configuration Setup for Usage Quantity


To configure CPQ configuration setup for usage quantity:

1. From the App Launcher, search for Vlocity CMT Administration, and open it.
2. Click CPQ Configuration Setup under Custom Settings.
The CPQ Configuration Setup page opens.
3. Scroll to the end of the page and click Add.
4. In the Name column, enter UsageQuantityCalculationProcedureName.
5. In the Setup Value column, enter the name of the calculation procedure you created in the previous
task, for example, Usage Quantity Calculation Procedure.

6. Click Save.

Create a Pricing Element for Usage Pricing Charges


You can create a pricing element for usage pricing charges and apply it to a product.

To create a pricing element for usage pricing charges:

1. Log in to Salesforce.
2. From the App Launcher, search for Vlocity Product Console and open it.
3. Search for the Price List for which you want to configure usage pricing and open it, for example, B2B.
The price list is displayed.
4. Click the Pricing Elements facet on the left.
The Charges tab displays the pricing elements that are defined for the price list.

© 2021 Vlocity LLC, a Salesforce


company 292
CME CPQ

5. Click New.
The Pricing Variable section opens on the right.
6. In the Charge Type field, select Usage from the drop-down list.
7. Click Search.
8. Select a pricing variable, for example, Usage Std Price.

NOTE
The Usage pricing variable option is no longer available starting with the Winter '20
release. Use the Usage Std Price option instead.

9. Enter the required information.

Table 31. Pricing Variable for Usage Pricing Charge


Required Fields Description
Name Enter a name for the usage pricing charge, for example, $0.13/kWh.
Code Enter a code for the usage pricing charge, for example, U-0.13.
Display Text Enter a display text, for example, $0.13kWh.
Help Text Enter a brief help text, for example, Usage pricing charge.
Usage Unit of Measure Search and find the unit of measure that applies to your business, for example, kWh.
Amount Enter the amount for the charge, for example, $0.13.
Effective From Enter the date from which this pricing is effective.
Active Select the checkbox to activate the usage pricing charge.
10. Click Save.
The usage pricing charge is added to the Pricing Elements list of the selected price list. To create
usage pricing for costs, select the Costs tab, and follow steps 1 through 10. After you configure the
pricing element for charges and costs, you can use it in price list entries.

Apply Pricing Elements to a Product


To apply pricing elements to a product or price list entry:

1. Log in to Salesforce.
2. From the App Launcher, search for Vlocity Product Console and open it.
3. Search for the product to which you want to apply the pricing element and open it.
The Product General Properties page is displayed.
4. Click the Pricing facet on the left.
5. Click New on the Charges tab.
6. Enter the required information.

Table 32. Required Fields


Required Fields Description
Price List Search for and select a price list for which you configured the usage pricing, for example, B2B.

© 2021 Vlocity LLC, a Salesforce


company 293
CME CPQ

Required Fields Description


Display Text Enter the display text for example, $0.13/kWh.
Charge Type Select a charge type pricing variable, for example, Usage. Click Search and select Usage Std Price.
Pricing Element Select the pricing element you created for the usage pricing charge, for example, $0.13/kWh.
Effective From Enter the date from which this pricing is effective.
Active Select the checkbox to activate the Price List Entry for the product.
7. Click Save.

Update Usage Quantity of a Product Using an Attribute


The usage quantity attribute with the attribute binding configured on it enables you to update the usage
quantity of a Vlocity Cart line item at runtime. Updating the usage quantity of a line item helps to reprice and
calculate the usage total price of a product. The default usage price is always set to zero until you update
the usage quantity in Vlocity Cart.

Follow the workflow below to create an attribute binding and to update the usage quantity of a product in
Vlocity Cart:

1. Creating an Attribute Category.


2. Creating an Attribute.
3. Creating a New Vlocity Object.
4. Creating an Attribute Binding.
5. Applying Attribute Binding to a Product.
6. Updating Usage Quantity in Vlocity Cart.

Create an Attribute Category


To create an attribute category:

1. Log in to Salesforce.
2. From the App Launcher, search for Vlocity Attribute Category and open it.
3. Click New.
The Vlocity Attribute Category page opens.
4. Enter the required information.

Table 33. Required Fields for Attribute Categories


Field Description
Name Enter a name for the attribute category, for example, Usage.
Code Enter code, for example, ACAT_USAGE.
Display Sequence Enter the sequence in which you want the attribute category to appear, for example, 2. The value you
enter here should be a unique value across all attribute categories.
Applicable Types Select Product2 from the Available list and move it to the Chosen list.
Applicable Sub-Type Select Product Attribute from the list.
5. Click Save.
An attribute category called Usage is created.

© 2021 Vlocity LLC, a Salesforce


company 294
CME CPQ

Create an Attribute

1. Go to Vlocity Product Console, in the Foundation panel, click the plus icon next to Attribute.
The New attribute page opens.
2. Enter the required information.
For field information, see Create Attributes.

Table 34. Attributes


Field Description
Name Enter a name for the attribute, for example, Usage Quantity.
Code Enter a code, for example, ATT_USAGE_QTY.
Active Select the Checkbox.
Attribute Category Select an attribute category to which you want to link the attribute, for example, Usage.
Value Type Select a value type from the list, for example, Number.
Display Sequence Enter a sequence number in which the attribute should appear within the attribute category, for example, 2.
Filterable Select the checkbox.
3. Click Save.
4. Click the Applicable Objects facet on the left.
5. Notice that the Product2 Object checkbox is selected.
6. Click Save.
A new attribute, Usage Quantity is created.

Create a new Vlocity Object


You can use the OrderItem Vlocity object and one of its fields, for example, Usage Quantity, for attribute
binding. If there is no OrderItem object in your system, follow the steps to create a new OrderItem object,
and assign a field for attribute binding.

To create a new Vlocity Object:

1. Go to the app Launcher, search for Vlocity Objects and Object Types and open it.
2. Click New.
The New Vlocity Object or Object Type dialog box is displayed.
3. Select Object in the Select Record Type option.
4. Click Next.
5. Enter the required information:

Table 35. New Object


Field Description
Name Enter a name for the new object, for example, Order Item Binding.
Object API Name Enter a name for the Object API, for example, OrderItem.
Mode Select Record Type.
Record Type Name Enter OrderItem.
Active Select the checkbox.

© 2021 Vlocity LLC, a Salesforce


company 295
CME CPQ

6. Click Save.
A new Vlocity Object, Order Item Binding is created.

Create an Attribute Binding


The Attribute Binding binds an attribute to the usage quantity field so that when you change the attribute's
value, you change the field's value as well. This enables you to update the usage quantity of a Vlocity Cart
line item which in turn updates the usage pricing of the product.

1. From the app Launcher, search, and open Vlocity Attribute Categories.
2. Click on the attribute for which you want to create attribute binding, for example, Usage Quantity.
3. Click the Related tab.
4. Click New.
The New Vlocity Attribute Binding dialog box is displayed.
5. Enter the required information.

Table 36. Attribute Bindings


Field Description
Attribute Enter the name of the attribute binding, for example, Usage Quantity Binding.
Binding Name
Vlocity Search for and select the attribute that you want to use for attribute binding, for example, Usage Quantity.
Attribute
Object Class Search for and select the object type that is associated with the field name to which you want to bind the item,
for example, OrderItem.
Field Name Enter the field name, vlocity_cmt__UsageQuantity__c. This field exists as part of the Vlocity managed
package. You can also create a new field and assign it for attribute binding. This is the field where the usage
quantity is updated at runtime.
6. Click Save.
An attribute binding is created for updating the usage quantity at runtime.

© 2021 Vlocity LLC, a Salesforce


company 296
CME CPQ

After you set this up, any product using Usage Pricing will need this attribute assigned to it. This allows
for forecasted quantities to be used in usage totals.

Apply an Attribute Binding to a Product


To apply attribute binding to a product:

1. From the App Launcher, search for Vlocity Product Console and open it.
2. Search for the product to which you want to assign an attribute that has an attribute binding configured
on it.
3. Click the Attributes and Fields facet.
4. Click Assign Attributes/Fields.
5. Select the attribute you created, for example, Usage Quantity.
6. Click Assign.
The attribute binding is associated with the product.

Update Usage Quantity in Vlocity Cart


You can update the usage quantity using the attribute field on the Vlocity Cart line item. This procedure
applies to Opportunities, Orders, and Quotes.

1. From the App Launcher, search for Orders and open it.
The Orders page opens.
2. Click on an order and open it.
3. Click Configure Order.
Vlocity Cart opens.
4. Select a product from the product list that has attribute binding configured on it.
5. Click Add to Cart.
6. On the cart line item, click Configure.
7. Update the usage quantity as required.
Vlocity Cart calculates the Usage Price Total of the line item using the updated usage quantity and the
unit usage price.

Create a Usage Standard Cost for a Product


You can create a usage standard cost and apply the usage cost to a product.

To create a usage standard cost for a product:

1. Create a pricing element for the usage standard cost.


2. Apply the usage standard cost to a product.

Create a Pricing Element for Usage Standard Cost


To create a pricing element for the usage cost:

1. Log in to Salesforce.

© 2021 Vlocity LLC, a Salesforce


company 297
CME CPQ

2. From the App Launcher, search for Vlocity Product Console and open it.
3. Search for the price list for which you want to create usage standard cost and open it.
The price list is displayed.
4. Click Pricing Elements on the left.
5. Click on the Costs tab.
The pricing elements defined for the price list are displayed.
6. Click New. The Pricing Variable section is displayed on the right.
7. On the Charge Type field, select Usage from the dropdown list.

8. Click Search and select a pricing variable.


9. Select Usage Std Cost.
10. Enter the required information:

Table 37. Pricing Variable for Usage Standard Cost


Required Fields Description
General Properties
Name Enter a price, for example, 0.423.
Code Enter a code, for example, 0.423.
Display Text Enter a display text, for example, 0.423.
Currency Value
Usage Unit of Measure Select a unit of measure from the lookup dialog box, for example, kWh.
Amount Enter the amount, for example, 0.423.
Currency Code Select a currency code. USD is selected by default.
Effectivity
Effectivity From Select an effectivity date.
Active Select the checkbox.
11. Click Save.
12. Refresh the page for the new pricing element to display on the Costs tab. The new usage cost is
displayed with its unit of measure, for example, 0.423 kWh.

© 2021 Vlocity LLC, a Salesforce


company 298
CME CPQ

Apply the Usage Standard Cost to a Product


To apply the usage standard cost to a product:

1. From the App Launcher, search for Vlocity Product Console and open it.
2. Search for the product to which you want to apply the usage standard cost and open it.
3. Click Pricing on the left.
4. Click on the Costs tab.
5. Click New.
The Price List Entry section is displayed on the right.
6. On the Price List field, select the price list for which you configured the usage standard cost.
7. Enter a display text, for example, 0.423.
8. On the Charge Type field, select Usage from the dropdown list.
9. Click Search and select a pricing variable, for example, Usage Std Cost.
10. Select a pricing element, for example, 0.423.

11. Select the Active checkbox.


12. Click Save.
You have added a usage cost to the selected product.

Vlocity Cards for Usage Pricing


When you enable usage pricing, card states and new fields are available for the standard Vlocity Cart cards
and layouts.

• In Vlocity Cart, you will see the UsagePricing + Cost and Margin view in the drop-down menu. New
usage price and usage totals are available in the header for line items and total bar.
• Vlocity Cart displays usage pricing related fields on total bars using the 'multiservice-cpq-group-total-bar'
layout and the 'multiservice-cpq-group-total-bar' card.

© 2021 Vlocity LLC, a Salesforce


company 299
CME CPQ

Table 38. New Vlocity Cards for Usage Pricing


Layout Name Card Name States Column Field Names in Vlocity Cart
multiservice-cpq-group- multiservice-cpq-group- Usage Pricing (Quote) • Group Usage Total
total-bar total-bar • Group Recurring Total
• Group One Time Total
multiservice-cpq-group- multiservice-cpq-group- Usage Pricing + • Group Usage Total
total-bar total-bar CostandMargin (Quote) • Usage Margin Total
• Group Recurring Total
• Recurring Margin Total
• Group One Time Total
• One Time Margin Total
• Group Margin Total

Final Price Calculation


When you add a product to the cart, the validation and pricing engine begins a set of processes to validate
and finalize the product's price.

The validation and pricing engine checks for:

• All price list entries that apply to the product and their effectivity date ranges. For more information about
effectivity date ranges, see Effectivity Date Ranges for Price List Entries.
• Any pricing changes from promotions.
• Any pricing changes due to manual changes in the cart. For more information about changing a price
manually in the cart, see Manually Changing Pricing in the Cart.
• Any context rules that apply to the product's price.

When the customer's account is eligible for more than one product price because of context rules, the
system chooses one of the following based on the implementation being used:

© 2021 Vlocity LLC, a Salesforce


company 300
CME CPQ

• The best matching price list entry for the product


• The first matching price list entry for the product

As you add more products to the cart, Vlocity performs validation in one of the following ways:

• Recalculate the prices of all products in the cart.


• Recalculate only the prices of products that have been added to the cart and the prices that have
changed, such as manual changes by the agent.

For more information about settings for recalculation, see Price and Validate Changed Items Only.

Pricing Variable Calculation Hook


The pricing variable calculation hook allows you to add custom pricing variable calculations, or to override
the out-of-the-box calculations.

Example 9. Example of adding custom pricing variables


You could add a custom pricing variable called One Time Tax Percent with a code of OT_TAX_PCT and
apply that to the One Time Total of each line item in the cart. The resulting taxed amount can then be
saved in another custom pricing variable called One Time Total With Tax with a code of
OT_WITH_TAX.

You could then calculate the taxed value in the hook as something similar to the following calculation, which
you would save in the variable map: OT_WITH_TAX = OT_STD_PRC_TOTAL + (OT_STD_PRC_TOTAL *
OT_TAX_PCT/100)

The default calculation formulas for the pricing variables are implemented by the following class:
DefaultPricingVariableCalcImplementation. You can use a hook to this class to override the
calculations or to add calculations for custom pricing variables.

In this example, we will define the hook class to be PricingVariableMapHookImplementation. An


instance of this class will be called both before and after the
DefaultPricingVariableCalcImplementation calculate method is called, and the hook logic will
append both .PreInvoke and .PostInvoke to the methods of the class being intercepted.

The DefaultPricingVariableCalcImplementation class only has a calculate method.

The order of execution is as follows:

1. PricingVariableMapHookImplementation.invokeMethod('calculate.PreInvoke',
input, output)
2. DefaultPricingVariableCalcImplementation.invokeMethod('calculate', input,
output)
3. PricingVariableMapHookImplementation.invokeMethod('calculate.PostInvoke',
input, output)

© 2021 Vlocity LLC, a Salesforce


company 301
CME CPQ

Note that there are two separate instances of PricingVariableMapHookImplementation created by


the InvokeService, but the input and output maps passed into their methods are the same instance. In fact,
these maps are the same maps shared by all three invokeMethods.

Input Map
The input map has the following information. This is default sample code and does not have usage pricing
enabled.

{
"paymentMode": null,
"itemId": "80246000003urCpAAI",
"isRoot": true,
"parentItemEffectiveQuantity": null,
"pricingLogDataMap": {

},
"pricingVariableMap": {
"ROLLUP_OT_STD_PRC_TOTAL": 0.00,
"ROLLUP_REC_MNTH_STD_PRC_TOTAL": 55.00,
"OT_STD_PRC_CALC": 0.00,
"OT_STD_PRC": 0.00,
"REC_MNTH_STD_PRC_DISC_PCT_MAN": 0.00,
"OT_STD_PRC_DISC_PCT_MAN": 0.00,
"LINE_QUANTITY": 1.00,
"REC_MNTH_STD_PRC_TOTAL": 0.00,
"REC_MNTH_STD_PRC_CALC": 0.00,
"REC_MNTH_STD_PRC": 0.00,
"OT_STD_PRC_TOTAL": 0.00
}
}

Table 39. Fields and descriptions of the input map


Field Description
paymentMode This field's value is set to either Currency or Loyalty when LoyaltyMode is turned on in the system. This
field's value comes from the CurrencyPaymentMode__c field of the line item.
itemId This field's value is the ID of the line item object (OpportunityLineItem, QuoteLineItem, or OrderItem)
whose variable map is currently being calculated.
isRoot This field indicates whether this line item is the root of the line item hierarchy. It's either true or false.
parentItemEffectiveQuantity This field indicates the effectiveQuantity of the parent of the line item. The value is null when isRoot =
true since the root line item does not have a parent. parentItemEffectiveQuantity is calculated by
recursively multiplying the ancestor quantities from the root down to the current item's parent level.
pricingLogDataMap This map contains any message strings coming from the calculate method. This map is empty in the
input but is filled in the output. It is keyed by the pricing variable code and contains a format string and
the data to fill the string information. This information is shown in the price Details popup for this pricing
variable.

© 2021 Vlocity LLC, a Salesforce


company 302
CME CPQ

Field Description
pricingVariableMap This map contains the current values of the pricing variables for the line item before they are calculated
by the DefaultPricingVariableCalcImplementation calculate method. This map is keyed by
the pricing variable codes.

Output Map
The output map has the following information:

{
"pricingLogDataMap": {
"OT_LTY_TOTAL": {
"data": [
"OT_LTY_TOTAL",
"0.00",
"ROLLUP_OT_LTY_TOTAL",
"0.00",
"LINE_QUANTITY",
"1.00"
],
"format": "[{0} ({1}) + Rollup {2} ({3})] x {4} ({5})"
},
"REC_MNTH_STD_PRC_TOTAL": {
"data": [
"REC_MNTH_STD_PRC_CALC",
"0.00",
"REC_MNTH_STD_PRC_TOTAL",
"55.00",
"LINE_QUANTITY",
"1.00"
],
"format": "[{0} ({1}) + Rollup {2} ({3})] x {4} ({5})"
},
"REC_MNTH_STD_PRC_CALC": {
"data": [
"REC_MNTH_STD_PRC",
"0.00",
"REC_MNTH_STD_PRC_DISC_PCT_MAN",
"0.00"
],
"format": "{0} ({1}) - {2} ({3}%)"
},
"OT_STD_PRC_TOTAL": {
"chargeTiming": "One-Time",
"data": [
"OT_STD_PRC_CALC",
"0.00",

© 2021 Vlocity LLC, a Salesforce


company 303
CME CPQ

"OT_STD_PRC_TOTAL",
"0.00",
"LINE_QUANTITY",
"1.00"
],
"format": "[{0} ({1}) + Rollup {2} ({3})] x {4} ({5})"
},
"OT_STD_PRC_CALC": {
"data": [
"OT_STD_PRC",
"0.00",
"OT_STD_PRC_DISC_PCT_MAN",
"0.00"
],
"format": "{0} ({1}) - {2} ({3}%)"
}
},
"pricingVariableMap": {
"DISP_OT_LTY": 0.00,
"EFF_OT_LTY_TOTAL": 0.00,
"ROLLUP_OT_LTY_TOTAL": 0.00,
"OT_LTY_TOTAL": 0.00,
"OT_LTY": 0.00,
"EFFECTIVE_QUANTITY": 1.00,
"DISP_OT_STD_PRC": 0.00,
"EFF_REC_MNTH_STD_PRC_TOTAL": 55.00,
"EFF_OT_STD_PRC_TOTAL": 0.00,
"ROLLUP_OT_STD_PRC_TOTAL": 0.00,
"ROLLUP_REC_MNTH_STD_PRC_TOTAL": 55.00,
"OT_STD_PRC_CALC": 0.00,
"OT_STD_PRC": 0.00,
"REC_MNTH_STD_PRC_DISC_PCT_MAN": 0.00,
"OT_STD_PRC_DISC_PCT_MAN": 0.00,
"LINE_QUANTITY": 1.00,
"REC_MNTH_STD_PRC_TOTAL": 55.00,
"REC_MNTH_STD_PRC_CALC": 0.00,
"REC_MNTH_STD_PRC": 0.00,
"OT_STD_PRC_TOTAL": 0.00
},
"errorCode": "INVOKE-200",
"error": "OK"
}

© 2021 Vlocity LLC, a Salesforce


company 304
CME CPQ

Table 40. Fields and descriptions of the output map


Field Description
pricingLogDataMap This map contains any message strings coming from the calculate method. It is keyed by the pricing variable
code and contains a format string and the data to fill the string information. This information is shown in the
price Details popup for this pricing variable.

The messages are for pricing variables whose values are calculated inside the calculate method. The format
property is a string format with indexed placeholders to be filled in by the values in the data property.

Any pricing variable code in the data is replaced by its bound field label, if any. See the example below this
table.

A simple message can be passed in for a pricing variable, as in the following example:

"REC_MNTH_STD_PRC_TOTAL": { "data": [ "Some simple pricing message." ], "format":


"{0}" }
pricingVariableMap This map contains the calculated values of the pricing variables after it has gone through the
DefaultPricingVariableCalcImplementation calculate method.
errorCode An error code is returned by the InvokeService if there was any exception thrown.

• INVOKE-200 : No error.
• INVOKECLASS-404 : The class being invoked is not found.
• INVOKEMETHOD-405 : The method name is blank.
• INVOKE-500 : There is an exception. Check the error property for the message.
error OK if no exception. Otherwise the exception message is returned in this property.

Example 10. Example for pricingLogData


As mentioned in the table above, any pricing variable code in the data is replaced by its bound field label (if
there is one). For example, for REC_MNTH_STD_PRC_TOTAL, it will appear as follows in the price Details
popup for REC_MNTH_STD_PRC_TOTAL bound to the Recurring Total field:

Figure 22. Price Details Popup

Price Details popup for REC_MNTH_STD_PRC_TOTAL

© 2021 Vlocity LLC, a Salesforce


company 305
CME CPQ

Example Hook Class

Introduction to the example


In this example hook, we will change how REC_MNTH_STD_PRC_TOTAL is calculated.

It is currently calculated by DefaultPricingVariableCalcImplementation as:

REC_MNTH_STD_PRC_TOTAL = (REC_MNTH_STD_PRC_CALC +
ROLLUP_REC_MNTH_STD_PRC_TOTAL) * LINE_QUANTITY;

We will change it to the following expression:

REC_MNTH_STD_PRC_TOTAL = (REC_MNTH_STD_PRC_CALC * LINE_QUANTITY) +


ROLLUP_REC_MNTH_STD_PRC_TOTAL;

We will do a similar thing for OT_STD_PRC_TOTAL.

It is currently calculated as:

OT_STD_PRC_TOTAL = (OT_STD_PRC_CALC + ROLLUP_OT_STD_PRC_TOTAL) * LINE_QUANTITY

We will change it to the following expression:

OT_STD_PRC_TOTAL = (OT_STD_PRC_CALC * LINE_QUANTITY) + ROLLUP_OT_STD_PRC_TOTAL

We make our changes in calculate.PostInvoke since we want to override the default calculation.

Rollup Logic
Note that the calculate method is called first for all the leaf nodes of the line item hierarchy, and then for
their parent level all the way up to the root. That is, each child line item has to be calculated first before their
parents.

This is true because the REC_MNTH_STD_PRC_TOTAL and OT_STD_PRC_TOTAL of each child is rolled up
to the ROLLUP_REC_MNTH_STD_PRC_TOTAL and ROLLUP_OT_STD_PRC_TOTAL of their parent line item.

This rollup logic is automatically done outside of the calculate method and is based on the rollup pricing
variables' definitions where they are defined as having Scope = Rollup and Applies To Variable,
which is the pricing variable on the child to rollup.

Example 11. For example:


ROLLUP_REC_MNTH_STD_PRC_TOTAL, Scope = Rollup, Applies To Variable = Recurring Monthly Std
Price Total means add the REC_MNTH_STD_PRC_TOTAL of each child to the
ROLLUP_REC_MNTH_STD_PRC_TOTAL variable of its parent line item.

The example hook class


global with sharing class PricingVariableMapHookImplementation implements
vlocity_cmt.VlocityOpenInterface{

© 2021 Vlocity LLC, a Salesforce


company 306
CME CPQ

global Boolean invokeMethod(String methodName, Map<String, Object> input,


Map<String, Object> output, Map<String, Object> options)
{
try
{
System.debug('____ PricingVariableMapHookImplementation ' +
methodName);

if (methodName.equalsIgnoreCase('calculate.PreInvoke'))
{
// dump the input
System.debug('--- calculate.PreInvoke input: ' +
JSON.serialize(input));
}
else if (methodName.equalsIgnoreCase('calculate.PostInvoke'))
{
// log the output
System.debug('--- calculate.PostInvoke output: ' +
JSON.serialize(output));

// Retrieve the pricing variable map from the output


Map<String, Object> pricingVariableCodeToValueMap =
(Map<String, Object>)output.get('pricingVariableMap');

// Retrieve the pricing log data map from the output


Map<String, Object> pricingLogDataMap = (Map<String,
Object>)output.get('pricingLogDataMap');

// Retrieve the isRoot flag from the input


Boolean isRoot = (Boolean)input.get('isRoot');

// Get the Line quantity value


Decimal LINE_QUANTITY =
(Decimal)pricingVariableCodeToValueMap.get('LINE_QUANTITY');

// Get the REC_MNTH_STD_PRC_CALC pricing variable value


Decimal REC_MNTH_STD_PRC_CALC =
(Decimal)pricingVariableCodeToValueMap.get('REC_MNTH_STD_PRC_CALC');

// Get the ROLLUP_REC_MNTH_STD_PRC_TOTAL pricing variable


value
Decimal ROLLUP_REC_MNTH_STD_PRC_TOTAL =
(Decimal)pricingVariableCodeToValueMap.get('ROLLUP_REC_MNTH_STD_PRC_TOTAL');

// Override the default calculation formula. The formula being

© 2021 Vlocity LLC, a Salesforce


company 307
CME CPQ

overridden is:
// REC_MNTH_STD_PRC_TOTAL = (REC_MNTH_STD_PRC_CALC +
ROLLUP_REC_MNTH_STD_PRC_TOTAL) * LINE_QUANTITY;
Decimal REC_MNTH_STD_PRC_TOTAL = (REC_MNTH_STD_PRC_CALC *
LINE_QUANTITY) + ROLLUP_REC_MNTH_STD_PRC_TOTAL;

// Save the new REC_MNTH_STD_PRC_TOTAL rounded to 2 decimals


in the pricing variable map of the line item
pricingVariableCodeToValueMap.put('REC_MNTH_STD_PRC_TOTAL',
REC_MNTH_STD_PRC_TOTAL.setScale(2, RoundingMode.HALF_UP));

// Set the new pricing details information for the


REC_MNTH_STD_PRC_TOTAL
pricingLogDataMap.put('REC_MNTH_STD_PRC_TOTAL',
new Map<String, Object>{
'format'=>'[{0} ({1}) x {2} ({3})] + Rollup {4} ({5})',
'data'=>new
List<String>{'REC_MNTH_STD_PRC_CALC', // replaces {0}

String.valueOf(REC_MNTH_STD_PRC_CALC), // replaces {1}

'LINE_QUANTITY', // replaces {2}

String.valueOf(LINE_QUANTITY), // replaces {3}

'REC_MNTH_STD_PRC_TOTAL', // replaces {4}

String.valueOf(ROLLUP_REC_MNTH_STD_PRC_TOTAL) // replaces {5}


}});

// If this is the root, then set the


EFF_REC_MNTH_STD_PRC_TOTAL of the line item to be the same as
// REC_MNTH_STD_PRC_TOTAL value. EFF_REC_MNTH_STD_PRC_TOTAL
participates in a rollup summary field in the parent header
if (isRoot)
{
Decimal EFF_REC_MNTH_STD_PRC_TOTAL =
REC_MNTH_STD_PRC_TOTAL;

pricingVariableCodeToValueMap.put('EFF_REC_MNTH_STD_PRC_TOTAL',
EFF_REC_MNTH_STD_PRC_TOTAL.setScale(2, RoundingMode.HALF_UP));
}

// Do the same for OT_STD_PRC_TOTAL

// Get the OT_STD_PRC_CALC pricing variable value

© 2021 Vlocity LLC, a Salesforce


company 308
CME CPQ

Decimal OT_STD_PRC_CALC =
(Decimal)pricingVariableCodeToValueMap.get('OT_STD_PRC_CALC');

// Get the ROLLUP_REC_MNTH_STD_PRC_TOTAL pricing variable


value
Decimal ROLLUP_OT_STD_PRC_TOTAL =
(Decimal)pricingVariableCodeToValueMap.get('ROLLUP_OT_STD_PRC_TOTAL');

// Override the default calculation formula. The formula being


overridden is:
// OT_STD_PRC_TOTAL = (OT_STD_PRC_CALC +
ROLLUP_OT_STD_PRC_TOTAL) * LINE_QUANTITY;
Decimal OT_STD_PRC_TOTAL = (OT_STD_PRC_CALC * LINE_QUANTITY) +
ROLLUP_OT_STD_PRC_TOTAL;

// Save the new OT_STD_PRC_TOTAL rounded to 2 decimals in the


pricing variable map of the line item
pricingVariableCodeToValueMap.put('OT_STD_PRC_TOTAL',
OT_STD_PRC_TOTAL.setScale(2, RoundingMode.HALF_UP));

// Set the new pricing details information for the


OT_STD_PRC_TOTAL
pricingLogDataMap.put('OT_STD_PRC_TOTAL',
new Map<String, Object>{
'format'=>'[{0} ({1}) x {2} ({3})] + Rollup {4} ({5})',
'data'=>new
List<String>{'OT_STD_PRC_CALC', // replaces {0}

String.valueOf(OT_STD_PRC_CALC), // replaces {1}

'LINE_QUANTITY', // replaces {2}

String.valueOf(LINE_QUANTITY), // replaces {3}

'OT_STD_PRC_TOTAL', // replaces {4}

String.valueOf(ROLLUP_OT_STD_PRC_TOTAL) // replaces {5}


}});

// If this is the root, then set the EFF_OT_STD_PRC_TOTAL of


the line item to be the same as
// OT_STD_PRC_TOTAL value. EFF_OT_STD_PRC_TOTAL participates
in a rollup summary field in the parent header
if (isRoot)
{
Decimal EFF_OT_STD_PRC_TOTAL = OT_STD_PRC_TOTAL;

© 2021 Vlocity LLC, a Salesforce


company 309
CME CPQ

pricingVariableCodeToValueMap.put('EFF_OT_STD_PRC_TOTAL',
EFF_OT_STD_PRC_TOTAL.setScale(2, RoundingMode.HALF_UP));
}
}
return true;
}
catch (Exception ex)
{
System.debug('--- Exception: ' + ex.getMessage());
System.debug('--- Stack Trace: ' + ex.getStackTraceString());
throw ex;
}
}
}

Setting Up the Hook


Create an Interface called DefaultPricingVariableCalcImplementaInterface and set
PricingVariableMapHookImplementation as the implementation.

NOTE
Note the name of the DefaultPricingVariableCalcImplementaInterface
interface. The last part of the name is "ImplementaInterface" instead of
"ImplementationInterface".

For an explanation of this naming convention, see Names of Elements.

Figure 23. Interface Implementation

Sample Hook Implementation

© 2021 Vlocity LLC, a Salesforce


company 310
CME CPQ

In our hook example, we set DefaultPricingVariableCalcImplementaInterface active


implementation to be PricingVariableMapHookImplementation and PricingInterface active
implementation to be PricingPlanService.

Now we test the hook and modified calculation by adding a product to the cart or forcing a pricing event by
changing the quantity of a line item or changing attribute values. The new calculation formula is reflected in
the Recurring Totals and One Time Totals in the CPQ interface. As well, the new detail message
from the hook class appears in the totals details, as in the example below:

Figure 24. Price Details Popup

Price Details Popup to Verify the Hook

NOTE
We have changed the totaling behavior, which is reflected in the difference in overall totals
(line-level totals, child total rollups and header totals) compared to the out of the box
behavior.

To revert to the out of the box behavior, de-activate the PricingVariableMapHookImplementationor


delete the DefaultPricingVariableCalcImplementaInterface in the Interface Implementation
view.

Names of Elements
Note the name of the DefaultPricingVariableCalcImplementaInterface interface. The last part
of the name is "ImplementaInterface" instead of "ImplementationInterface".

Here's why:

© 2021 Vlocity LLC, a Salesforce


company 311
CME CPQ

The name of the class we are intercepting is DefaultPricingVariableCalcImplementation. The


InvokeService appends Hook to this class name, making the new name:
DefaultPricingVariableCalcImplementationHook.

However, this class name is too long and is truncated to 36 characters, making it:
DefaultPricingVariableCalcImplementa (the last few letters are missing). Then the InvokeService
appends Interface to that new name, arriving at the final name
(DefaultPricingVariableCalcImplementaInterface), which is then used to look for the
corresponding Active Implementation Name.

Whenever a new Interface Implementation and active Interface Implementation detail record is created or
updated, the interface name (minus the Interface string) and the name of its active implementation class
are cached in the Custom Class Implementation custom setting through the triggers of these objects. Doing
so reduces SOQL queries to look for the implementation class names during runtime. Instead, they are
retrieved from the Custom Class Implementation custom setting.

Example 12. For example


If the Interface Implementation is PricingInterface, and the Active Implementation
Detail is PricingPlanService, then under Setup : Custom Settings : Custom Class
Implementation : Manage, there will be an entry for Name = Pricing (the Interface string is stripped
off) and another entry for Class Name = PricingPlanService.

When we set up our hook interface, there is a corresponding custom setting created where Name is
DefaultPricingVariableCalcImplementa (the Interface string is stripped off) and Class Name is
PricingVariableMapHookImplementation.

The name of the interface has to fit within the maximum 40 character limit of the Custom Class
Implementation custom setting name field. This is why the InvokeService truncates to 36 characters.

Figure 25. Custom Class Implementation

Custom Class Implementation

© 2021 Vlocity LLC, a Salesforce


company 312
CME CPQ

NOTE
When you de-activate an active implementation, the custom setting class name value for
the interface will be null. When you activate another implementation, the custom setting
class name value for the interface is updated to the active implementation class name. The
screenshot below is the state of the Custom Class Implementation custom setting if the
PricingInterface active implementation is DefaultPricingImplementation and
DefaultPricingVariableCalcImplementaInterface active implementation is
deactivated.

Figure 26. Custom Class Implementation

Custom Class Implementation when the PricingInterface active implementation is


DefaultPricingImplementation and DefaultPricingVariableCalcImplementaInterface active
implementation is de-activated.

See Also
• Defining Pricing
• Default Pricing Implementation

Pricing Hooks
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. This is very useful when adding new functionality to applications,
exposing additional fields in pricing calculations, or altering how products are priced, to name a few of its
applications.

Using a hook, you can modify the pricing behavior in the cart without changing the underlying programming
code. Salesforce Industries CPQ enables you to write custom pre-invoke and post-invoke hooks for each
interface to implement custom logic. Pre-invoke hooks execute before the actual interface executes,
whereas post-invoke hooks execute after the actual interface executes.

Salesforce Industries CPQ functionality is managed by a global interface named CpqAppHandler. It


includes a wide range of methods to perform CPQ processes in Vlocity Cart. These methods are also
available as REST API, known as the Vlocity Cart-based APIs. So, when you need to change the default

© 2021 Vlocity LLC, a Salesforce


company 313
CME CPQ

behavior or processing of a CPQ operation, you create a custom implementation in CpqAppHandler’s hook
interface, which is appropriately named CpqAppHandlerHook.

You can use the CpqAppHandlerHook to manage the inputs and outputs of CPQ methods. You can:

• 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 to do the following:

• Conditional processing.
• Preload information to use further down the execution chain.
• Process custom fields.
• Implement custom functionality.
• Perform callouts.

Invoke the CpqAppHandlerHook


The CpqAppHandlerHook is automatically invoked when the InvokeService is called. The InvokeService
simply appends a hook string, such as “Hook”, to the interface name and determines if there is an active
interface with that name. If there is, the InvokeService initiates the active implementation in the hook
interface. Then, it adds a .preInvoke suffix to the method name and invokes 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.

The following image provides an example of the sequence when using a CpqAppHandlerHook.

© 2021 Vlocity LLC, a Salesforce


company 314
CME CPQ

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

• Ensure 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.

Using a Hook
Let’s look at some examples based on the following business requirement:

Example 13. Example 1


Disallow users from ordering the same product more than once on 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 is checked in the post-hook.

© 2021 Vlocity LLC, a Salesforce


company 315
CME CPQ

• In the postinvoke hook, if the new node exists, then display an error.
• When the user tries to add a duplicate product, they will get an error in the cart.

Example 14. Example2


Consider how pricing works in Vlocity Cart. You add an iPhone X to the cart. It displays a one-time charge
of $1000. However, the customer wants to know the total price of the iPhone X, which includes the sales
tax cost. How do you display the cost of the iPhone X plus applicable taxes in the one-time charge column
in Vlocity 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. If you don’t want to
include the sales tax in the one-time charge column, but instead display it as a separate column, you can
modify the cart to display a custom field for the applicable sales tax.

Pricing and Validating Changed Items Only


To support large numbers of items in Vlocity Cart, you can pass only the changed, or delta, items to the
configuration rules and the pricing engine. Use the CPQ Configuration DeltaPrice and DeltaValidate custom
settings.

For example, suppose there are five line items already present in the cart and then you add a sixth item to
the cart. If the DeltaValidate setting is false and the DeltaPrice setting is false, Vlocity passes all six items to
the rule engine to run configuration rules and passes all six items to the pricing engine as well.

To avoid passing large sets of items to the configuration rules and the pricing engine, set DeltaValidate to
true and DeltaPrice to true. Instead of passing all six items to the configuration rules and pricing engine,
Vlocity passes only the newly added item and the related items that might be affected by the new item. To
get the related items, Vlocity CMT preprocesses the rules and caches the Product IDs.

End users will not notice any difference in the final output. The performance will improve when tested with
orders that contain large numbers of items.

NOTE
For product bundles with more than 50 line items, you must set DeltaPrice and
DeltaValidate to true.

To set the DeltaPrice and DeltaValidate custom settings:

1. On the Vlocity CMT Administration tab, click CPQ Configuration Setup.


2. In the DeltaPrice row, click the Action icon.

© 2021 Vlocity LLC, a Salesforce


company 316
CME CPQ

3. In the Value column, enter the appropriate value—true or false.


4. In the DeltaValidate row, click the Action icon.
5. In the Value column, enter the appropriate value—true or false.
6. Click Save.

Attribute-Based Pricing
Product attributes describe product characteristics. You can use product attributes for many purposes such
as filtering, order decomposition, and fulfillment, and also to determine the correct price for a given product
configuration.

Complex products often have several characteristics that affect the price of the product such as the
capacity or other product options. Consider a smartwatch with two product attributes, shown in the following
example. Without attribute-based pricing, you must create separate product entities for each configuration,
so that each product configuration can be priced correctly.

Figure 27. Pricing Products Without Attribute-Based Pricing

In a large catalog with many products and attributes, this approach can cause your product catalog to grow
exponentially, increasing maintenance and administration.

Using attribute-based pricing, you can create a single product entity and a set of attributes, and use a
standard calculation matrix to price each possible combination of attributes. This method reduces the
number of products in your catalog and gives you an easy way to review and administer your pricing model.

© 2021 Vlocity LLC, a Salesforce


company 317
CME CPQ

Figure 28. Pricing Products With Attribute-Based Pricing

Attribute-Based Pricing Implementation


You can implement attribute-based pricing differently, depending on the release you have deployed. For
Summer '18 and later deployments, the packages allow you to implement different types of attribute-based
pricing using generic Apex classes and pricing plans. For earlier releases, You can implement attribute-
based pricing using pricing plans, or using Calculation Matrices and DataRaptor.

• Summer '18 and later deployments


See Attribute-Based Pricing Using Pricing Plans in Summer '18.
• Winter '18 deployments and Summer '17 release (CMT 100.0.900.74 package)
You can implement attribute-based pricing using pricing plans.
• Prior to Summer '17 deployments
See Setting Up Pricing Matrices for Attribute-Based Pricing.

Attribute-Based Pricing Using Pricing Plans


You can implement attribute-based pricing using pricing plans, calculation procedures, and standard
calculation matrices. Attribute-based pricing enables you to create a single product entity and attributes,
and use a matrix to price each combination of attributes. This approach reduces the number of products in
your catalog and gives you an easy way to review and administer your pricing model.

© 2021 Vlocity LLC, a Salesforce


company 318
CME CPQ

NOTE
Vlocity Communications supports only standard calculation matrices. It doesn’t currently
support grouped calculation matrices, row-versioned calculation matrices, or wildcards in
calculation matrices. For a description of each, see Calculation Matrices.

You create a step in the default pricing plan. Then, use that step to call a calculation procedure and a
standard calculation matrix that stores the product attributes and pricing information. At runtime, the
PricingPlanService implementation passes the cart line items, including product information and their
attributes and fields, to the calculation service and retrieves the correct price. The price returned overrides
the base price in the shared catalog. Additional adjustments and calculations can be applied before the
price is displayed in Vlocity Cart.

Vlocity supports these types of attribute-based pricing:

• Standard
Standard attribute-based pricing provides the ability to price a product using attributes.
• Source/Target
Source/Target attribute-based pricing enables you to price a product based on the attributes of another
product. You can also provide a path to a child product in a bundle to change the price of a product
based on its specific context.

© 2021 Vlocity LLC, a Salesforce


company 319
CME CPQ

NOTE
Because a calculation matrix requires input data to be unique across all the rows in the
matrix, you can't use source-target attribute-based pricing to change more than one
child product in a bundle.

• Range
Range attribute-based pricing enables you to define ranges for each attribute and field in the matrix, and
to determine a price for the product when values fall within those ranges.

Setting Up Attribute-Based Pricing Using Pricing Plans


The instructions in this section are for setting up attribute-based pricing in the Summer '18 release or later
of Vlocity Communications, Media, and Energy.

Downloading the Attribute/Volume Based Pricing DataPack


The Fall '18 release includes an attribute schema change. Customers who implemented attribute-based
pricing in an earlier release must install the latest version of the from the Vlocity Industry Process Library in
order to obtain the latest Apex classes that support the new attribute schema. The updated classes are
backward-compatible, so they can be used in deployments that have not migrated yet to the new schema
as well as in deployments that have completed the migration.

© 2021 Vlocity LLC, a Salesforce


company 320
CME CPQ

IMPORTANT
The Attribute/Volume Based Pricing DataPack is not installed by default. In Fall '18 and
later, Vlocity implemented changes to support the V2 attribute schema. If you installed this
data pack for Summer '18, and you upgraded to the V2 attribute schema, you need to get
the latest version of the Apex classes in the Attribute/Volume Based Pricing DataPack.

• Go to the Process Library and download the Attribute/Volume Based Pricing DataPack.
This digital asset includes:
• AttributePricingDataPack.json
Includes a preconfigured calculation procedure and calculation matrix for standard attribute-based
pricing.
• SourceTargetAttributePricingDataPack.json
Includes a preconfigured calculation procedure and calculation matrix for source target attribute-
based pricing.
• RangeAttributePricingDataPack.json
Includes a preconfigured calculation procedure and calculation matrix for range attribute-based
pricing.
• CustomPricingPlanStepImpl.cls
Includes the VlocityOpenInterface implementation Apex class that exposes the
GetMatrixPrice method and invokes the PricingPlanHelper class.
• PricingPlanHelper.cls
Includes the Apex helper class invoked by CustomPricingPlanStepImpl.cls that analyzes the
matrix and invokes the calculation procedure.
• CustomPricingPlanStepImplTest.cls
Includes an Apex test class. See Introduction to Apex Code Text Methods.

Confirming Completion of Post-Install Steps for Attribute-Based Pricing


The following instructions are for setting up attribute-based pricing in the Summer '18 and Fall '18 releases
of Vlocity Communications, Media, and Energy and don't apply to earlier or later releases.

Before you set up attribute-based pricing, verify that the related post-install tasks are completed.

1. Ensure that the Default Pricing Plan is installed:


a. Go to Vlocity Product Console.
b. In the Dashboard in the Pricing area, click the search icon next Pricing Plan, and press the Enter
or Return key.
The Default Pricing Plan is displayed.
If the Default Pricing Plan does not display, go to the EPC Jobs on the CMT Administration
screen, find the INSTALL DEFAULT PRICING PLAN DATA job, and click INSTALL.
2. Ensure that the Parameters field displays:

© 2021 Vlocity LLC, a Salesforce


company 321
CME CPQ

a. Click on the Default Pricing Plan, and then click Pricing Plan Steps in the sidebar.
b. In the Pricing Plan Steps facet, click on any step.
c. In the General Properties pane, ensure that the Parameters field displays.

If the Parameters field does not display, go to the EPC Jobs on the CMT Administration screen,
find the INSTALL DEFAULT VLOCITY OBJECTS AND LAYOUTS job, and click INSTALL. Note
that this job will overwrite any configuration changes that you have made to the Vlocity Product
Console.
3. Ensure that the DefaultPricingPlan custom setting has been created.
a. Go to CMT Administration, and in the Custom settings area, click CPQ Configuration Setup.
b. In the Search dialog box under CONFIGURATIONS, enter pricing. The DefaultPricingPlan
custom setting should display.

If the DefaultPricingPlan custom setting has not be added, scroll to the bottom of the page, and
click Add. In the first box, enter DefaultPricingPlan. In the second box, enter
DEFAULT_PRICING_PLAN. Then, at the bottom of the page, click Save.

© 2021 Vlocity LLC, a Salesforce


company 322
CME CPQ

4. Ensure that the PricingPlanService implementation is active.


a. Go to the Interface Implementations tab and find the PricingInterface.
b. Click the RELATED tab, and in the list of available implementations, find the PricingPlanService
implementation.
5. Ensure that the PricingPlanService implementation is active and default.

To make the PricingPlanService implementation active and default, edit its record, check the Active
and Default fields, then click Save.

NOTE
PricingPlanService and PricingElementServiceImplementations are very similar, so
changing the PricingInterface from PricingElementServiceImplementations to
PricingPlanService has no impact on existing pricing in Vlocity Cart. The
PricingPlanService implementation enables you to use pricing plan functionality and
price lists, pricing elements, and pricing variables. The
PricingElementServiceImplementation only enables you to use price lists, pricing
elements, and pricing variables. For more information on pricing implementations, see
PricingInterface.

Creating Apex Classes for Attribute-Based Pricing


The Fall '18 release includes an attribute schema change. Customers who implemented attribute-based
pricing in an earlier release must install the latest version of the Attribute/Volume Based Pricing DataPack
from the Vlocity Industry Process Library in order to obtain the latest Apex classes that support the new
attribute schema. The updated classes are backward-compatible, so they can be used in deployments that
have not migrated yet to the new schema as well as in deployments that have completed the migration.

© 2021 Vlocity LLC, a Salesforce


company 323
CME CPQ

Before you do this step, download the Attribute/Volume Based Pricing DataPack from the Vlocity Industry
Process Library.

To implement attribute-based pricing in Summer '18, add the following Apex classes to your org. Due to
code dependencies, you must create these classes in the order shown below.

1. PricingPlanHelper.cls
This Apex helper class is invoked by the CustomPricingPlanStepImpl.cls that analyzes the
matrix and invokes the calculation procedure.
2. CustomPricingPlanStepImpl.cls
This VlocityOpenInterface implementation Apex class that exposes the GetMatrixPrice
method and invokes the PricingPlanHelper class.
3. CustomPricingPlanStepImplTest.cls:
This is an Apex test class. For more information on Apex test classes, see Introduction to Apex Code
Text Methods.

For information on how to create Apex classes, see Create an Apex Class in the Salesforce help.

Setting Up Pricing Matrices for Attribute-Based Pricing


To speed your deployment, Vlocity provides pre-configured calculation procedures and matrices for
attribute-based pricing.

Starting in the Summer '18 release, you use pricing plans and calculation matrices to price products using
attributes. The standard calculation matrices store the combinations of product configurations and their
corresponding prices. The pricing plan service overrides the product's base price with the price specified for
each permutation defined in the standard calculation matrix. If any permutations aren’t defined, the pricing
plan service defaults to the base price listed in the shared catalog.

An easy way to ensure that all permutations are captured in the calculation matrix is to set the product's
base price to $100,000,000. That way, users quickly let you know if a permutation slips through the matrix!

If you’ve installed the Attribute/Volume Based Pricing DataPack from the Vlocity Process Library, you
should have the following records in your org.

Calculation Procedure Calculation Matrix DataPack


AttributePricing AttributePricingMatrix AttributePricingDataPack.json
SourceTargetAttributePricingProcedure SourceTargetAttributePricingMatrix SourceTargetAttributePricingDataPack.json
RangeAttributePricingProcedure RangeAttributePricingMatrix RangeAttributePricingDataPack.json

Each DataPack corresponds to a type of attribute-based pricing and has a standard calculation matrix that
has been configured to support it. You can deploy one, two, or all of these matrices depending on the type
of attribute-based pricing that you need. After importing the DataPacks into your org, go to Vlocity
Calculation Matrices to add data to the matrices.

© 2021 Vlocity LLC, a Salesforce


company 324
CME CPQ

NOTE
Vlocity Communications supports only standard calculation matrices. It doesn’t currently
support grouped calculation matrices, row-versioned calculation matrices, or wildcards in
calculation matrices. For a description of each, see Calculation Matrices.

Understanding Attribute-Based Pricing Calculation Matrices


The pre-configured calculation matrices contain the following columns.

Don’t change the header names of the columns in the calculation matrix. The PricingPlanHelper.cls
expects these column names and fails if they aren’t found. The only header change you can make is to
change the field names in the range attribute-based pricing matrix.

Header Name Header Data Description


Type Type
Source Product Input Text Product name
Name
Source Product Input Text Product code is the key for the matching algorithm used in the
Code PricingPlanHelper.cls.
Characteristic Input Text Attribute name associated with the product. Specify multiple attributes using a semi-
Name colon-delimited list.
Characteristic Input Text Attribute value associated with the product attribute. Specify multiple attributes
Value using a semi-colon-delimited list in the same order as the corresponding attributes.
By default, PricingPlanHelper.cls evaluates attribute display labels when
looking for a match, but you can change this behavior using the
UseDisplayTextForValues parameter. To learn more, see Setting Up a Custom
Pricing Step for Attribute-Based Pricing.
MRC Output Text Recurring monthly charge. Doesn’t need to match an existing pricing element value
in the price list that is used for the order, quote, or opportunity order.
NRC Output Text Non-recurring charge or one-time charge. Doesn’t need to match an existing pricing
element value on the price list that is used for the order, quote, or opportunity order.
Target Product Output Text Used only for source/target or range pricing. Specifies the target product name to
Name which the pricing override is applied. If no path is specified in the pricing plan step,
pricing override is applied to all target products that match the target product name.
If a path is specified, however, pricing override is applied specifically to the path +
Target Product Name that is defined.

NOTE
Range attribute-based pricing calculation matrices also can include any field or attribute of
data type Number on order line item, quote product, or opportunity product sObjects.
Create column headers in your matrix for those fields using the API field name, such as
Quantity or vlocity_cmt__EffectiveQuantity__c.

© 2021 Vlocity LLC, a Salesforce


company 325
CME CPQ

Setting up the Calculation Matrices


Each calculation matrix corresponds to a type of attribute-based pricing and includes all of the columns
needed for each type. Before you deploy any of these matrices, you must populate them with data.

Figure 29. Types of Attribute-Based Pricing and Their Calculation Matrices

• Setting Up AttributePricingMatrix
• Source Target Attribute-Based Pricing
• Setting Up the RangeAttributePricingMatrix

If additional performance is required, see Caching Calculation Matrices for Performance.

Setting Up AttributePricingMatrix
The AttributePricingMatrix enables you to implement standard attribute-based pricing. This calculation
matrix is pre-configured with the column headers that define the source products, the product attributes, the
MRC, the NRC, and the usage prices.

The AttributePricingMatrix calculation matrix is part of the Attribute/Volume-Based Pricing DataPack from
the Vlocity Process Library.

Before deploying the calculation matrix, you must populate it with data as described below. You can enter
data manually using the user interface or import a comma-separated values (CSV) file.

To enter data into the calculation matrix:

1. Navigate to the Vlocity Calculation Matrices tab, and find the AttributePricingMatrix calculation matrix
that you installed from the dataPack.
2. Click AttributePricingMatrix.

© 2021 Vlocity LLC, a Salesforce


company 326
CME CPQ

3. Scroll to the Vlocity Calculation Matrix Versions related list at the bottom of the page.
4. Click AttributePricingMatrix v1.
5. In Vlocity Calculation Matrix Version Detail, click Create New Version.
6. Expand the Table related list.
7. Enter your data using the user interface in the Enter New Data for Inputs section, or, if you want to
import a comma-separated values (CSV) file, click Upload CSV. When the Upload CSV window
opens, click Choose File. Select the required file, click Open, then click Upload.

8. To include the usage pricing components in AttributePricingMatrix, you must set up Unit Price (UP) and
Unit of Measurement (UOM) as headers in the pricing matrix.
a. To add the Unit Price component to the calculation matrix:
i. Enter a Name for the header, for example, UP.
ii. For Header Type, select Output from the drop-down list.
iii. For Data Type, select Currency from the drop-down list.
iv. Enter a number for Matrix Display Order, for example, 7.
b. To add the Unit of Measurement component to the calculation matrix:
i. Enter a Name for the header, for example, UOM.
ii. For Header Type, select Output from the drop-down list.
iii. For Data Type, select Text from the drop-down list.
iv. Enter a number for Matrix Display Order, for example, 8.

© 2021 Vlocity LLC, a Salesforce


company 327
CME CPQ

9. Click Save Data.


10. At the top of the page in the Vlocity Calculation Matrix version Detail, click Edit.
11. In the Priority box, enter 10 or a value greater than the priority on the v1 matrix that is included in the
dataPack.
12. In the Priority box, enter 10 or a value greater than the priority on the v1 matrix that is included in the
DataPack.
13. Click the checkbox next to Enabled.
14. Click Save.

Next, go to Reviewing the Calculation Procedures for Attribute-Based Pricing.

Setting Up SourceTargetAttributePricingMatrix
SourceTargetAttributePricingMatrix enables you to implement source target attribute-based pricing. Using
this approach, you can adjust pricing for one product based upon the attributes of another product. You can
also use a parameter on the pricing plan step to specify the path to specific products in a bundle.

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

SourceTargetAttributePricingMatrix is part of the Attribute/Volume Based Pricing DataPack from the Vlocity
Process Library.

© 2021 Vlocity LLC, a Salesforce


company 328
CME CPQ

This calculation matrix has been preconfigured with the column headers that define the source products,
product attributes, MRC and NRC prices, and the target product name. Before deploying it, you must
populate the matrix with data. You can enter data manually in the UI or import a CSV file.

Special Considerations for Target Products

• Target Product Name must be the name of the product to price depending on the attribute values of the
source product. All products that match the Target Product Name in the cart receive the pricing override.
• The DeltaPrice and DeltaValidate custom settings are incompatible with source target pricing. For source
target pricing to work as designed in your org, these custom settings must be set to false. If these custom
settings are set to true, only a partial product hierarchy is sent to the pricing service when an event
change happens in the cart, which will cause your target product to not be found and thus no pricing
override will be applied.
• To minimize the number of matrices that you must maintain, you can use the same matrix to include
products that do not have a target product alongside products with a target product. To use this
approach, use the SourceTargetAttributePricingMatrix, and, for those products that do not have a target
product, enter a target product name that is the same as the source product name, which will apply the
pricing override to the source product.
• Due to the way that a calculation matrix requires input data to be unique across all the rows in the matrix,
you cannot use source-target attribute-based pricing to change more than one child product in a bundle.

Figure 30. Entering new data for inputs to SourceTargetAttributePricingMatrix

Selecting Target Products within a Bundle Using Target Path


To price the same product differently based upon the bundle it is in, pass the target product and path using
a parameter in the pricing plan step. For more information on how to format the path parameter, see Setting
Up a Custom Pricing Step for Attribute-Based Pricing. In your matrix, enter the parameter value that is
passed on the pricing plan step as shown below.

© 2021 Vlocity LLC, a Salesforce


company 329
CME CPQ

Entering Data in SourceTargetAttributePricingMatrix


1. Navigate to the Vlocity Calculation Matrices tab, and find the SourceTargetAttributePricingMatrix that
you installed from the DataPack.
2. Click SourceTargetAttributePricingMatrix.
3. Scroll to the Vlocity Calculation Matrix Versions related list at the bottom of the page.
4. Click SourceTargetAttributePricingMatrix v1.
5. In the Vlocity Calculation Matrix Version Detail section, click Create New Version.
6. Expand the Table related list.
7. Enter your data in the Enter New Data for Inputs section. Alternatively, click Upload CSV to import a
comma-separated values (CSV) file.
8. Click Save Data.
9. At the top of the page in the Vlocity Calculation Matrix version Detail section, click Edit.
10. In the Priority box, enter 10 or a value greater than the priority on the v1 matrix included in the
DataPack.
11. Select Enabled.
12. Click Save.

Next Step
After you enter your data, go to the next step: Calculation Procedures for Attribute-Based Pricing

Setting Up RangeAttributePricingMatrix
The RangeAttributePricingMatrix enables you to implement attribute-based pricing that evaluates a range of
numeric values in an attribute or a field. Using this approach, you can override pricing for a product when,
for example, the Quantity field on the line item exceeds a certain threshold or the numeric value of an
attribute falls within a certain range. You can also use this matrix to allow volume-based pricing simply
based on quantity alone (no attributes necessary).

© 2021 Vlocity LLC, a Salesforce


company 330
CME CPQ

SourceTargetAttributePricingMatrix is part of the Attribute/Volume Based Pricing DataPack from the Vlocity
Process Library.

This calculation matrix is preconfigured with the column headers that define the source products, product
attributes, MRC and NRC prices, and the Quantity field as an example. Before deploying it, you must
populate the matrix with data. You can enter data manually to import a comma-separated values (CSV) file.

You can specify ranges for numeric fields on Order Product, Quote Product or Opportunity Product
sObjects or product attributes of value type number.

Each range defined for an attribute or field must not overlap with a range on another row of the matrix. For
example, do not create a range like this: 0-10 on one row and 10-20 on another row. In this case, the
pricing plan service has two matches when the attribute or field is set to 10. Instead, specify 0-9 in one row
and 10-19 in another row to ensure the pricing plan service finds a single match when evaluating the
matrix.

When entering a range for an attribute, specify two numbers separated by a dash; for example, 10-19.

If you have multiple attribute values, separate them with semi-colons, even those with ranges as shown in
the highlighted example below.

Create a separate column for each field that must be evaluated. Use the API field name for the column
header name. In this sample matrix, the range field is Quantity.

To combine target product and path pricing with range pricing, add a Target Product Name column and
adjust the calculation procedure to include the Target Product Name in the output.

If desired, you can delete the Characteristic Name and Characteristic Value columns from the matrix,
and use only the Quantity field to create a simple volume-based pricing matrix that does not include any
attributes.

Figure 31. Entering input data to the Range AttributePricingMatrix

To enter data into the RangeAttributePricingMatrix:

© 2021 Vlocity LLC, a Salesforce


company 331
CME CPQ

1. Navigate to the Vlocity Calculation Matrices tab, and find the RangeAttributePricingMatrix that you
installed from the DataPack.
2. Click RangeAttributePricingMatrix.
3. Scroll to Vlocity Calculation Matrix Versions related list at the bottom of the page.
4. Click RangeAttributePricingMatrix v1.
5. In Vlocity Calculation Matrix Version Detail, click Create New Version.
6. Expand the Table related list.
7. Enter your data using the user interface in the Enter New Data for Inputs section, or click the Upload
CSV button to import a comma-separated values (CSV) file.
8. Click Save Data.
9. At the top of the page in the Vlocity Calculation Matrix version Detail, click Edit.
10. In the Priority field, enter 10 or a value greater than the priority on the v1 matrix included in the
DataPack.
11. Check Enabled.
12. Click Save.

After you've entered your data, go to the next step. Reviewing theSetting Up a Calculation Procedure s for
Attribute-Based Pricing

Caching Calculation Matrices for Performance


To optimize performance for large calculation matrices or pricing plans that have many attribute-based
pricing steps, you can cache your calculation matrices in the platform cache.

Caching is not needed for all calculation matrices. Small to medium-sized matrices will likely be quite fast.
Vlocity recommends implementing your attribute-based pricing solution without a cache at first and creating
the cache if additional speed is required.

The PricingPlanHelper Apex class caches calculation matrix data using the key AttrMatrixMap +
{Matrix Id}, for example, AttrMatrixMapa1K46000002FATaE, in a custom org cache partition.

NOTE
Calculation matrix data is not cached in the CPQPartition that is part of the Vlocity
managed package.

After you have implemented the caching feature, you must clear the cache every time you make a change
to your calculation matrices to ensure your changes are reflected at runtime.

To cache your calculation matrices, create a custom partition in the platform cache, and then create a
custom setting that stores the name of the custom partition as follows. The PricingPlanHelper.cls
then detects your custom setting and stores your calculation matrices in the cache.

© 2021 Vlocity LLC, a Salesforce


company 332
CME CPQ

1. Create a custom partition:


a. Go to Setup, and then type platform cache in the Quick Find search dialog box.
b. Click New Platform Cache Partition.
c. In the Detail section, enter the following information.

Field Value Description


Label AttributePricingPartition The label to be displayed for this partition.
Name AttributePricingPartition The name of this partition. This value must be
entered in the CPQ Configuration custom
setting.
Default Partition Do not select.
Description Stores calculation matrices for
attribute based pricing.

NOTE
Do not enter an allocation amount for the session cache since it is not used by
the PricingPlanHelper.cls.

2. Create the AttrMatrixInfoCachePartition custom setting.


The custom setting that enables the PricingPlanHelper.cls to find your new custom partition in the
platform cache.
a. Go to the Vlocity CMT Administration tab.
b. In the Custom Settings area, click CPQ Configuration Setup.
c. Scroll to the bottom of the page, and click Add.
d. In the first box, enter AttrMatrixInfoCachePartition.
e. In the second box, enter AttributePricingPartition (or the name of the partition you
created above).
f. Click Save.

Calculation Procedures for Attribute-Based Pricing


To speed your deployment, Vlocity Communications, Media, and Energy provides preconfigured calculation
procedures and matrices for attribute-based pricing. If you have installed the Attribute/Volume Based
Pricing DataPack from the Vlocity Process Library, you have the following records in your org.

Table 41.
Calculation Procedure Calculation Matrix DataPack
AttributePricingProcedure AttributePricingMatrix AttributePricingDataPack.json
SourceTargetAttributePricingProcedure SourceTargetAttributePricingMatrix SourceTargetAttributePricingDataPack.json
RangeAttributePricingProcedure RangeAttributePricingMatrix RangeAttributePricingDataPack.json

Each DataPack contains a calculation procedure and a matrix that supports one of the three approaches to
attribute-based pricing.

© 2021 Vlocity LLC, a Salesforce


company 333
CME CPQ

The following sections provide details about calculation procedures for attribute-based pricing.

Testing Calculation Procedures and Calculation Matrices


To test the data you entered in your calculation matrices, go to the calculation procedure that calls it and
use the Simulate function as follows:

1. Navigate to the Vlocity Calculation Procedures tab, and find the calculation procedure that you installed
from the DataPack.
2. In the Vlocity Calculation Procedure Versions related list, click the latest calculation procedure
version.
3. In the Vlocity Calculation Procedure Version Detail, click Simulate.
4. Enter sample data for each variable, and then click Simulate All Steps.

Understanding Calculation Procedures for Attribute-Based Pricing


The attribute-based pricing calculation procedures look up data from their calculation matrices. These
calculation procedures are invoked by the PricingPlanHelper Apex class. In order for the output to be
returned correctly, the procedures must have the following variables defined.

Variable Name Data Type Description


REC_MNTH_STD_PRC Currency Pricing variable code that maps to vlocity_cmt__RecurringCharge__c field
OT_STD_PRC Currency Pricing variable code that maps to vlocity_cmt__OneTimeCharge__c field
USAGE_STD_PRC Currency Pricing Variable that maps to vlocity_cmt__UnitPrice__c field.
UOM Text Pricing variable that maps the unit of measure to
vlocity_cmt__UsageMeasurementId__c field.

NOTE
There is no need to set Apex pre-processor and post-processor classes previously used
for attribute-based pricing.

When you implement source-target attribute-based pricing, the Matrix Lookup calculation step for the
Target Product Name must have the Include in Calculation Output flag checked in addition to the
monthly recurring charge (MRC) and non-recurring charge (NRC) outputs. The pricing plan service uses
the Target Product Name and any path parameters that are specified to determine the products to apply
the MRC and NRC prices.

© 2021 Vlocity LLC, a Salesforce


company 334
CME CPQ

Figure 32. Target Product Name needs Include In Calculation Output flag checked

To include usage-based pricing in pricing calculations, you must configure two additional calculation steps
for Unit of Measurement (UOM) and Unit Price (UP) and check the Include in Calculation Output flag.
See Declarative Calculation Procedures for configuring calculation steps.

© 2021 Vlocity LLC, a Salesforce


company 335
CME CPQ

Next, see Setting Up a Custom Pricing Step for Attribute-Based Pricing to create a new step in the Default
Pricing Plan.

Setting Up Attribute-Based Pricing with Time Plan and Time Policy


Time Plan Attribute-Based Pricing supports output columns for Time Plan and Time Policy. In accordance
with Time Plan and Time Policy, you can create adjustment records with Source = 'ABP'.

To add the Time Plan and Time Policy columns to Time Plan Attribute-Based Pricing:

1. Click the + tab.


2. Click Pricing Plans.
3. Click Default Pricing Plan.
4. In the Pricing Plan Steps section, add a flag named CreateAdjustment in the parameters for your
Attribute-Based Pricing and set the flag to True.

© 2021 Vlocity LLC, a Salesforce


company 336
CME CPQ

The JSON is:


{"ProcedureName":"TimePlanAttributeBasedProcedure",
"MatrixName":"TimePlanAttributeBasedMatrix", "RangeFields":"Quantity",
"CreateAdjustment":"true"}
5. Ensure you see MRC, NRC, Time Plan, and Time Policy in your matrix output columns.

In the Calculation Matrix, output columns consist of Time Plan and Time Policy, along with MRC and
NRC. Ideally, your matrix can contain all combinations of the attributes values.

© 2021 Vlocity LLC, a Salesforce


company 337
CME CPQ

6. View the line items created for Pricing Adjustments that are matched in the Attribute-Based Pricing.
The Source column indicates ABP.

Setting Up a Custom Pricing Step for Attribute-Based Pricing


After you implement the Apex classes, calculation procedures, and matrices included in the Attribute/
Volume Based Pricing DataPack, create a new step in the Default Pricing Plan as follows:

1. Go to Vlocity Product Console.


2. In the Dashboard in the Pricing area, click the search icon next to Pricing Plan, and press Enter. The
Default Pricing Plan is displayed.
3. Click on the Default Pricing Plan, and then click Pricing Plan Steps in the sidebar.
4. Click New Item.
5. Enter the following information.

Property Value Notes


Name Calculate Attribute Based Pricing If you create multiple steps for each type of attribute-based pricing,
change the Name to reflect each type.
Description Custom pricing step
Implementation CustomPricingPlanStepImpl The Apex class included in the Attribute/Volume Based Pricing
Name DataPack
Method Name GetMatrixPrice The method in CustomPricingPlanStepImpl.cls
Sequence [0-9] Must be less than 10 All attribute-based pricing steps must occur
before the Initialize Pricing Context step.
Active Click to select The Active flag is honored by the Pricing Plan Service, so you can
use this flag during testing to turn steps on or off.
Parameters Click the pencil icon and follow the These parameters are passed to CustomPricingPlanStepImpl.cls.
instructions below.

© 2021 Vlocity LLC, a Salesforce


company 338
CME CPQ

Creating Pricing Plan Step Parameters


If you do not see the parameters field, confirm that your deployment is on the Summer '18 or later release
of Vlocity Communications, Media, and Energy. If it is, then you must complete the post-install steps. For
more information, see Confirming Summer '18Attribute-Based Pricing Post Install StepsAttribute-Based
Pricing

In the Parameters dialog, enter as many parameters as needed. To get started, click the plus icon.

The table below lists the parameters that are used in the calculation procedures and matrices that are
supplied as part of the Attribute/Volume Based Pricing DataPack.

First Box Second Box Notes


ProcedureName Enter the name If you have imported the Attribute/Volume Based Pricing DataPack, enter the
of the appropriate calculation procedure from the list below:
calculation
procedure • AttributePricingProcedure
• SourceTargetAttributePricingProcedure
• RangeAttributePricingProcedure
MatrixName Enter the name If you have imported the Attribute/Volume Based Pricing DataPack, enter the
of the appropriate calculation matrix from the list below:
calculation
matrix • AttributePricingMatrix
• SourceTargetAttributePricingMatrix
• RangeAttributePricingMatrix
UseDisplayTextForValues false (Optional) The default behavior is for PricingPlanHelper.cls to evaluate
attribute display labels when looking for a match. You can change this
behavior using the UseDisplayTextForValues parameter. To use attribute
picklist item's values rather than display labels, set this to false.

© 2021 Vlocity LLC, a Salesforce


company 339
CME CPQ

Additional Pricing Plan Step Parameters


The following table lists additional parameters that are supported for source-target or range attribute-based
pricing.

First Box Second Box Notes


Path1 [Root<Parent1<Parent2...<Product] Create as many paths as needed to specify the context
in which you want the child product in a bundle to be
priced. See the example below.
RangeFields [API field names on Order Product, Quote Product Range fields must be of data type Number. Multiple
or Opportunity Product] values must be separated by semi-colons.
RangeAttributes [Product attribute names] Separate multiple values using semi-colons.

Selecting Target Products Within a Bundle Using Target Path


If you want to price a product differently based upon the bundle it is in, pass the target product and path
using a parameter in the pricing plan step. The target path must be formatted as follows:

[root product name]<[parent1 product name]<[parent2 product name][...]<[product


name]

For example,

Back to School Student Offer<Home Internet Solution<DSL Service

© 2021 Vlocity LLC, a Salesforce


company 340
CME CPQ

You can have multiple path parameters. Each path named in the first box in the parameter dialog must be
listed in your SourceTargetAttributePricingMatrix in the Target Product Name column for the appropriate
product configuration. For more information on how to enter this data in your matrix, see Source Target
Attribute-Based Pricing.

Range Parameters
To use range attribute pricing, create RangeFields and RangeAttributes parameters as shown below.
Multiple fields and attributes must be separated by semi-colons. The corresponding fields and attributes
listed must match those in your calculation matrix.

© 2021 Vlocity LLC, a Salesforce


company 341
CME CPQ

Next Step
After you create your custom pricing plan step, see attribute based pricing in action: Attribute Based Pricing
at Runtime.

Testing Attribute-Based Pricing at Runtime


To test attribute-based pricing, create an order and add a product to the cart that is listed in your calculation
matrix. Set the attributes (or fields, if you have implemented range attribute-based pricing) as needed to
trigger the attribute-based pricing.

After the change to the line item is saved, click the price details icon on the recurring charge or the one time
total.

Figure 33. Price Details icon

In the Details dialog box, the name of the calculation procedure that was used to price the line item is
displayed.

© 2021 Vlocity LLC, a Salesforce


company 342
CME CPQ

Figure 34. Pricing Details dialog box

Pricing Plan
Using a pricing plan, Vlocity Communications, Media, and Energy supports different pricing calculations
and storage for different line items.

For example, some devices, premium support, and installation may have different price calculation
methods. A pricing plan can calculate tier-based costs, promotion discounts, agent discounts, taxes, and
more.

A pricing plan can combine a series of pricing flows and perform calculations in a specific sequence. A
pricing plan supports line-level calculations and rollups. For example, if the total cost of the order is greater
than $100, then installation is 50% off. After the line items are added and the 50% taken off of the price,
Vlocity Communications, Media, and Energy can perform a second rollup.

NOTE
A pricing plan must use the PricingPlanService interface implementation in the Pricing
Interface.

© 2021 Vlocity LLC, a Salesforce


company 343
CME CPQ

Each pricing plan step can call processes to perform the necessary calculations. Steps usually call
functions. When you call the step, you must define some input parameters, such as the current line item
and current order. Each step depends on the previous step. Steps cannot run in parallel.

When you create a pricing plan, you provide the following:

• General Properties
• Pricing Plan Steps

A pricing plan includes the following properties:

• Pricing Plan Name


• Code
• Description
• Active
• Effective start and end dates

You can:

• Create, update, delete, search, and view a pricing plan.


• Create, update, delete, and view pricing plan steps.
• Sequence pricing plan steps.
• Define pricing plan step functions and input parameters.
• Create products that use a pricing plan.
• Export a pricing plan in a DataPack.
• Import a pricing plan in a DataPack.

Calculating Taxes Using a Pricing Plan


Using a pricing plan, you can calculate taxes for a specific product and for the cart total. Pricing variables in
steps enable adding and rollups in calculations. You could specify a tax on one or more products that must
be added to the appropriate line item cost and rolled up, or that tax is calculated per line item and rolled up.

For example, there is a standard monthly recurring cost (MRC_STD) and a standard nonrecurring cost
(NRC_STD). Tax is calculated on the original, or base, price. Variables can contain the standard tax to add
(MRC_STD_TAX_ADD) and the price after tax (MRC_STD_TAX_AMT).

• MRC_STD_TAX_AMT = MRC_STD * <tax>


• MRC_STD_TAX_ADD = MRC_STD + MRC_STD_TAX_AMT

Similar variables can exist for nonrecurring charges as well. Rollup variables contain the pre-tax and post-
tax rollup values. To calculate the tax, the step calls a function.

NOTE
Tax calculation is complex. Vlocity recommends that customers consider using a third-
party application that integrates with pricing.

© 2021 Vlocity LLC, a Salesforce


company 344
CME CPQ

Applying Discounts Using a Pricing Plan


At this time, when discounts apply, Vlocity Communications, Media, and Energy calculates them in parallel.
For example, there are multiple discounts applied to one product of 50%, 40%, and 10%. Currently, all
discounts apply in parallel, so the product price becomes $0.00. However, if the discounts applied serially,
the product price becomes 27% of the original price.

Using Pricing Plans for Attribute-Based Pricing


Another important way to use a pricing plan is to price products based on their attributes. For more
information, see Attribute-Based Pricing.

Default Pricing Plan


Vlocity provides one default pricing plan, which contains 9 steps. You can rearrange the steps and add new
steps to provide additional logic to your pricing plan.

Table 42. Default Pricing Plan Sequence


Sequence Name Description Parameters
10 Initialize Pricing Initializes a pricing plan context map that includes information that subsequent Enabling
Context steps need. Each step can set or retrieve objects from the context map. Base Pricing
Information in the map includes the line items being priced, the cart header Adjustments
object, the list of associated line adjustment records and promotion item
records, and maps that enable efficient hierarchy information processing.
20 Load Price List Queries the price list entries associated with the cart products and price list.
Entries Calls the tightest match service to determine the matching recurring and one-
time charges for a product.
30 Initialize Pricing After the service finds the tightest price list entries, the plan applies the
Variables charges to the recurring and non-recurring pricing variables associated with
each line item in the cart being priced.
40 Apply Offer Applies any offer-defined overrides and adjustments that the plan loaded in the
Adjustments Initialize Pricing Context step. The plan applies overrides first, before any
adjustments that adjust the pricing variables associated with them.
50 Apply Applies any promotion-defined overrides and adjustments loaded in the
Promotion Initialize Pricing Context step. The plan applies overrides first, before any
Adjustments adjustments that adjust the pricing variables associated with them.
60 Apply Charge Applies any manual overrides or adjustments loaded in the Initialize Pricing
Manual Context step.
Adjustments
70 Calculate Calculates line-level totals and rollup pricing variables. The calculation starts
Rollups from the child item items and moves up the hierarchy tree because the parent
rollups are dependent on their children pricing variable totals. This step calls
the DefaultPricingVariableCalcImplementation, which contains the pricing
formula for calculating the line-level pricing variable totals.
80 Save Line Items Saves the line items to the database.
90 Apply Parent Calculates and saves any parent object-level pricing variables. Parent objects
Variables include Opportunity, Order, and Quote.

Setting Up the Default Pricing Plan


To set up the default pricing plan, you need to:

© 2021 Vlocity LLC, a Salesforce


company 345
CME CPQ

1. Define the DefaultPricingPlan custom setting.


2. Run the INSTALL DEFAULT PRICING PLAN DATA administration job.

Defining the DefaultPricingPlan custom setting


You define the default pricing plan using the DefaultPricingPlan custom setting. Each product in the
Vlocity Shared Catalog contains a field to specify which pricing plan it uses. If a pricing plan is not specified,
then Vlocity Communications, Media, and Energy will use the pricing plan named in this custom setting.

This custom setting is usually created during installation. However, if your implementation has been
upgraded from an earlier version of Vlocity Communications, Media, and Energy, you may need to create
this custom setting manually. Use the steps below to create the custom setting.

1. Go to Vlocity CMT Administration.


2. Under Custom Settings, click CPQ Configuration Setup.
3. Search the list of existing custom settings for DefaultPricingPlan.
4. If the custom setting does not exist, then clear the search dialog and click Add.
5. In the red boxes, enter the following:
a. In the first box, enter the name of the custom setting, which is DefaultPricingPlan.
b. In the second box, enter the Code of the pricing plan that you want to use as the default. If you are
using the default pricing plan provided by Vlocity, the code is DEFAULT_PRICING_PLAN.

Run the INSTALL DEFAULT PRICING PLAN DATA administration job


To install the default pricing plan provided by Vlocity, simply run the INSTALL DEFAULT PRICING PLAN
DATA administration job. This job is usually run as part of the installation process or during an upgrade.
However, if the job was not run or if you wish to restore the default pricing plan, then follow the steps below.

1. Go to Vlocity CMT Administration.


2. Under Admin Console, click EPC Jobs.
3. Next to INSTALL DEFAULT PRICING PLAN DATA, click Install.
4. Follow the remaining steps of the import process to install the default pricing plan data.

Creating a Pricing Plan and Pricing Steps


You create a pricing plan in the Vlocity Product Console.

To create a pricing plan:

1. Go to the Vlocity Product Console.


2. In the Pricing area, next to Pricing Plan, click the plus sign (+).
The New Pricing Plan tab opens.
3. Enter the following information:
• The Pricing Plan Name is the name of the pricing plan.
• The Pricing Plan Code is a unique code to identify the pricing plan.

© 2021 Vlocity LLC, a Salesforce


company 346
CME CPQ

NOTE
Pricing plan codes are not case sensitive. For example, Cullen_Plan is the same as
CULLEN_PLAN or cullen_plan. Pricing plan codes must be unique. You cannot
create two plans that use the same code.

• The Description describes the pricing plan's purpose.


• Select Active to activate the pricing plan.
• In the Effective From boxes, enter the calendar date and time from which the pricing plan is
effective.
• In the Effective Until boxes, enter the calendar date and time at which the pricing plan is no longer
effective.
4. Click Save.

After you click Save, the Pricing Plan Steps tab becomes available.

Creating Pricing Plan Steps


A pricing plan consists of steps with dependencies. Each step is a process, function, or procedure. When
the steps are called, input parameters send the necessary information. The logic in the step computes the
results.

You put pricing plan steps in sequence to define the entire pricing plan. Each step defines what happens in
that step. Usually, steps call functions. Vlocity provides some functions, but you can extend and add new
steps and new functions.

At this time, there are no loops available in pricing plans. Also, conditional steps are not supported. If you
need conditional steps, you must include them inside a step in a function call.

You cannot reuse steps across pricing plans.

A pricing plan step includes the following properties:

• Name
• Description
• Implementation Name
• Method Name
• Sequence
• Active

Importing and Exporting DataPacks


You can import and export pricing plans using DataPacks. You can use DataPacks to move pricing plans
from one org to another.

© 2021 Vlocity LLC, a Salesforce


company 347
CME CPQ

Pricing Service Implementations


Using a Pricing Plan is recommended, but Pricing service implementations are supported for backward
compatibility. The Pricing Interface includes two implementations based on pricing elements (as opposed to
price books): PricingElementServiceImplementation and PricingPlanService.

See:

• PricingElementServiceImplementation
• PricingPlanService

PricingElementServiceImplementation is functionally the same as PricingPlanService, but


PricingPlanService has exposed the pricing process as a series of modular steps that can be configured
using pricing plans in Vlocity Product Console.

Table 43. Fields Used by PricingElementServiceImplementation and


PricingPlanService
Field API Name Description Pricing Variable
One Time vlocity_cmt__OneTimeCharge__c Holds the final calculated non-recurring OT_STD_PRC
Charge charge after adjustments. Changes
according to overrides and adjustments.
One Time vlocity_cmt__OneTimeManualDiscount__c Holds the value of a manually entered OT_STD_PRC_DISC_PCT_MAN
Manual discount percent applied against the One
Discount Time Charge. This field does not appear in
the CPQ user interface, so the value should
be 0.0.
One Time vlocity_cmt__OneTimeCalculatedPrice__c Holds the value of the One Time Charge OT_STD_PRC_CALC
Calculated discounted by the One Time Manual
Price Discount, if present.

OT_STD_PRC_CALC = OT_STD_PRC -
(OT_STD_PRC *
OT_STD_PRC_DISC_PCT_MAN / 100)
One Time vlocity_cmt__OneTimeTotal__c Holds the total non-recurring charge, OT_STD_PRC_TOTAL
Total including rollups of the children One Time
Totals, multiplied by the line's quantity.

OT_STD_PRC_TOTAL =
(OT_STD_PRC_CALC +
ROLLUP_OT_STD_PRC_TOTAL) *
LINE_QUANTITY

ROLLUP_OT_STD_PRC_TOTAL is not
bound to any field. It is calculated in
memory.
Effective vlocity_cmt__EffectiveOneTimeTotal__c Calculated only for the root. The value is the EFF_OT_STD_PRC_TOTAL
One Time same as the OT_STD_PRC_TOTAL of the
Total root item. For items that are not root items,
this field value is 0.0. The field participates
in the rollup summary field in the header—
Effective Total: One Time Charges.
Recurring vlocity_cmt__RecurringCharge__c Holds the final calculated monthly recurring REC_MNTH_STD_PRC
Charge charge after adjustments. Changed based
on overrides and adjustments.

© 2021 Vlocity LLC, a Salesforce


company 348
CME CPQ

Field API Name Description Pricing Variable


Recurring vlocity_cmt__RecurringManualDiscount__c Holds the value of a manually entered REC_MNTH_STD_PRC_DISC_PCT_MAN
Manual discount percent to be applied against the
Discount Recurring Charge. This field does not
appear in the CPQ user interface, so the
value should be 0.0.
Recurring vlocity_cmt__RecurringCalculatedPrice__c Holds the value of the Recurring Charge REC_MNTH_STD_PRC_CALC
Calculated discounted by the Recurring Manual
Price Discount, if present.

REC_MNTH_STD_PRC_CALC =
REC_MNTH_STD_PRC -
(REC_MNTH_STD_PRC *
REC_MNTH_STD_PRC_DISC_PCT_MAN /
100)
Recurring vlocity_cmt__RecurringTotal__c Holds the monthly recurring charge, REC_MNTH_STD_PRC_TOTAL
Total including rollups of the children monthly
recurring totals and multiplied by the line's
quality.

REC_MNTH_STD_PRC_TOTAL =
(REC_MNTH_STD_PRC_CALC +
ROLLUP_REC_MNTH_STD_PRC_TOTAL)
* LINE_QUANTITY

REC_MNTH_STD_PRC_TOTAL is not
bound to any field. It is calculated in
memory.
Effective vlocity_cmt__EffectiveRecurringTotal__c Calculated only for the root. The value is the EFF_REC_MNTH_STD_PRC_TOTAL
Recurring same as the
Total REC_MNTH_STD_PRC_TOTAL of the root
item. For items that are not root items, this
field value is 0.0. The field participates in
the rollup summary field in the header—
Effective Total: Monthly Charges.
Quantity Quantity Line item quantity. LINE_QUALITY
Effective vlocity_cmt__EffectiveQuantity__c The effective line item quantity. For items EFFECTIVE_QUANTITY
Quantity that aren't root items, the calculation is
EFFECTIVE_QUANTITY =
parentItemEffectiveQty * LINE_QUANTITY.

For root items, the calculation is


EFFECTIVE_QUANTITY =
LINE_QUANTITY.

Base Pricing Adjustments


Vlocity records the base price for every line item in the pricing log. The pricing log is a JSON field on the
line item object that enables the pricing waterfall in the Price Details in Vlocity Cart. Although the pricing
log is efficient for Vlocity Cart's operations, it is not recommended for configurations or services that need to
evaluate past pricing history.

Instead, the adjustments records for Orders (Order Pricing), Opportunities (Opportunity Pricing), Quotes
(Quote Pricing), and Assets (Account Pricing) should be used. Adjustment records are the source of
truth and can be used to reconstruct the pricing history. By default, adjustment records do not record the
base or starting price. However, you may need base pricing information for downstream systems or for

© 2021 Vlocity LLC, a Salesforce


company 349
CME CPQ

reporting. If so, it can be enabled at runtime in Vlocity Cart and in repricing batch jobs using the
CreateBaseAdjustment parameter.

Using the CreateBaseAdjustment parameter increases the number of adjustment records, which will
impact storage requirements and performance. It is not necessary for most deployments.

NOTE
In order to use base pricing adjustments, the PricingPlanService implementation must be
the active implementation for the PricingInterface.

Using the CreateBaseAdjustment Parameter


You can enable the CreateBaseAdjustment parameter in your pricing plans. When you set this parameter
to True, base prices are written to the adjustment records as shown below.

With some pricing models, you can have multiple effective price list entries. You may have price list entries
with time plans and time policies that will change the price after a defined time interval has passed. Using
the CreateBaseAdjustment parameter, each of these price list entries are recorded as base prices, but
you can distinguish them using the sequence and estimated start and end dates.

Note that at runtime in Vlocity Cart, the Price Details window only displays the applied base price based on
the current date, which in this example is the $149.99 One Time Std Price.

© 2021 Vlocity LLC, a Salesforce


company 350
CME CPQ

In this example, the other base price, $99.99, is written to the adjustment records, but will not display in the
Price Details window.

Enabling Base Pricing Adjustments


In order to use base pricing adjustments, the PricingPlanService implementation must be the active
implementation for the PricingInterface. To enable base pricing adjustments record base prices for Orders,
Opportunities and Quotes in Vlocity Cart, you must set the CreateBaseAdjustments parameter on the
Initialize Pricing Context step of your pricing plan.

NOTE
The Base Pricing Adjustments feature is available starting in the Fall '18 release.

To set the CreateBaseAdjustments parameter on the Initialize Pricing Context step of your pricing plan:

1. In Vlocity Product Console, find the Default Pricing Plan, or the pricing plan that you want to use to
record base prices.
2. Click the Pricing Plan Steps facet.
3. Click Initialize Pricing Context. The General Properties window appears.

© 2021 Vlocity LLC, a Salesforce


company 351
CME CPQ

4. Click the Edit icon next to Parameters.


5. Click the Plus icon to create a new parameter.
6. In the first box, enter CreateBaseAdjustments, and in the second box, enter True.

1. Click Done.
2. Click Save.

Enabling Base Pricing Adjustments in Repricing


If you have existing orders, opportunities, quotes, or assets that need base pricing adjustment records, you
can run the repricing service with the CreateBaseAdjustment parameter set to True in batch, and the
repricing service will use the pricing log to create new base pricing adjustment records for you.

The Base Pricing Adjustments feature is available starting in the Fall '18 release.

To use base pricing adjustments, the PricingPlanService implementation must be the active
implementation for the PricingInterface.

You cannot use the CreateBaseAdjustment parameter to reprice orders, opportunities, or quotes that
have been imported from an external system since they will not have pricing logs.

Using the CreateBaseAdjustment parameter in Repricing


To enable base pricing adjustments in repricing, pass the CreateBaseAdjustments = true flag through the
input map of the batch processor. For example, the code below invokes the repricing service with
CreateBaseAdjustments enabled for an order and its line items. The order and order item IDs should be
replaced with the correct IDs for your deployment.

© 2021 Vlocity LLC, a Salesforce


company 352
CME CPQ

Map<String, Object> input = new Map<String, Object>();


// Set the CreateBaseAdjustments flag
input.put('CreateBaseAdjustments', true);
// Object being repriced: Order/Account/Opportunity/Quote
input.put('repriceBy', 'Order');
// Object row Id: Order Id, Account Id, Opportunity Id, Quote Id
input.put('objectId', '8011I000000dHQo');
// rootItemIds are nothing but root line items or asset Id of the root in a
bundle present in Order/Account/Opportunity/Quote
input.put('rootLineItemIds', new List<Id>{'8021I000001s5saQAA'});
input.put('repriceProvidedLineItemsOnly', false);
RepricingBatchProcessor repricingBatchJob = new RepricingBatchProcessor(input);
ID batchprocessid = Database.executeBatch(repricingBatchJob,1);

Alternatively, the repricing service can also be invoked using anonymous Apex in the Salesforce Developer
Console using the code below. The order ID should be replaced with the correct ID for your deployment.

List<Order> a = [SELECT Id FROM Order WHERE Id='8011I000000dHQo'];


Map<String,Object> repricingInput = new Map<String,Object>{'objectList' =>
a,'CreateBaseAdjustments' => true, 'GenerateAllPrices' => true};
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);

Repricing Existing Prices


The Vlocity CPQ automatic repricing feature gives you the ability to reprice products based on competition,
supply and demand, market value, and consumer interest. 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, such as 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 they still apply based
on the effectivity dates of the price list entry for the product or applied promotion.

Rules are rerun to ensure that the line items still meet the criteria for any context rules applied to the price
list entry. Context rules for products or promotions are not rerun. Only context rules for price list entries are
rerun. Rules for any manual adjustments can also be rerun to ensure 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 yield no change when repricing is run.

Setting Up the Interface Implementations


Two implementation types are available in the RepricingInterface:

• DefaultRepricingImplementation: Does not make any changes to the existing prices.

© 2021 Vlocity LLC, a Salesforce


company 353
CME CPQ

• RepricingElementServiceImplementation: Reprices 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 interface implementation to RepricingElementServiceImplementation:

1. Navigate to the Interface Implementations tab.


2. Change the List Views to All.
3. Click RepricingInterface.
4. Using the dropdown menu for RepricingElementServiceImplementation, click Edit.
5. Check the Active checkbox and click Save.

Repricing Example
Assuming changes in market conditions, you can lower the price of a product starting on a certain date and
make this new price available to any orders that are still pending and have not been submitted for
fulfillment.

© 2021 Vlocity LLC, a Salesforce


company 354
CME CPQ

To accomplish this, create a new price list entry and set the end date of the existing price list entry. Once
the price list entries are created and updated, run the repricing service to reflect the new pricing on existing
orders to ensure customers can take advantage of this new pricing:

© 2021 Vlocity LLC, a Salesforce


company 355
CME CPQ

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, press the return or enter key to display the list of products.
4. Click a product, such as 4G LTE Data Plan.
5. Click the Pricing facet.
6. Click New to create a new price list entry.
7. Enter the following data for the Price List Entry fields:
• Price List: B2C Price List
• Display Text: $24.9
• Base Price: Activate
• Charge Type: Recurring
• Frequency: Monthly
• Sub-Type: Standard
• Type: Price
8. Click Search and select Recurring Monthly Std Price.
9. Select $24.99 RM for the Pricing Element.
10. For Effective From, select today’s date, and click the Active checkbox.
11. Click Save. A warning may indicate that you currently have two price list entries that overlap.
12. Navigate to the Orders tab.
13. Change the List Views to All Orders.
14. Select the Adv Pricing Data Plan Order.
15. In Actions, click Configure to invoke the Vlocity Cart.
16. Notice the Recurring Charge is $34.99.
17. Navigate to the Setup icon and select Developer Console.

18. From the Developer Console, click Debug > Open Execute Anonymous Window.
19. The following Apex code will be used to reprice orders. Copy this code and paste it in the Enter Apex
Code box from the Developer Console.

© 2021 Vlocity LLC, a Salesforce


company 356
CME CPQ

List<Order> a = [SELECT Id FROM Order WHERE Status = 'Draft' AND


EffectiveDate > 2018 - 01 - 19];
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);

Once invoked, the Apex code reprices all orders with an order status of Draft, and with the effective
date you selected. For sample Apex code, refer to RepricingInterface.
20. Select the code and click Execute Highlighted.

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

Repricing an Asset to Reflect a Context Rule Condition for an Account


You can reprice an asset to reflect a context rule condition for an account:

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 a product name, for example, Blast!, and click the search
icon.
4. Select the Blast! Pro Internet product and click the Pricing facet.
5. Notice the pricing for both price list entries. For example, there may be a $20 RM price list with a
context rule attached to the price list entry giving Platinum account customers a reduced price on the
product.
6. Navigate to the Accounts tab.
7. Change the List Views to All Accounts.

© 2021 Vlocity LLC, a Salesforce


company 357
CME CPQ

8. Select an account, for example, Acme.


9. Click the DETAILS tab and notice how the SLA is set, for example, to Platinum.
10. From the Lightning App Launcher, select Assets to open in a new tab.
11. Change the List Views to All Assets.
12. Select your product, for example, Blast! Pro Internet for Acme.
13. On the DETAILS tab, notice the Recurring Charge for the asset is, for example, $20 according to the
context rule for platinum accounts.
14. Navigate back to the open browser tab for Acme.
15. Click the Edit icon to change the SLA to, for example, Gold.
16. Click Save.
17. From the URL, copy the Account ID from after the Account/ and before /view and paste it to a text
editor. You need this ID for the Apex code for repricing accounts.
For example:
Secure | https://na57.lightning.force.com/lightning/r/Account/
0010b00002BZo10AAD/view
18. Navigate to the Setup icon and select Developer Console.
19. From the Developer Console, click Debug > Open Execute Anonymous Window.
20. Copy the following Apex code and paste it in the Enter Apex Code box from the Developer Console.

List a = [SELECT Id FROM Account WHERE Id = '0011I00000DBYUK'];


Map repricingInput = new Map {'objectList' > a};
Map repricingOutput = new Map();
Map repricingOptions = new Map();
vlocity_cmt.VOIInvoker voi = vlocity_cmt.VOIInvoker.getInstance();
voi.invoke('Repricing', 'repriceLineItems', repricingInput,
repricingOutput, repricingOptions);
21. In line 1, replace the Account ID currently in the code with the Account ID copied from the customer's
account.
22. Select the code and click Execute Highlighted.
23. Verify the status is successful in the logs.
24. Navigate back to the open Asset browser tab.
25. Refresh the browser page.
26. Notice the recurring charge for the asset has changed, for example, to $25 according to the price list
entry for all customers other than Platinum.

Repricing Best Practices


• Reprice in batches with input parameters, such a batch size, or reprice the provided line items only.
Repricing large updates in real-time could cause performance degradation if the repricing is not run
through a batch job.
• When using the repricing service in a batch job or through API integration, limit the objectList by 20
lineItems.
• When invoking the repricing service, make sure the results of the query are sorted by OrderId, QuoteId,
OpportunityId, or AccountId.

© 2021 Vlocity LLC, a Salesforce


company 358
CME CPQ

Using Repricing APIs


The Repricing API is an implementation of VlocityOpenInterface. Using this service, you can reprice
OrderItem, QuoteLineItem, OpportunityLineItem, applied promotions, Offer adjustments, or overrides using
multiple price list entries attached to a product or promotion and context rules based on the behavior (to
reprice or not to reprice when this service is run) needed.

The customer needs to create a scheduler based on the requirements. The scheduler triggers the Repricing
API.

Input Parameter Name Required Type Input Range Description


Map<String,Object>input objectList Yes List<SObject>; <Order, Quote, List of
Opportunity, sObjects for
Account, Asset, repricing
QuoteLineItem,
OpportunityLineItem,
OrderItem>
Map<String,Object> repriceProvidedLineItemsOnly No Boolean <true, false> Set to true if
input line items
passed in
the
ObjectList
should be
repriced
without
repricing
the whole
bundle.

Output Parameter Name Required Type Input Range Description


Map<String,Object>output N/A N/A N/A N/A No output fields are provided in the output
object.

Invoking the Repricing API

• To reprice all the line items for a particular Order, Quote, or Opportunity, replace the ID with the
appropriate Order, Quote, or Opportunity ID whose line items need to be repriced. This is highly
recommended for bulk repricing.

List<Order/Quote/Opportunity> a = [SELECT Id FROM Order/Quote/Opportunity];


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);
• To reprice OrderItems, QuoteLineItems, or OpportunityLineItems, replace the following query with a more
suitable query based on the requirements, for example, reprice all lineItems created after 1/1/2019.

© 2021 Vlocity LLC, a Salesforce


company 359
CME CPQ

List<OrderItem/OpportunityLineItem/QuoteLineItem> a = [SELECT
Id,RootItemId__c From OrderItem/OpportunityLineItem/QuoteLineItem];
Map<String,Object> repricingInput = new Map<String,Object>{'objectList' =>
codea};
repricingInput.put('repriceProvidedLineItemsOnly', false);
// mark it true to reprice only provided itemId, else the whole bundle
associated with this ItemId needs to get repriced
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);
• To reprice assets, replace the query for assets with a more suitable query based on the requirements, for
example, reprice all assets created after 1/1/2019:

List<Asset> a = [SELECT Id,RootItemId__c From Asset];


Map<String,Object> repricingInput = new Map<String,Object>{'objectList' =>;
a};
repricingInput.put('repriceProvidedLineItemsOnly', false);
// mark it true to reprice only provided itemId, else the whole bundle
associated with this ItemId needs to get repriced
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);
• To reprice a particular account, replace the ID with the appropriate account ID whose assets need to be
repriced. This is highly recommended for bulk repricing.

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);
• To reprice a particular account, Order, Quote, or Opportunity using filters:

Map<String, Object> input = new Map<String, Object>();


//here by can be Order/Account/Opportunity/Quote
input.put('repriceBy', 'Order');
//here objectId can be orderId,AcountId,OpptyId,QuoteId
input.put('objectId', '8011I000000dHQo');
//rootItemIds are nothing but root line items or asset Id of the root in a
bundle present in Order/Account/Opportunity/Quote

© 2021 Vlocity LLC, a Salesforce


company 360
CME CPQ

input.put('rootLineItemIds', new List<Id>{'8021I000001s5saQAA'});


input.put('repriceProvidedLineItemsOnly', false);
RepricingBatchProcessor repricingBatchJob = new
RepricingBatchProcessor(input);
ID batchprocessid = Database.executeBatch(repricingBatchJob,1);

This is the preferred way of repricing lineItems to avoid hitting SOQL limits. Use less than 10 rootItemIds
at a time.

Invoking the Repricing Batch Processor


The repricing API works with assets and orderItems. You can replace a batch job with customer
requirements based on how you want to reprice. For example, you may want to restrict repricing only for
certain Accounts, Orders, Quotes, Opportunities, or lineItems based on certain conditions, such as repriced
orders only created during 1st JAN 2018 to 10th JAN 2018.

For example:

• To Reprice all OrderItems by orders:

vlocity_cmt.RepricingBatchProcessor repricingBatchJob = new


vlocity_cmt.RepricingBatchProcessor(Order);
ID batchprocessid = Database.executeBatch(repricingBatchJob,1);
• To reprice all assets by account:

vlocity_cmt.RepricingBatchProcessor repricingBatchJob = new


vlocity_cmt.RepricingBatchProcessor('Account');
ID batchprocessid = Database.executeBatch(repricingBatchJob,1);

Loyalty Pricing
Customers can define loyalty credits as a form of payment for products. Loyalty credits enable customers to
use points or other customer loyalty awards to purchase products.

These features are available after you enable loyalty pricing:

© 2021 Vlocity LLC, a Salesforce


company 361
CME CPQ

• The One Time Loyalty pricing variable to set the one-time price type
• Pricing variables with pricing variable bindings to ensure the correct calculation of each line item in the
cart
• Additional columns for Vlocity Cart to display the one-time loyalty price and one-time loyalty total for each
line item
• The loyalty points total on the cart's total bar

Before you can create a price list entry for a product using loyalty points, you must create pricing elements
that use the One Time Loyalty pricing variable and the specific amounts you need in loyalty points. See
Creating Pricing Elements for Loyalty Point Charges.

You can manage loyalty points in Vlocity cart. For example, if a product is priced with a currency charge
and a loyalty points charge, you can determine which payment type to use in the cart. See Managing
Loyalty Pricing in the Cart.

Enable Loyalty Pricing


Customers can define loyalty credits as a form of payment for products. Loyalty credits enable customers to
use points or other customer loyalty awards to purchase products.

IMPORTANT
If you enable loyalty pricing after installing or upgrading Vlocity CME, you must run the
Field Maps Maintenance job and re-create any custom field mappings.

To use loyalty pricing:

1. Set the currency code and loyalty code for active price lists. You should have completed this step in the
post-upgrade process. For more information, see Setting Currency and Loyalty Codes.
2. Run the EPCPEUpdateCurrencyCode class to copy the currency code into pricing elements. For more
information, see Running the EPCPEUpdateCurrencyCode Class.
3. Enable loyalty pricing.

NOTE
If you disable loyalty pricing after enabling it, some line items in some orders may become
invalid. The best practice is to not disable loyalty pricing after it has been enabled.

To enable loyalty pricing:

© 2021 Vlocity LLC, a Salesforce


company 362
CME CPQ

1. On the Vlocity CMT Administration tab, click Enable Features.


2. To the right of Loyalty, click Enabled.

3. Run the Create Default Pricing Variables and Bindings job.


a. Go to the Vlocity CMT Administration tab.
b. Click EPC Jobs.
c. To create Default Pricing Variables and Bindings, click Start.

To get to the Vlocity CMT Administration tab, click App Launcher or All Tabs, and then click Vlocity CMT
Administration.

Managing Loyalty Pricing in the Cart


When a product with a one-time charge has a price assigned in both currency and loyalty points, both
pricing types appear in the products list of the cart. You can select the payment choice and change a line
item's payment type.

Payment Choice When Adding to the Cart


When you want to add a product to the cart with the charge showing in loyalty points:

1. In the Payment Choice menu, choose Loyalty.


2. Add the product. The charge shows in loyalty points.

© 2021 Vlocity LLC, a Salesforce


company 363
CME CPQ

To use currency for the payment choice when you add a product to the cart, choose Currency in the
Payment Choice menu.

Changing a Line Item's Payment Type


To change the payment type shown in the cart from loyalty points to currency or currency to loyalty points:

1. Click the One Time Charge or the One Time Loyalty price of the line item.
2. Click Payment Type .
3. In the Payment Choice dialog box, click the payment type you want to change the line item's charge
to.
4. Click Apply.

Creating Pricing Elements for Loyalty Point Charges


When you create price list entries for products that have charges in loyalty points, you must have existing
pricing elements that contain those charges.

To create a pricing element for a charge in loyalty points:

1. Navigate to the Product Console. For more information, see Navigating to the Vlocity Product Console.
2. Find and open the price list where you want to create the pricing element charge.
3. Click Standalone Pricing Elements.
4. Click New.
5. In the configuration panel in the Pricing Variable section, enter the search criteria to find the One Time
Loyalty pricing variable.
a. In Charge Type, choose One-time.
b. In Sub-Type, choose Standard.
c. In Type, Price.
6. Click Search.
7. In the search results under Select a Pricing Variable, choose the pricing variable created for
loyalty points, such as "One Time Loyalty".
8. Complete the General Properties section.
a. Name the pricing element. Make sure the name of the pricing element indicates as much
information about the price as possible, such as the amount and "loyalty points" or whatever name
you have for loyalty credits. For example, "2500 Loyalty Points".
b. Enter a unique code. This code identifies the individual pricing element.
c. In Display Text, enter the amount and your company's term for loyalty points.
9. Complete the Currency Value.
a. In Charge, enter the amount.
b. In Currency Code, choose the PTS.
10. Complete the Effectivity section.

© 2021 Vlocity LLC, a Salesforce


company 364
CME CPQ

a. Click in the Effective From field and select a date the pricing element is available for use.
b. Select Active to make the pricing element active and available for use.
11. Click Save.

The following tables explain the fields to complete for creating a pricing element charge for loyalty points.

Table 44. Pricing Variable Section


Field Description
Charge Type Charge type searches for the pricing variable designating a one-time charge. Select One-time.
Type Type searches for the pricing variable designating a price type. Choose Price.

Table 45. General Properties Section


Field Description
Name Include the amount and your company's term for loyalty points.
Code A unique code to identify the pricing element. Make sure there are no spaces or special characters. As best practice,
use uppercase.
Display Text Include the amount and your company's term for loyalty points.
Base Price Do not select base price when creating a pricing element charge.

Table 46. Currency Value Section


Field Description
Loyalty Amount Enter the amount of loyalty points.
Loyalty Code Choose PTS.

Table 47. Effectivity Section


Field Description
Effective The date and time the pricing element becomes available for use. When you choose the date, the system
From automatically populates the time with the current time. If the pricing element does not have a beginning effective date
that is current, you will not be able to use it and it will not appear in the search results for pricing elements when you
create a price list entry.
Effective The date and time the pricing element is no longer available for use. When you choose the date, the system adds the
Until current time. If you choose an Effective Until date, the pricing element will not be available after that date.
Active The status of the pricing element. If Active is selected, the pricing element will appear in the search results for pricing
elements when you create a price list entry.

Upgrading to Use Loyalty Pricing


To use loyalty pricing when you upgrade from Vlocity Communications, Media, and Energy Summer '17 to
Vlocity Communications, Media, and Energy Winter '18:

1. Set the currency code and loyalty code for active price lists. Make sure you completed this step in the
post-upgrade process. For more information, see Setting Currency and Loyalty Codes.

© 2021 Vlocity LLC, a Salesforce


company 365
CME CPQ

2. Run the EPCPEUpdateCurrencyCode class to copy the currency code into pricing elements. For more
information, see Running the EPCPEUpdateCurrencyCode Class.
3. Enable loyalty pricing. For more information, see Enable Loyalty Pricing.

Pricing Using PricingRulesImplementation


Vlocity Communications, Media, and Energy supports multiple pricing paradigms. Vlocity recommends
using the current paradigm, which assigns prices using price lists. However, you can also assign prices
using price books and the PricingRulesImplementation. This is the original pricing paradigm supported by
Vlocity Communications, Media, and Energy releases 15 and earlier, supported for backward compatibility.

In this paradigm, pricing steps are driven by a flow. Each step in the flow follows a natural language layout.
You can set filters and actions to apply a flow to orders.

• The flow drives the rule execution: Which rules do I execute for pricing?
• Rules execute multiple filters: Which order lines should be adjusted?
• The filters trigger pricing actions: How should I change the pricing?

Pricing rules perform the following process:

1. Get list prices.


2. Apply existing customer prices.
3. Apply discounts.
4. Apply taxes.
5. Save the pricing to the order.

A pricing specification in the definition of the product or service. Offers and product specifications have
charges. Charges can be a cost or a price, one-time, recurring, or usage-based. You can use simple pricing
or a pricing matrix. Discounts are alterations to prices. You can discount by a specific amount or by a
percentage. Alterations can apply to simple or matrix prices.

Pricing overrides can be incremental or absolute. Incremental overrides start with a base price and then
take an amount off of that price. Absolute overrides entirely override the base price. Overrides apply in the
context of an offer, an account, or a contract.

A contract can drive pricing. The contract contains customer-specific discounts for products. When that
customer orders those products, they see the prices that the frame contract specifies. Frame contracts
enable customer-specific pricing. A frame contract stores individual product and discount configurations.
For more information about contracts, see Contract Lifecycle Management Overview.

Pricing actions include:

• Calculation procedures
• Offering procedures
• Product relationships
• Entity filters

© 2021 Vlocity LLC, a Salesforce


company 366
CME CPQ

NOTE
You need not use the Vlocity pricing engine. You can use the pricing interface to call a
third-party pricing implementation. You need not use pricing rules to implement pricing
either.

Setting Up Pricing Matrices Using the PricingRulesImplementation


This topic is for deployments using the PricingRulesImplementation and/or Vlocity Communications, Media,
and Energy Releases 15 and earlier.

Attribute-based pricing requires a matrix. Within the matrix, the calculation can be simple or attribute-based.
A charge matrix is also a Vlocity calculations matrix. You define the pricing action in the product
specification. A pricing specification is the definition of the physical product.

A pricing matrix requires DataRaptor input and output bundles, a calculation matrix, and a calculation
procedure. You associate rules, entity filters, and flows with the pricing matrix.

You create a DataRaptor of the type Extract(JSON). The extract object must be a line item, such as
OpportunityLineItem, OrderItem, or QuoteLineItem. You must transform the DataRaptor data to match the
pricing matrix column headers.

Next, you create a DataRaptor of the type Load(JSON). This DataRaptor uses generated values from the
calculation procedure to input into the line item. For example, you could create a field named OneTimeTotal
that appears as a nonrecurring charge on the line item. In DataRaptor, use the picklist to select the
destination for the uploaded JSON values.

The following is a sample JSON input structure in which the ID equals the extracting object ID and the
UnitPrice (also called the calculated price) is equal to the result output.

Example: JSON Input Structure

{
"ID": null,
"UnitPrice": null
}

A pricing matrix uses a calculation matrix. The headers in the calculation matrix correspond to product
attribute values, for example, Speed and Brand. For more information about calculation matrices, see
Calculation Matrices.

Attaching a product to a price or price matrix binds the columns.

Create the pricing matrix before creating the pricing component. Connect the pricing matrix to the pricing
component and the pricing component to the product.

To set up a pricing matrix, you complete the following steps:

© 2021 Vlocity LLC, a Salesforce


company 367
CME CPQ

1. Create a DataRaptor of type Extract(JSON). For more information, see Create a Pricing Matrix
DataRaptor Extract(JSON).
2. Create a DataRaptor of type Load(JSON). For more information, see Create a Pricing Matrix
DataRaptor of Type Load(JSON).
3. Create a calculation matrix. For more information, see Creating a Calculation Matrix.
4. Create a declarative calculation procedure. For more information, see Create a Calculation Procedure
for a Pricing Matrix.
5. Create an entity filter. For more information, see Create an Entity Filter for a Pricing Matrix.
6. Create a pricing rule on a line item object. For more information, see Create a Rule for a Pricing Matrix.
7. Create a pricing rules flow. For more information, see Create a Pricing Rules Flow.
8. Activate the PricingRulesFlowmplementation. For more information, see Set an Implementation.
9. Add the pricing matrix custom settings.

Figure 35. Vlocity Calculation Matrix for a Pricing Matrix

© 2021 Vlocity LLC, a Salesforce


company 368
CME CPQ

Creating a Pricing Matrix DataRaptor Extract (JSON)


The first step in creating a pricing matrix is creating a DataRaptor of type Extract(JSON).

To create a DataRaptor for a pricing matrix:

1. From the Vlocity DataRaptor tab, click New.


2. In the Interface Name box, enter a name for the DataRaptor, such as
ExtractFromOrderItemAttribute.
3. In the Extract Object Order section, click Add.

4. Select one of the following items:


• OrderItem
• OpportunityLineItem
• QuoteLineItem
5. In the Extract JSON Output Path box, enter OrderItem.
6. From the Filter picklist, select Id.
7. Click Transform.

© 2021 Vlocity LLC, a Salesforce


company 369
CME CPQ

8. Click New Mapping.


9. From the Extract JSON Path picklist, select OrderItem:Id.
10. In the JSON Output Path box, enter ID.
11. Select Active.
12. Repeat steps 8 through 11 for the following:

Extract JSON Field Path Transform JSON Output Path


OrderItem:ListPrice Detail:OriginalPrice
OrderItem:Quantity Detail:Quantity
OrderItem:vlocity_cmt__JSONAttribute__c Detail:Item Attr

© 2021 Vlocity LLC, a Salesforce


company 370
CME CPQ

When you have finished creating this DataRaptor, create a DataRaptor of type Load(JSON). For more
information, see Create a Pricing Matrix DataRaptor Extract(JSON).

Creating a Pricing Matrix DataRaptor of Type Load(JSON)


The second step in creating a pricing matrix is creating a DataRaptor of type Load(JSON).The DataRaptor
uses generated values from the calculation procedure and puts it into the order item or other object. The
example in this topic uses the OneTimeTotal field with the nonrecurring charge value on the line item
object.

In the JSON input structure, ID is equal to the extract object ID and Unit Price, also known as the calculated
price, is equal to the result output in the calculation procedure.

Including the effective one time total field reflects the price in the summary header.

To create a pricing matrix DataRaptor of Type Load (JSON):

1. From the Vlocity DataRaptor tab, click New.


2. In the Interface Name box, enter SaveCalculationResult.
3. From the Interface Type list, select Load(JSON).
4. In the JSON field enter the following:

{
"ID": null,
"UnitPrice": null
}

In the Data Mappings table, ID and UnitPrice appear.

© 2021 Vlocity LLC, a Salesforce


company 371
CME CPQ

5. From the Creation Sequence list, select one of the following items:
• OrderItem
• OpportunityLineItem
• QuoteLineItem
6. In the Data Mappings table, select ID.
7. From the Domain Object list, select the object you added in step 5.
8. From the Domain Object Field list, select Id.
9. In the Data Mappings table, select Unit Price.
10. From the Domain Object list, select the object you added in step 5.
11. From the Domain Object Field list, select the one time total field, for example
vlocity_cmt__OneTimeTotal__c.
12. In the Data Mappings table, click New Mapping.
13. From the Mapping Detail list, select UnitPrice.
14. From the Domain Object list, select the object you added in step 5.
15. From the Domain Object Field list, select the effective one time total field, for example,
vlocity_cmt__EffectiveOneTimeTotal__c.

After you are done creating the DataRaptor of type Load(JSON), create a calculation matrix.

Creating a Calculation Matrix


Use a calculation matrix to perform a lookup across multiple inputs and return the corresponding output. In
calculation matrices, headers are inputs or outputs—at least one output must be defined. Input column data

© 2021 Vlocity LLC, a Salesforce


company 372
CME CPQ

types must exactly match the incoming data types or the lookup won’t work. Input rows must be unique and
resolve to a single output.

You can use a calculation matrix in a pricing matrix as well. For more information about pricing matrices,
see Setting Up Pricing Matrices Using the PricingRulesImplementation.

In the example used in this procedure, the Life Insurance Pricing Matrix takes the ZIP code, Age, and
Smoker input to calculate a life insurance rate.

To create a calculation matrix:

1. On the Vlocity Calculation Matrices tab, click New.


2. In the Calculation Matrix Name box, enter the name for the calculation matrix.For example, Life
Insurance Pricing Matrix.
3. Click Save.
4. On the Vlocity Calculation Matrix page, scroll down to the Vlocity Calculation Matrix Versions list.
5. Click the matrix version name.
6. In the Table section, click Add Header.
7. Enter the following information:
• Name is the column header name.
• Header Type defines the column mapping. Select Input if the column obtains data for the
calculation. Select Output if the column returns data from the calculation.

NOTE
Input column names must match the DataRaptor input bundle names.

• Data Type specifies the type of data stored in the column—Text, Number, Currency, Percent,
Boolean, Number Range, Text Range.
• Matrix Display Order defines the column number, or sequence.

© 2021 Vlocity LLC, a Salesforce


company 373
CME CPQ

8. Repeat steps 7 and 8 to define all of the columns.

9. Click Save Data.


Now, you enter the data into the matrix.
10. Click Edit Data.
11. In each box, enter the appropriate data.

© 2021 Vlocity LLC, a Salesforce


company 374
CME CPQ

12. When you are finished, click Save Data.

In the image below, the fields circled in green are input fields. The field in blue is an output field.

Figure 36. Life Insurance Matrix

IMPORTANT
Starting in the CME Summer '18 release, the following limits are supported:

• Input and output rows: 12,752 total characters (max)


• Columns: Approximately 500 (max) depending on amount of data in columns.
• Rows displayed: 2000 (max)

Creating a Calculation Procedure for a Pricing Matrix


To create a pricing matrix, you must create a declarative calculation procedure. For more information about
declarative calculation procedures, see Declarative Calculation Procedures.

To create a calculation procedure for a pricing matrix:

© 2021 Vlocity LLC, a Salesforce


company 375
CME CPQ

1. On the Vlocity Calculation Procedures tab, click New.


2. From the Record Type of new record picklist, select Declarative.
3. Click Continue.
4. In the Calculation Procedure Name box, enter a name for the calculation procedure.
5. Click Save.
6. On the Vlocity Calculation Procedure page, in the Vlocity Calculation Procedure Versions related
list, click the calculation procedure name.
7. In the Output DataRaptor Bundle box, enter the name of the DataRaptor of type Load(JSON) that
you created. For more information, see Create a Pricing Matrix DataRaptor of Type Load(JSON).
8. Enter the necessary variables. In this example, the variables are:

Name Data Type Variable ID


OriginalPrice Currency OriginalPrice
UnitPrice Currency UnitPrice
Quantity Number Quantity
Brand Text Brand
Speed Text Speed
Price Currency MemoryCardMatrix__Price

© 2021 Vlocity LLC, a Salesforce


company 376
CME CPQ

9. In the Preprocessor Class Name section, in the Enter your pre-processor Apex class name below
box, enter CalcProcPreProcessor.
10. In the Calculation Steps section, click Add Step.
11. Select Matrix Lookup.
12. Enter the name of the calculation matrix you created. For more information, see Creating a Calculation
Matrix.
13. Select Include in Calculation Output.
14. Click Add Step.
15. Select Calculation.
16. Enter the appropriate input calculation data, for example Quantity * (Price (MemoryCard) +
OriginalPrice).
17. Enter the appropriate output data, for example UnitPrice.
18. Select Include in Calculation Output.
19. In the Postprocessor Class section, in the Enter your post-processor Apex class name below
box, enter the name of the class you created.
20. On the Vlocity Calculation Procedure Version record detail page, select Enabled.

Next, you must create an entity filter for the pricing matrix.

© 2021 Vlocity LLC, a Salesforce


company 377
CME CPQ

Creating an Entity Filter for a Pricing Matrix


When creating a pricing matrix, you must create a rule action entity filter that invokes the pricing flow under
specific conditions. In this example, the rule action entity filter specifies that quantities correspond to pricing
actions.

For more information about entity filters, see Entity Filters Overview.

To create an entity filter for a pricing matrix:

1. Click the Vlocity Entity Filters tab.


2. Click New.

3. Enter the following information:


• Entity Filter Name is the name for the entity filter, for example, ForPricingCalculation.
• Active specifies if the entity filter is active or inactive.
• Filter On Object Name specifies the object on which to run the entity filter, in this example,
OrderProduct<OrderItem>.
• In Formula For Conditions, enter {0} OR {1} OR {2}.
• From the Type picklist, select Qualification .
4. Click Save.
5. On the Vlocity Entity Filter page, scroll down to the Entity Filter Conditions section.
6. Click Add.

7. From the Type picklist, select Field.


8. In the Field/Attribute Name box, click Select.
The Field or Attribute Selection dialog box opens.

© 2021 Vlocity LLC, a Salesforce


company 378
CME CPQ

9. Select Quantity and click Save.


10. From the Operator/Field picklist, select =.
11. In the Value box, enter 5.
12. Repeat steps 6 through 11 to add two more conditions, using the values 10 and 15.

13. Click Save.

Next, create a rule for the pricing matrix.

© 2021 Vlocity LLC, a Salesforce


company 379
CME CPQ

Creating a Rule for a Pricing Matrix


When using a pricing matrix, you must create a rule that invokes the rule action entity filter. The rule
connects the calculation procedure and entity filter. For more information about pricing rules, see Pricing
Rules.

To create a rule for a pricing matrix:

1. On the Vlocity Rules tab, click New.


2. Enter the following information:
• The Rule Name is the name of the rule.
• From the This defines picklist, select Pricing.
• From the rule that applies to picklist, select the appropriate object, for example, Order Product
<OrderItem>.
• From the and is picklist, select Active.

3. Scroll down to the Filters and Actions list.


4. In the appropriate Filter Name row, click Add to Rule Filter.
5. Click Actions.
6. In the appropriate Action Name row, click Add to Rule Action.

© 2021 Vlocity LLC, a Salesforce


company 380
CME CPQ

7. Click Save.

Next, create a pricing rules flow. For more information, see Create a Pricing Rules Flow.

Creating a Pricing Rules Flow


To use a pricing matrix, you must create a pricing rules workflow, or flow. For more information about
workflows, see Workflow in the Salesforce Help.

To create a pricing rules flow:

1. From Setup, in the Quick Find box, enter Flow.


2. Click Flows.
3. Click New Flow.
4. Add a custom action.

© 2021 Vlocity LLC, a Salesforce


company 381
CME CPQ

a. Scroll down to Apex.


b. Drag vlocity_cmt__CustomAction onto the flow.
c. Enter the following information:
• Name is the flow name, in this example, Pricing Initialization.
• On the Inputs tab, from the Target picklist, select className.
• In the Source box, enter PricingInitialization.
d. Click OK.
e. Click Set As Start Element.

5. Add a rule action.

© 2021 Vlocity LLC, a Salesforce


company 382
CME CPQ

a. From the Apex section, drag vlocity_cmt__RuleAction onto the flow.


b. Enter the following information:
• Name is the rule action name, in this example, Quantity Order Pricing.
• From the Target picklist, select ruleName.
• In the Source box, enter the rule name, in this example Quantity Order Pricing.
• Click Add Row.
• From the Target picklist, select ruleType.
• In the Source box, enter Pricing.
• Click Add Row.
• From the Target picklist, select doCommit.
• In the Source box, enter {!$GlobalConstant.True}.
c. Click OK.
6. Connect the custom action and the rule action.

© 2021 Vlocity LLC, a Salesforce


company 383
CME CPQ

7. Click Save.
8. In the Flow Properties dialog box, enter the Name, in this example, Pricing Rules Flow.
9. Click OK.

Cost and Margin Overview


When you create a cost for a product, you can classify it as a one-time cost or a recurring cost. Margins are
calculated automatically based on the cost and prices that you have defined for each line item and the
product bundle.

Some of the benefits of the cost and margin feature include the following:

• Sales agents can identify the profit and loss margins quickly, enabling them to achieve long-term
strategic objectives.
• Companies can define and meet financial targets for specific products.
• By defining profit margins, companies can better project, maintain, and grow revenues while keeping
costs down.

Follow this workflow to enable and use this feature.

1. Enable cost and margin, create a pricing element for cost, configure a cost for your product, and view it
in Vlocity Cart. These steps are required to use this feature. See Defining Cost and Margins.
2. Define and validate margin ranges to ensure that the cost does not exceed the price by a certain
percentage amount. This is optional but can be useful if you want to generate warning messages in
Vlocity Cart when the margin range is violated. See Defining and Validating Margin Ranges.
3. Optionally, customize either one or both the default Vlocity margin range and margin validation
interface implementations. See Customizing Default Margin Range and Validation Interface
Implementations.
4. Optionally, link service points to line items in Vlocity Cart. See Associate Service Points to Line Items in
Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 384
CME CPQ

NOTE
You must first create a price list with pricing elements related to costs before you can
associate costs to the product. See Creating a Pricing Element for Costs.

Defining Cost and Margins


Follow these basic required steps to define cost and margin ranges. Each step provides more information
about enabling, configuring, and using this feature.

1. Enable the cost and margin feature. See Enabling Cost and Margin.
2. Create a pricing element for price and cost and then configure the price for your product.
a. Create a pricing element for a price.
b. Create a pricing element for cost.
c. Configure the price for a product.
3. Configure a cost for your product. See Defining Costs.
4. View the cost and margin in Vlocity Cart.

NOTE
Margins are calculated automatically after you configure the price and the cost for
your product.

Defining and Validating Margin Ranges


Follow these optional steps to define the margin range and validate it.

1. Define margin ranges using Vlocity calculation procedures.


See Defining and Validating Margin Ranges.
2. Configure the margin validation step if you want to generate an error in Vlocity Cart when the margin
range is violated.
See Defining and Validating Margin Ranges.

Customizing Default Margin Range and Validation Interface Implementations


Follow these optional customization steps to build your own margin range and margin validation interface
implementations.

• The default MarginRangeLoader interface implementation loads the margin range data from the
calculation procedure and returns the data in an output map. The calculation procedure is passed
through the parameter, loadMarginRange, in the pricing plan step.
• The default MarginValidation interface implementation validates margin ranges on line items in Vlocity
Cart.

© 2021 Vlocity LLC, a Salesforce


company 385
CME CPQ

1. To customize the default MarginRangeLoader interface implementation, see Customizing the


MarginRangeLoader Interface Implementation.
2. To customize the default MarginValidation interface implementation, see Customizing the
MarginValidation Interface Implementation.

TIP
You can customize either one or both interface implementations.

Associating Service Points to Line Items in Vlocity Cart


For Energy, optionally link service points to line items in Vlocity Cart. See Linking Line Items to Service
Points.

Enabling Cost and Margin


You can enable the cost and margin feature using the Vlocity CMT Administration Console. When you
enable this feature, it creates metadata to define the cost and margin. A special variable related to cost and
margins is enabled. You can view and use costs in Vlocity Cart. When you disable this feature, any quotes,
opportunities, or orders using costs become invalid. Vlocity recommends that you do not disable this
feature after you have enabled it.

NOTE
The Costs tab is always visible from either the Products, Pricing facet or the Price List,
Pricing Elements facet even if the feature is disabled.

To enable cost and margin:

1. Log in to Salesforce and go to the App Launcher.


2. Enter Vlocity CMT Administration Console in the quick find search.
The Vlocity CMT Administration Console is displayed.
3. From the Custom Settings section, select Enable Features.
4. Navigate to the Cost and Margin feature and toggle the switch to enable it.

© 2021 Vlocity LLC, a Salesforce


company 386
CME CPQ

NOTE
If you disable the feature after you have enabled it, you will see a warning message
indicating that any Opportunities, Quotes, or Orders using costs become invalid.

5. Click Enable.

After you enable the cost and margin feature, the following options are available in Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 387
CME CPQ

Table 48. Fields Available in Vlocity Cart


Vlocity Cart Tab Available Columns or Tabs After You
Enable Cost and Margin
When you enable the cost and margin feature, you will see the AdvancedPricing + AdvancedPricing + CostMargin tab
CostMargin view in the drop-down menu in Vlocity Cart. If you do not enable this
feature, you will see the AdvancedPricing view only in the drop-down menu.

There are new columns for each line item in the Cart. They are calculated based on the • Recurring Cost
cost pricing variable you defined. • Recurring Cost Total
• One Time Cost
If you enabled usage pricing as well as cost and margin, you see other columns in the
• One Time Cost Total
Cart. See Enable Usage Pricing.
• Recurring Margin
• One Time Margin
There are new columns in the Total Bar. They are calculated based on the cost pricing • Recurring Total
variable you defined. • Recurring Margin Total
• One Time Total
If you enabled usage pricing as well as cost and margin, you see other columns in the
• One Time Margin Total
Total Bar. See Enable Usage Pricing.
• Order Total
• Order Margin Total

Vlocity Cards for Cost and Margins


When you enable the cost and margin feature, the following card state and new fields are available for the
standard Vlocity Cart cards and layouts.

• In Vlocity Cart, you will see the AdvancedPricing + CostMargin view in the drop-down menu. New cost
and margin totals are available in the header for line items and total bar.

© 2021 Vlocity LLC, a Salesforce


company 388
CME CPQ

• The Vlocity Cart displays cost-related fields on line items using the 'cpq-product-cart' layout and the 'cpq-
product-cart-item' card.

• The Vlocity Cart displays cost-related fields on total bars in Vlocity Cart using the 'cpq-total-bar' layout
and the 'cpq-total-bar-card'.

© 2021 Vlocity LLC, a Salesforce


company 389
CME CPQ

Table 49. New Vlocity Cards for Cost and Margins


Layout Name Card Name States Column Field Names in Vlocity
Cart
cpq-product- cpq-product- CustomView_CPQAdvancedPricingCostandMargin • Recurring Cost
cart cart-item • Recurring Cost Total
• One Time Cost
• One Time Cost Total
• Recurring Margin
• One Time Margin
cpq-total-bar cpq-total-bar- • Active Opportunity • Recurring Margin Total
card • Active Quote • One Time Margin Total
• Active Order • Order Margin Total

Creating a Pricing Element for Costs


Before you can assign costs to a product, you must first create a price list with pricing elements related to
costs. You must create a pricing variable to assign to the cost. Cost can be a one-time standard cost or a
recurring cost.

To create a pricing element for costs:

1. Log in to Salesforce and click the App Launcher.


2. Search for Vlocity Product Console in the quick search box.
The Vlocity Product Console is displayed.
3. Search for the price list.
4. Click the pencil icon to edit the price list.
5. Click the Pricing Elements facet.
6. Click the Costs tab.
7. Click New.
8. In the Pricing Variable section, enter the search criteria to find the appropriate pricing variable to
associate with the cost and click Search.
9. From the search results list, click the pricing variable to assign to the cost.
Follow the Post-Upgrade Steps for Fall '18 to Winter '19 for Vlocity Communications, Media, and
Energy steps so that the out-of-the-box pricing variables for cost and margins are available to you.
10. Enter required information for this cost.
Fields marked with an asterisk are required.

Table 50. Required and Optional Fields for Costs in Pricing Elements
Fields Description
General Properties
Name Enter the name of the cost.
Code Enter a unique code for the cost.
Display Text Enter a brief description of the cost.
Help Text Enter a description for the Help text. This is optional.
Currency Value

© 2021 Vlocity LLC, a Salesforce


company 390
CME CPQ

Fields Description
Cost Enter the cost price that you want to apply.
Currency Code The default currency code is set to USD.
Effectivity
Effective From Enter the Effective From date for the cost. This is the date the cost becomes active.
Effective Until Enter the Effective Until date for the cost. This is optional. If you choose an effective until date, the cost will not
apply after that date.
Active Click Active to activate the cost.
11. Click Save.

Defining Costs
Similar to the way you define a price for a product, you can define costs for a product. Use the Vlocity
Product Console to define the cost for a product.

IMPORTANT
Before you configure costs, you must define pricing elements for the costs first. See
Creating a Pricing Element for Costs.

• Adjustments and overrides do not apply to costs.


• The base price and virtual price fields do not apply to costs and are ignored at runtime.

Defining Costs Using a Product or Price List


To define a cost:

1. Log in to Salesforce and click the App Launcher.


2. Search for the Vlocity Product Console using the quick find search.
The Product Console is displayed.
3. Search for and edit the product or price list to which you want to associate a cost.
4. Click the Pricing facet if you selected Product or the Price List Entries facet if you selected Price List.
5. Click the Costs tab.
It is located next to the Charges tab in the Pricing facet for Products or the Price List Entries facet for
the Price List.
6. Click New.
7. Enter the following required information in the Price List Entry field. All required fields are marked with
an asterisk.

Table 51. Product or Price List Entry, Required and Optional Fields
Required Fields Description
General Properties

© 2021 Vlocity LLC, a Salesforce


company 391
CME CPQ

Required Fields Description


Product or Price List Depending on whether you selected a product or price list, search for a product or price list to which you
want to apply the cost.
Display Text Enter the reason for applying a cost to the price list.
Base Price The Base Price is not used in costs. Leave this unchecked.
Virtual Price The Virtual Price is optional and not used in costs. Leave this unchecked.
Pricing Variable
Charge Type Search for the charge type you want to apply to this cost. Determine whether this is a one-time cost or a
recurring cost.
Sub-Type Select standard cost.
Pricing Element
Pricing Element Select a pricing element. You must define a pricing element on the price list before you can select it here.
See Creating a Pricing Element for Costs.
Time Plan/Policy
Time Plan Optionally, search for and specify a time plan that applies to this cost.
Time Policy Optionally, search for and specify a time policy that applies to this cost.
Effectivity
Effective From Optionally, specify the start date.
Effective Until Optionally, specify the end date.
Active Mark the costs as Active in order for it to be evaluated by the pricing service.
8. Click the Context Rules tab and add rule sets that apply to this cost. See Context Rules. For example,
you can apply a higher cost for the same product when it sells in New York versus San Francisco.
9. Click Save.
The costs you created are added to the Costs tab.

Defining and Validating Margin Ranges


You can define margin ranges using the pricing plan so that the cost does not exceed the price. This is
optional. If you do not set up a validation process, users will not be notified when the margin range has
been violated.

© 2021 Vlocity LLC, a Salesforce


company 392
CME CPQ

TIP
The Default Pricing Plan includes a step to calculate margins after you complete the setup
described in this section. See Default Pricing Plan.

In general, margins are calculated using the following formula:

= ((priceTotal - costTotal) / costTotal) * 100

For example, ((oneTimePriceTotal - oneTimeCostTotal) / oneTimeCostTotal) * 100 gives you the


oneTimeMargin.

Use the following formulas to calculate margins, recurring margins, and margin totals for line items in
Vlocity Cart.

Table 52. Formulas Used for Line Items in Vlocity Cart


Line Items in Vlocity Cart Formula
One Time Total = One Time Charge * Quantity
Recurring Total = Recurring Charge * Quantity
One Time Margin = ((oneTimePriceTotal - oneTimeCostTotal) / oneTimeCostTotal) * 100
Recurring Margin = ((recurringPriceTotal - recurringCostTotal) / recurringCostTotal) * 100

NOTE
• If the One Time Cost Total is 0, then the One Time Margin is 0.
• If the Recurring Cost Total is 0, then the Recurring Margin is 0.

Use the following formulas to calculate margins, recurring margins, and usage margin totals listed in the
Vlocity Cart header.

Table 53. Formulas Used in Vlocity Cart Header


Vlocity Cart Header Formula
Recurring Total = Sum of recurring totals for all parent line items in Vlocity Cart
Recurring Margin Total = ((recurringPriceTotal - recurringCostTotal) / recurringCostTotal) * 100
One Time Total = Sum of one time totals for all parent line items in Vlocity Cart
One Time Margin Total = ((oneTimePriceTotal - oneTimeCostTotal) / oneTimeCostTotal) * 100
Price Total = oneTimePriceTotal + (numberOfContractMonth * recurringPriceTotal)

© 2021 Vlocity LLC, a Salesforce


company 393
CME CPQ

Vlocity Cart Header Formula


Cost Total = oneTimeCostTotal + (numberOfContractMonth * recurringCostTotal)
Margin = ((price - cost) / price) * 100
Order Margin Total = ((priceTotal - costTotal) / costTotal) * 100
Usage Margin Total = ((usagePriceTotal - usageCostTotal)/usagePriceTotal)*100

NOTE
When NumberOfContractMonth is set to null, the default is 1.

Margins for each line item can be validated using a LoadMarginRange step in your pricing plan. The
LoadMarginRange step invokes a calculation procedure and matrix. This is similar to how attribute-based
pricing is implemented using pricing plans.

Follow these steps to define a margin range and validate the range.

1. Create a Data Raptor


2. Create a Calculation Matrix
3. Create a Calculation Procedure
4. Add Parameters to the Pricing Plan
5. Validate the Margin Range in Vlocity Cart

Creating a DataRaptor for Cost and Margin


If you are new to Vlocity and need more information about DataRaptors, see the documentation about
DataRaptors.

You must create a DataRaptor before you can use DataRaptor as a data source. As an example, you can
use the product code and quantity.

To identify and extract the order item (Order Product) or the line item using the DataRaptor Designer:

1. Log in to Salesforce and click App Launcher.


2. Search for Vlocity DataRaptor Designer using the quick find search.
The Vlocity DataRaptor Designer opens.
3. Click New to create a new DataRaptor and select the following options:
a. Interface Type: Extract
b. Input Type: JSON
c. Output Type: JSON
4. Click the Extract tab and click Add an Extract Step, for example, OrderItem, QuoteLineItem, or
OpportunityLineItem.
5. Specify the following options in the Extract tab. For example, you can query the OrderItem object by
orderId.

© 2021 Vlocity LLC, a Salesforce


company 394
CME CPQ

a. Extract Output Path: OI for OrderItem


b. Filter: OrderID = Id

6. Click the Output tab and specify the Output JSON Path fields you want to extract for the calculation
matrix, for example, Product Code, ID, and Quantity.
This output from the Data Raptor is the input to the calculation matrix. An example is shown below.
a. Extract JSON Path: Product ID
b. Output JSON Path: data:ProductCode
c. Output Data Type: String

IMPORTANT
Ensure that the Output Data Type matches the matrix input headers. For example,
Quantity must be of data type Number and the input header, Quantity, in the
calculation matrix must be of Integer.

Creating a Calculation Matrix for Cost and Margin


If you are new to Vlocity and need more information about calculation matrices, see Calculation Matrices.

After you have identified the product to which you want to associate a margin range, create a calculation
matrix.

© 2021 Vlocity LLC, a Salesforce


company 395
CME CPQ

Specify the input data and make it a unique record (unique row). Identify and specify the lower and upper
bounds of the margin range. Set up margin ranges using calculation procedures. Define margin ranges in
the Vlocity Calculation Matrix.

As an example, product code and quantity are used to specify the uniqueness to determine the lower and
upper bounds. Customers can define their unique lower and upper bound values.

TIP
You must define the following output columns in the calculation matrix with a datatype of
percentage. These output columns are expected by the MarginRangeLoader
implementation interface. Make sure to use the following names.

• One Time Margin Lower Bound


• One Time Margin Upper Bound
• Recurring Margin Lower Bound
• Recurring Margin Upper Bound

If you also enabled usage pricing, you must define additional output columns with a
datatype of percentage and the following names.

• Usage Margin Lower Bound


• Usage Margin Upper Bound

If you are using usage pricing, see ???.

Creating a Calculation Procedure for Cost and Margin


If you are new to Vlocity and need more information about calculation procedures, see Calculation
Procedures Overview.

© 2021 Vlocity LLC, a Salesforce


company 396
CME CPQ

IMPORTANT
Before you begin, complete the Post-Upgrade Steps for Fall '18 to Winter '19 for Vlocity
Communications, Media, and Energy steps so that the out-of-the-box cost variables are
available to you. For a list of the pricing variables for cost and margins, see Pricing
Variables for Cost and Margins.

The calculation procedure calls the associated calculation matrix to find the margin range for the product
and then returns the output from the matrix to the pricing service. If a line item in the cart is outside the
upper and lower bounds of the margin range, Vlocity Cart will report an error to the user. For example, if
you defined a margin range that cannot be lower than 5%, you will see an error in Vlocity Cart if the range
is 4% for that line item.

NOTE
If a line item contains a product that does not match the matrix, the pricing service will
continue to the next step of the pricing plan.

• Create a calculation procedure as shown in the following screen. Specify the Record Type to be
Declarative.

© 2021 Vlocity LLC, a Salesforce


company 397
CME CPQ

If you also enabled usage pricing, add Usage Margin Lower Bound and Usage Margin Upper Bound
variables.
• Associate the procedure with the Extract DataRaptor bundle you created.
• Use the Calculation Matrix lookup to associate the calculation steps with the matrix you created. Be sure
to check the "Include in Calculation Output" option. Output variables are required.
• Enable the calculation procedure and make sure it has the highest priority.

Adding Parameters to the Pricing Plan for Cost and Margin

IMPORTANT
Before you begin, complete the Post-Upgrade Steps for Fall '18 to Winter '19 for Vlocity
Communications, Media, and Energy steps. This is to make sure that the pricing plan step,
"Load Margin Ranges" is available to you.

• In the Vlocity Product Console, edit the pricing plan that you want to use to validate the margin ranges.
Next, edit the Load Margin Ranges step and add only one of the following parameters you want in the
General Properties section:
• OpportunityMarginRangeVCPName = name_of_calculation_procedure_for_opportunity
• QuoteMarginRangeVCPName = name_of_calculation_procedure_for_quote

© 2021 Vlocity LLC, a Salesforce


company 398
CME CPQ

• OrderMarginRangeVCPName = name_of_calculation_procedure_for_order

Validating the Margin Range in Vlocity Cart


After you have created the margin range validation process steps, go to Vlocity Cart and add products. If
the margin range is violated for the products in your cart, you will see an error message. You will not be
able to submit the opportunity, quote, or order until you resolve the error.

Pricing Variables for Cost and Margins


Pricing variables are available out-of-the-box. Follow the Post-Upgrade Steps for Fall '18 to Winter '19 for
Vlocity Communications, Media, and Energy steps so that the out-of-the-box pricing variables for cost and
margins are available to you. This is required to create a calculation procedure for cost and margin and is
part of the Defining and Validating Margin Ranges process.

Pricing Variables for Costs


The following table provides a list of out-of-the-box pricing variables for costs.

Table 54. Pricing Variables for Costs


Pricing Variable Name for Costs Code Pricing Variable Bindings
Effective One Time Std Cost Total EFF_OT_STD_CST_TOTAL OpportunityLineItem,
QuoteLineItem, OrderItem, Asset
Effective Recurring Monthly Std EFF_REC_MNTH_STD_CST_TOTAL OpportunityLineItem,
Cost Total QuoteLineItem, OrderItem, Asset
One Time Std Cost OT_STD_CST OpportunityLineItem,
QuoteLineItem, OrderItem, Asset
One Time Std Cost Total OT_STD_CST_TOTAL OpportunityLineItem,
QuoteLineItem, OrderItem, Asset
Parent Rollup One Time Cost Total PARENT_ROLLUP_OT_STD_CST_TOTAL Opportunity, Quote, Order

© 2021 Vlocity LLC, a Salesforce


company 399
CME CPQ

Pricing Variable Name for Costs Code Pricing Variable Bindings


Parent Rollup Recurring Monthly PARENT_ROLLUP_REC_MNTH_STD_CST_TOTAL Opportunity, Quote, Order
Std Cost Total
Recurring Monthly Std Cost REC_MNTH_STD_CST OpportunityLineItem,
QuoteLineItem, OrderItem, Asset
Recurring Monthly Std Cost Total REC_MNTH_STD_CST_TOTAL OpportunityLineItem,
QuoteLineItem, OrderItem, Asset
Rollup One Time Cost Total ROLLUP_OT_STD_CST_TOTAL None
Rollup Recurring Monthly Std Cost ROLLUP_REC_MNTH_STD_CST_TOTAL None
Total

Pricing Variables for Margins


The following table provides a list of out-of-the-box pricing variables for margins.

Table 55. Pricing Variables for Margins


Pricing Variable Name for Margins Code Pricing Variable Bindings
One Time Margin OT_MARGIN OpportunityLineItem, QuoteLineItem,
OrderItem, Asset
Parent Margin Total PARENT_MARGIN_TOTAL Opportunity, Quote, Order
Parent One Time Margin Total PARENT_OT_MARGIN_TOTAL Opportunity, Quote, Order
Parent Recurring Monthly Margin Total PARENT_REC_MNTH_MARGIN_TOTAL Opportunity, Quote, Order
Recurring Monthly Margin REC_MNTH_MARGIN OpportunityLineItem, QuoteLineItem,
OrderItem, Asset

Customizing Default Interface Implementations for Margin Ranges


You can customize the Margin Range Loader or the Margin Validation interfaces by changing the default
implementations. You may want to do this to customize the names of the calculation procedures, matrices,
and/or the logic used to validate the ranges. These interfaces are invoked by the Pricing Plan when the
LoadMarginRanges method name is specified in a step.

IMPORTANT
In the Pricing Plan Steps facet of the Default Pricing Plan, add the Load Margin Ranges
step after the "Calculate Rollups" step and before the "Save Line Items" step.

© 2021 Vlocity LLC, a Salesforce


company 400
CME CPQ

IMPORTANT
If you do not have the MarginRangeLoader or MarginValidation interfaces in your org,
install the Winter '19 release and run the post-installation or post-upgrade steps. See the
Installation Guide for Vlocity Communications, Media, and Energy

or the Upgrade Guide for Vlocity Communications, Media, and Energy.

NOTE
This is an optional step. Use it only if you want to customize the default Vlocity interface
implementations to load the margin range and validate it.

Customize one or both of the following default interface implementations:

• Margin Range Loader


The MarginRangeLoader interface implementation loads the margin range data from the calculation
procedure and returns the data in an output map. The calculation procedure name is passed through the
loadMarginRange parameter in the pricing plan step.
Customize this interface implementation, for example, when you don't want to be restricted to using the
Vlocity calculation procedure and want the flexibility to define your own margin range calculation process.
See Customizing the MarginRangeLoader Interface Implementation.
• Margin Validation
The MarginValidation interface implementation validates margin range on line items and returns an error
message at the line item level in Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 401
CME CPQ

Customize this interface implementation, for example, when you don't want to validate error messages at
the line item level. Instead, you want to set up a different validation mechanism. See Customizing the
MarginValidation Interface Implementation.

Customizing the MarginRangeLoader Interface Implementation


If you do not want to use a Vlocity calculation procedure to calculate your margin ranges, you can create a
new one, name it in the pricing plan step, and build custom logic to load the margin range.

NOTE
This step is optional. Skip it if you want to use Vlocity's default MarginRangeLoader
interface implementation.

Table 56. Margin Range Loader Interface Implementation Properties


Name Properties
Interface Name MarginRangeLoader
Active Implementation DefaultMarginRangeLoaderImplementation
Class
Purpose Introduced in the Winter '19 release, this interface implementation loads the margin range data from a
Vlocity calculation procedure and returns the data in an output map. You can pass the calculation
procedure name, loadMarginRange, through the pricing plan step.

To customize the default MarginRangeLoader interface implementation:

1. Specify your input and output parameters.

Table 57. Margin Range Loader Interface Implementation Properties


Input /Output Data Data Type Description
Key
Input Parameters
parent sObject For order, opportunity, or quote
lineItemList List<sObject> For orderItem, opportunityLineItem, or quoteLineItem
Output Parameters
matrix Output Map <Id, Map<String, ID is lineItemID
Decimal>
For line item id, you need to pass the Map<String, Decimal> map. The
following keys are expected:

• One Time Margin Lower Bound


• One Time Margin Upper Bound
• Recurring Margin Lower Bound
• Recurring Margin Upper Bound
2. Use the following sample code to customize the margin range interface implementation.

© 2021 Vlocity LLC, a Salesforce


company 402
CME CPQ

Sample Implementation Code for Margin Range Loader

global class SampleMarginRangeLoaderImplementation implements


vlocity_cmt.VlocityOpenInterface
{
global Boolean invokeMethod(String methodName, Map<String, Object> input,
Map<String, Object> output,
Map<String, Object> options)
{
if (methodName.equals('loadMarginRanges'))
{
loadMarginRanges(input, output, options);
return true;
}
return false;
}

private void loadMarginRanges(Map<String, Object> input, Map<String,


Object> output,
Map<String, Object> options)
{
//write your own logic
}
}

Customizing the MarginValidation Interface Implementation


This interface implementation is called by the default Margin Range Loader interface implementation.

• Using the Load Margin Ranges interface implementation, the pricing service queries the named
calculation procedure to find the margin ranges for the product specified in the line item and passes it to
the Margin Validation interface implementation.
• Next, the Margin Validation interface implementation compares the line item's margin to determine
whether the range is within the specified limits.
• If the margin is outside the valid range, it returns an error message in the CPQ pricing message field to
Vlocity Cart.

You can overwrite this class to customize the margin validation.

NOTE
This step is optional. Skip it if you want to use Vlocity's default MarginValidation interface
implementation.

© 2021 Vlocity LLC, a Salesforce


company 403
CME CPQ

Table 58. Margin Validation Interface Implementation Properties


Name Properties
Interface Name Margin Validation
Active Implementation Class DefaultMarginValidationImplementation
Purpose Introduced in the Winter '19 release, this interface implementation is used to validate the margin range
on individual line items.

To customize the Margin Validation interface implementation:

1. Specify your input and output parameters.

Table 59. Input and Output Parameters


Input Map Key Datatype Description
Input Parameters
parent sObject For order, opportunity, or quote
lineItemList List<sObject> For OrderItem, QuoteLineItem, or OpportunityLineItem
lineItemIdToMarginRangeMap Map<Id, Map <String, Object>> For each line item, a map with the following keys:

• OneTimeMarginLowerBound
• OneTimeMarginUpperBound
• RecurringMarginLowerBound
• RecurringMarginUpperBound
Output Parameters: None
2. Specify an error message in the 'CpqPricingMessage__c' field of the line items. Error messages for
one-time margins and recurring margins are displayed for each line item in Vlocity Cart when the
margin ranges are violated.
For example, the one-time margin must be between 5.0% to 10.0% is displayed in Vlocity Cart for a
line item when the validation.
3. Customize the margin validation implementation using the sample implementation code.

Example 15. Sample Implementation Code for Margin Validation


global class CustomMarginValidationImplementation implements
vlocity_cmt.VlocityOpenInterface
{
private static String ONE_TIME_MARGIN_PREFIX = 'OneTimeMargin';
private static String RECURRING_MARGIN_PREFIX = 'RecurringMargin';
private static String nsp = 'vlocity_cmt__';
/*
* invoke method.
*/
public Boolean invokeMethod(String methodName, Map<String, Object> input,
Map<String, Object> output,
Map<String, Object> options)
{

© 2021 Vlocity LLC, a Salesforce


company 404
CME CPQ

if (methodName.equals('validateMarginRange'))
{
validateMarginRange(input, output, options);
return true;
}
return false;
}

/*
* validate margin ranges.
*
*/
private void validateMarginRange(Map<String, Object> input, Map<String,
Object> output,
Map<String, Object> options)
{
List<SObject> lineItemList = (List<SObject>) input.get('lineItemList');
//map, which has margin range details.
Map<Id, Map<String, Object>> itemIdTomarginRangeMap = (Map<Id,
Map<String, Object>>)
input.get('lineItemIdToMarginRangeMap');
for (SObject item : lineItemList)
{
String oneTimeMarginMessage = null;
String recurringMarginMessage = null;
Id lineItemId = (Id) item.get('Id');
//margin range map also has all output columns of martix.
Map<String, Object> marginRangeMap =
itemIdTomarginRangeMap.get(lineItemId);
if (marginRangeMap != null)
{
Decimal oneTimeMargin = (Decimal) item.get(nsp +
'OneTimeMargin__c');
Decimal recurringMargin = (Decimal) item.get(nsp +
'RecurringMargin__c');
Decimal oneTimeMarginLowerBound = (Decimal)
marginRangeMap.get('OneTimeMarginLowerBound');
Decimal oneTimeMarginUpperBound = (Decimal)
marginRangeMap.get('OneTimeMarginUpperBound');
Decimal recurringMarginLowerBound = (Decimal)
marginRangeMap.get('RecurringMarginLowerBound');
Decimal recurringMarginUpperBound = (Decimal)
marginRangeMap.get('RecurringMarginUpperBound');
if (oneTimeMarginLowerBound != null &&
oneTimeMarginUpperBound != null &&
(oneTimeMargin > oneTimeMarginUpperBound ||

© 2021 Vlocity LLC, a Salesforce


company 405
CME CPQ

oneTimeMargin < oneTimeMarginLowerBound))


{
oneTimeMarginMessage = ONE_TIME_MARGIN_PREFIX + ':' + 'One
time margin must be between ' + oneTimeMarginLowerBound +
' and ' + oneTimeMarginUpperBound +
'.';
}
if (recurringMarginLowerBound != null &&
recurringMarginUpperBound != null &&
(recurringMargin > recurringMarginUpperBound ||
recurringMargin < recurringMarginLowerBound))
{
recurringMarginMessage = RECURRING_MARGIN_PREFIX + ':' +
'Recurring margin must be between ' + recurringMarginLowerBound
+ ' and ' +
recurringMarginUpperBound + '.';
}
}

//read previous message and update


String message = (String) item.get(nsp + 'CpqPricingMessage__c');
List<String> errorList = new List<String>();
if (String.isNotBlank(message))
{
List<String> messageList = message.split('\\|');
for (String m : messageList)
{
List<String> mList = m.split(':');
if (mList.size() > 1)
{
if (!mList[0].equals(ONE_TIME_MARGIN_PREFIX) &&
!mList[0].equals(RECURRING_MARGIN_PREFIX))
{
errorList.add(m);
}
}
}
}
if (oneTimeMarginMessage != null)
{
errorList.add(oneTimeMarginMessage);
}
if (recurringMarginMessage != null)
{
errorList.add(recurringMarginMessage);
}

© 2021 Vlocity LLC, a Salesforce


company 406
CME CPQ

//update pricing message.


if (errorList.isEmpty())
{
item.put(nsp + 'CpqPricingMessage__c', null);
}
else
{
item.put(nsp + 'CpqPricingMessage__c', String.join(errorList,
'|'));
}
}
}
}

Linking Line Items to Service Points


You can link a line item in Vlocity Cart to a service point so you can configure that service point individually.
A service point is defined as a service that is available at a physical location. This is an optional step. You
must enable cost and margin to link line items to service points.

To link a service point to a product line item:

1. In Vlocity Cart, click the down arrow next to the line item to which you want to link a service point.
2. Using the line item action drop-down menu, click Configure.
3. Click Service Point.
For Multi-Service Points, premises for the accounts in this order are loaded.
Otherwise, the Cart Item Lookup Field dialog box appears. Type the premises name and then select it
from the list. No automatic lookup occurs, so you must know the name.
4. Select a premises.
For Multi-Service Points, an API call displays all the service points associated with that premises.
Otherwise, type the service point name. No automatic lookup occurs, so you must know the name.
5. Select the service point.
6. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 407
CME CPQ

Context Rules and Advanced Rules Frameworks

Vlocity has two rules frameworks that work in tandem: context rules and advanced rules.

• Use the context rules framework to determine what products, promotions, and prices appear in Vlocity
cart. You can specify when to apply a penalty for cancellations and what the penalty will be.
• Use the advanced rules framework to design product compatibility rules based on conditions in order line
items and related objects. You can also create advanced pricing, availability, and eligibility rules.

You can use rules to change standard product and pricing behaviors in Vlocity Cart. Vlocity rules are
essential to creating the perfect order. You control all the products and services you offer to your customers,
and offer them at the right prices.

Context Rules Framework


Use the context rules framework to build rules that change what products, promotions, and prices appear
for customers. You can also apply penalties for promotions or contracts that are canceled.You can also
create rules to ensure pricing adjustments are allowed only in certain conditions. Context rules work
together with Vlocity advanced rules framework to ensure all orders are configured and priced correctly.

There are two primary types of context rules: Qualification and Penalty. These rule types have different
uses in Vlocity Cart. See Types of Context Rules.

Create and manage context rules in the Vlocity Product Console. Build context rules with reusable
components. Context rules can be combined into rule sets and applied to products, promotions, price lists,
and price list entries. They can also be applied to virtual objects. See Context Rules Components.

© 2021 Vlocity LLC, a Salesforce


company 408
CME CPQ

Figure 37. Context Rules Framework Components

Setting Up Context Rules Framework

Interface Implementations
The following interface implementations must be active and set to their default values to enable the
specified types of context rules.

Interface Implementation Enables which context


rules?
ContextRuleService ContextRuleService For all types of context rules
ProductAvailabilityOpenInterface CtxRulesProductsOpenImplementation For qualification context
rules for products
PricingManAdjEligibilityInterface PricingManAdjEligibilityService For qualification context
rules for pricing adjustments

© 2021 Vlocity LLC, a Salesforce


company 409
CME CPQ

Interface Implementation Enables which context


rules?
RepricingManAdjEligibilityInterface RepricingManualAdjEligibilityService For qualification context
rules for pricing adjustments
used in a repricing batch job
TightestMatchInterface TightestMatchServiceImplementation For qualification context
rules for price list entries and
child price lists

CPQ Configuration Setup Custom Settings


The context rules framework uses the following CPQ configuration custom settings:

• ContextRulesEnabled: true (required)


• ContextRulesCacheMode
• CPQ Toast Message Log Level

CPQPartition Session Cache


Configure the CPQPartition session cache to support the context rules framework as follows:

• Set the CPQ Configuration Setup CacheEnabled custom setting to true.


• Allocate 5 MB or more to the CPQPartition platform cache Session Cache. See Creating a Platform
Cache Partition.

NOTE
The CPQ Configuration Setup UseSessionCache custom setting is deprecated. In Vlocity
Communications, Media, and Energy Summer '17 and later, set UseSessionCache to
false.

Types of Context Rules


In the Vlocity Product Console, you can create the following types of context rules: Qulification rules and
Penalty Rules.

• Qualification rules—Qualification rules determine customer eligibility for products, promotions, price lists,
price list entries, and pricing adjustments at run time. Because context rules are reusable, you can assign
the same qualification context rule to a product, a promotion, a price list, or a price list entry. Context
rules for pricing adjustments are available in Vlocity Communications, Media, and Energy Summer '18
release, and because they operate on virtual objects, they cannot be reused on other objects such as a
product, for example.
• Qualification Rules for Products
• Qualification Rules for Promotions
• Qualification Rules for Price Lists

© 2021 Vlocity LLC, a Salesforce


company 410
CME CPQ

• Qualification Rules for Price List Entries and Child Price Lists
• Qualification Rules for Pricing Adjustments
• Penalty rules—Penalty rules determine whether a penalty applies and what the penalty is when a
customer cancels a promotion or deletes or disconnects an asset linked to a contract during its
commitment period. Penalty rules apply only to MACD or asset-based orders.
• Penalty Rules for Promotions
• Penalty Rules for Contracts
• There is a third type of context rule—evaluation rules. However, evaluation rules are not implemented in
Vlocity Cart, and are available only using an API. For more information, see Evaluation Rules Overview.

Figure 38. Types of Context Rules

Qualification Rules for Products


You can use context rules with a qualification rule type to control displaying products in the Qualified or
Disqualified tabs in the product list in Vlocity Cart. The qualification rule evaluates the account's eligibility to
add the product to the cart based on the defined rule conditions.

For example, you might want to offer certain products to customers purchasing through one channel and a
different set of products to customers purchasing through another channel.

© 2021 Vlocity LLC, a Salesforce


company 411
CME CPQ

Figure 39. Where Do Qualification Context Rules for Products Run?

When creating the product list for Vlocity Cart, the rules engine first queries the shared catalog for all
products that are marked orderable, active, effective as of today's date, and that have a price. Then, using
that list of products, the context rules framework filters it using qualification context rules, which results in a
list of qualified and disqualified products. The qualified products are then passed to the advanced rules
framework, which refines the list again using its rules. The final output is displayed in Vlocity Cart's product
list, with the qualified products appearing in the Qualified tab and the disqualified products in the
Disqualified tab.

© 2021 Vlocity LLC, a Salesforce


company 412
CME CPQ

Figure 40. Order of Operations

Before you can use qualification context rules for products, you must ensure that the
CtxRulesProductsOpenImplementation is the active and default implementation for
ProductAvailabilityOpenInterface.

You create qualification rules in Vlocity Product Console using reusable context rule components. See
Create Qualification Rule Sets.

After creating a qualification rule, you can assign it to a product. See Qualification Rules - Assigning or
Deleting to Products.

Qualification Rules for Promotions


You can also use qualification context rules to control displaying promotions. The qualification rule
evaluates the account's eligibility for the promotion based on the defined rule conditions, just like a product,
and the promotions is displayed on the Qualified or Disqualified tabs in the Promotion list in Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 413
CME CPQ

Figure 41. Where Do Qualification Context Rules for Promotions Run?

You create qualification rules in Vlocity Product Console using reusable context rule components. For more
information, see Creating Qualification Rule Sets .

After creating a qualification rule, you can assign it to a promotion. For more information, see Qualification
Rules - Assigning or Deleting to for Products and Promotions.

Qualification Rules for Price Lists


You can use qualification context rules to control displaying price lists in Vlocity Cart's Price List picklist.
You can ensure that customers order from the correct price list according to your business rules. The Price
List picklist in Vlocity Cart displays all price lists that a customer is eligible to use based upon rule
conditions. Any price lists that a customer is not eligible to use does not appear in the list. For example, you
may want to ensure that consumer accounts cannot order from a B2B price list, and business accounts
cannot order from a B2C price list.

© 2021 Vlocity LLC, a Salesforce


company 414
CME CPQ

Figure 42. Using Qualification Context Rules To Control Displaying the Price Lists

You create qualification rules in Vlocity Product Console using reusable context rule components. For more
information, see Creating Qualification Rule Sets.

After creating a qualification rule, you can assign it to a price list. For more information, see Qualification
Rules - Assigning or Deleting to Price Lists.

Qualification Rules for Price List Entries and Child Price Lists
In addition to assigning qualification rules to products, promotions, and price lists, you can assign
qualification rules to price list entries or to a child price list, which acts as a container for a group of price list
entries. This ensures that each customer sees the price that is right for him or her. For example, might have
specific pricing for certain geographies or customer segments, in addition to base pricing. You can use a
qualification rule to determine a customer's eligibility for pricing, just like using a qualification rule to
determine a customer's eligibility for products or promotions.

This approach enables you to assign a single product to multiple prices. In some cases, a customer might
be eligible for more than one of them. In the end, a single price must be set. To ensure that the correct price
is applied, you use the TightestMatchInterface and condition weights.

Condition Weights
Condition weight is a context dimension general property that is assigned a numeric value from 0 to 60. The
TightestMatchServiceImplementation uses the condition weight to calculate the relative weight of a price list
entry. The weight is only used for rules that are assigned to price list entries or child price lists and not for
rules assigned to products and promotions. For more information, see Using Condition Weights.

© 2021 Vlocity LLC, a Salesforce


company 415
CME CPQ

TightestMatchInterface
TightestMatchInterface is provided as part of the managed package. It includes the
TightestMatchServiceImplementation, which selects the tightest match price. For more information, see
Using Tightest MatchQualification Rules for Price List Entries

Creating a Qualification Rule


Create qualification rules in Vlocity Product Console using reusable context rule components. For more
information, see Creating Qualification Rule Sets .

Assigning a Qualification Rule to Price List Entries or Child Price Lists


After creating a qualification rule, you can assign it to a price list entry or a child price list.

Qualification Rules - Assigning or Deleting to for Price List Entries

Tightest Match
Products can have multiple price list entries across child price lists or in a single price list. You can use
context rules to determine which price list entry to apply when the product is added to the cart.

For example, you might want rules like this:

• Orders placed over the web receive certain prices


• New customers receive certain prices
• Geographic regions receive certain prices

In a world of multiple prices, what if the customer is eligible for multiple prices? In the end, a single price
must be set. That’s when the TightestMatchInterface comes into play.

TightestMatchInterface
TightestMatchInterface is an interface that is provided as part of the managed package. It is called by the
PricingInterface when using either PricingElementServiceImplementation or PricingPlanService
implementations. It is not called when using PricingRulesImplementation.

TightestMatchInterface includes two interface implementations: FirstMatchImplementation and


TightestMatchServiceImplementation.

• FirstMatchImplementation ignores any condition weights and selects the first price list entry that it finds.
• TightestMatchServiceImplementation uses condition weights to determine the “tightest match” price.
For more information on condition weights, see Using Condition Weights.

NOTE
To use condition weights and the tightest match algorithm set the
TightestMatchServiceImplementation as the active implementation for the
TightestMatchInterface.

© 2021 Vlocity LLC, a Salesforce


company 416
CME CPQ

Using the TighestMatchInterface and Context Rules to Set the "Tightest Match" Price

Tightest Match User Experience


When there is only one “winning” tightest match, the user experience is the same as a standard price list
entry.

However, when there are multiple “winning” tightest matches, the most recent price list entry is selected,
and the price list entries not selected are displayed in the price Details window.

Figure 43. Tightest Match User Experience

© 2021 Vlocity LLC, a Salesforce


company 417
CME CPQ

Condition Weights
Condition weight is a general property of context dimensions. Condition weights are numeric values ranging
from 0 to 60. These values are used by the TightestMatchInterface to calculate the relative weight of rules
assigned to a price list entry.

Condition weight is only used for rules assigned to price list entries or child price lists and not for rules
assigned to products and promotions. Because context dimensions are reusable, a context dimension
might be used for rules for both price list entries and for products or promotions. The condition weight value
is ignored on a context dimension used in a rule for a product or a promotion.

Calculating Condition Weights


When a product is added to the cart, the rules engine determines all of the qualified child price lists and
price list entries based on the configured rules. Then, a weight is assigned to each qualified price list entry.

With multiple price list entries, rules, and conditions, it is important to reduce the possibility for ties, so that a
single price can be selected. Administrators can ensure that certain criteria can win over others by
incrementing condition weight using integers. The Tightest Match algorithm further reduces the possibility of
ties and uses bitwise operators for maximum processing speed, so the weights are calculated as 2n. For
example, 21=2, 22=4, 23=8, 24=16, and so on.

In the following formula, x is the condition weight set on the context dimension used by the child price list
rule and y is condition weight set on the context dimension used by the price list entry rule.

Figure 44. Condition Weight Formula

This formula ensures that price list entries on a child price list will win over price list entries on a parent
price list if all other criteria are equal.

© 2021 Vlocity LLC, a Salesforce


company 418
CME CPQ

Algorithm Assumptions
The Tightest Match algorithm assumes:

• Price list entries with no context rule are assigned a condition weight of 0, or 20, which equals 1.
• Price list entries with a context rule that has a null condition weight are evaluated as 0, or 20, which
equals 1.
• Price list entries with condition weights that are greater than 60 default to 0, or 20, which equals 1.
• Context rules on parent price lists are not evaluated.
• If there are multiple price list entries with the highest weight for the same pricing variable (such as a One
Time Charge or a Monthly Recurring Charge), the interface selects the most recently-created price list
entry and applies that price to the variable in the line item.

Calculating Multiple Condition Weights


A rule can have multiple conditions, each with a different context dimension and condition weight. When
there are multiple rule conditions, the rule conditions are joined together using the expression mode (AND
or OR). The Tightest Match algorithm calculates multiple rule conditions as follows:

• AND: Condition weights are summed together


• OR: The highest condition weight is selected

Figure 45. Calculating Multiple Rule Condition Weights

Ensuring the Right Price Wins


Using Tightest Match, you can more precisely control the selection of the right price by making slight
increments to condition weights.

© 2021 Vlocity LLC, a Salesforce


company 419
CME CPQ

For example, imagine you create two rules that evaluate multiple criteria such as sales channel, geographic
region, customer segment, and SLA/service level, and your business objective is to prioritize existing
customer service level agreements above other criteria. You can weight them as follows:

Criteria Condition Weight


Sales Channel 1
Geographic Region 2
Customer Segment 3
SLA 4

Then, you create two context rules as follows:

• Rule #1 evaluates [Sales Channel] AND [SLA]


• Rule #2 evaluates [Geographic Region] AND [Customer Segment]

The total condition weight for Rule #1 is 1 + 4, and the total condition weight for Rule #2 is 2 + 3. If the
condition weights were simply summed, these rules would tie. However, using the Tightest Match formula,
the business objective of prioritizing the SLA/service level criteria is achieved because using bitwise
operators, the total condition weights are not equivalent.

• Rule #1 = 21 + 24 = 18
• Rule #2 = 22 + 23 = 12

To simplify your rules environment, the right approach is to leave the condition weight property blank for
most context dimensions. Then, when you want to prioritize certain criteria, it is easy to weight conditions
quickly because 21=2, 22=4, 23=8, 24=16, and so on.

Related Information
Create Context Dimensions.

Tightest Match

Qualification Rules for Pricing Adjustments (Contextual Adjustments)


To control the conditions in which a user can apply a manual pricing adjustment, you can use qualification
context rules, starting in Summer '18. This feature is also known as contextual adjustments. You can also
evaluate other data, such as the originating channel field on the order. Starting in the Fall '18 release, you
can define maximum adjustment amounts or percentages, and also create pricing adjustment rules for
specific products. Or you can disable pricing adjustments altogether.

For example, you can allow your platinum SLA accounts up to a 15% manual pricing adjustment, while your
silver SLA accounts only are allowed up to a 10% manual pricing adjustment.

Qualification rules for pricing adjustments evaluate data from the order, opportunity, quote, or account, as
well as adjustment values and adjustment codes the user enters at run time. This approach ensures that
pricing adjustments comply with your organization's business rules.

© 2021 Vlocity LLC, a Salesforce


company 420
CME CPQ

Figure 46. Where Do Qualification Context Rules for Pricing Adjustments Run?

Pricing Adjustments and the AdjustmentData Virtual Object


Context rules for pricing adjustments must be mapped to the AdjustmentData virtual object. The
AdjustmentData virtual object stores data the user enters at runtime in the Adjustment dialog box, such as
adjustment values and adjustment codes. This data is not committed to Salesforce or persisted unless the
rule passes and the user is allowed to apply the pricing adjustment. Instead, this data exists only in memory
during the user's session.

The AdjustmentData virtual object must exist in the shared catalog before you can create rules for pricing
adjustments. For more information about the AdjustmentData virtual object, see AdjustmentData Virtual
Object.

Pricing Adjustments and the AdjustmentData Virtual Context Scope


Context rules for pricing adjustments must use a virtual context scope when creating mappings to the
AdjustmentData virtual object. For more information, see Virtual Context Scopes . For more information on
creating context mappings to the AdjustmentData virtual context scope, Using Source Expressions.

Additional Considerations
• All or Nothing. Before you create context rules for pricing adjustments, users can make pricing
adjustments at any time and for any amount. For more information about pricing adjustments, see
Manually Adjust a Price in the Cart. However, as soon as you create a single rule and assign it to the
AdjustmentData virtual object, pricing adjustment rules are enabled and govern the conditions in which
users can make adjustments. For example, you may want to ensure that orders placed over the web are
only allowed a pricing adjustment up to 5%. After you create and deploy that rule, the only orders that
can be adjusted will be web orders, up to 5%. You will probably want to develop pricing adjustment rules
for other channels and conditions as well, or create a catch-all Else rule condition.

© 2021 Vlocity LLC, a Salesforce


company 421
CME CPQ

• Supported Mappings in Summer '18. In the Summer '18 release, pricing adjustment rules can evaluate
data entered at runtime from the AdjustmentData virtual object as well as fields on Order, Quote,
Opportunity, and Account sObjects. However, as with other context rules, you can't evaluate the following
unless you use a custom function:
• Products currently in the cart
• User profile or role data from the currently logged-in user
• Data stored in related sObjects such as Account.RecordType
• Enhanced Mappings in Fall '18. Starting in the Fall '18 release, you can now create rules to evaluate
product codes, so pricing adjustment rules can be applied to specified products. Also, you can also set
maximum adjustment totals to ensure that multiple adjustments do not exceed defined thresholds.
• Repricing Support. Context rules for pricing adjustments supports repricing. This functionality evaluates
manual pricing adjustments as a part of the repricing process. Any manual pricing adjustments that are
forbidden by current context rules are removed. This approach requires activation of the
RepricingManualAdjEligibilityService implementation for the RepricingManAdjEligibilityInterface.
• Multiple Pricing Adjustments. Users can apply multiple pricing adjustments as long as the adjustments
meet context rule conditions.

Interface Implementations
Context rules for pricing adjustments require the following interface implementations to be active and
default.

Interface Implementation Enables which context rules?


PricingManAdjEligibilityInterface PricingManAdjEligibilityService For qualification context rules for pricing adjustments
RepricingManAdjEligibilityInterface RepricingManualAdjEligibilityService For qualification context rules for pricing adjustments
used in a repricing batch job

Creating a Qualification Rule for Pricing Adjustments


You create qualification rules for pricing adjustments in Vlocity Product Console using the same context rule
components as other context rules. For more information, see Create Qualification Rule Sets.

For details about disabling pricing adjustments, see Creating a Qualification Rule to Disable Pricing
Adjustments

Assigning a Qualification Rule for Pricing Adjustments to the AdjustmentData Virtual


Object
After creating a qualification rule for a pricing adjustment, you must assign it to the AdjustmentData virtual
object. For more information, see Qualification Rules for Pricing Adjustments - Assigning or Deleting to the
AdjustmentData Virtual Object.

AdjustmentData Virtual Object


Starting in the Summer '18 release, data entered by the user at runtime is stored in a new type of object
called a virtual object. This data is not committed to Salesforce or persisted. This data exists only in
memory during the user's session. There is one virtual object called AdjustmentData, and it is used to
create context rules for pricing adjustments.

© 2021 Vlocity LLC, a Salesforce


company 422
CME CPQ

Setting Up the AdjustmentData Virtual Object


The AdjustmentData virtual object must exist in the shared catalog before you can create rules for pricing
adjustments. To set up the AdjustmentData virtual object, go to the EPC Jobs in the CMT Administration
screen and run the Create Default Contextual Adjustment Data job.

NOTE
The Create Default Contextual Adjustment Data job is a one-time job that should be run as
a post-install step after upgrading. However, if you ran this job for the Summer '18 release,
you will need to run it again for the Fall '18 release to receive the latest updates to the
AdjustmentData Virtual Object. (There is no risk in running this job more than once.)

Reviewing the AdjustmentData Virtual Object


You can confirm that the AdjustmentData virtual object was created by reviewing it in the shared catalog as
follows:

1. In Vlocity Product Console, in the Metadata section of the Dashboard, click the search icon next to
Object.
2. In the Search Object dialog box, enter data and click the search icon.
3. Click the name of the AdjustmentData virtual object, or click the edit icon to open the object for
editing.
4. In the sidebar, click Attributes, and review the list of attributes available in this virtual object.

The AdjustmentData virtual object is a system object and must not be altered. Do not change its general
properties or its attributes. If the AdjustmentData object or its attributes are accidentally altered, run Create
Default Contextual Adjustment Data job to reset the object to its original settings.

AdjustmentData Virtual Object Attributes


The AdjustmentData virtual object includes the following attributes. These attributes are used to create
context mappings to virtual data entered at runtime such as AdjustmentValue or AdjustmentType. The
object is also used to evaluate data stored in opportunity, quote, order or account sObjects. In addition, you
can create context mappings to data across opportunities, quotes and orders using the ANY attribute, like
the ANY context scope.

Attribute Purpose
Account Maps to information on the account related to the order, quote or opportunity.
AdjustmentAmountTotal Defines the maximum manual adjustment amount allowed at runtime. Does not include adjustments or
overrides applied at the product level or by an applied promotion.
Available starting in Fall '18

© 2021 Vlocity LLC, a Salesforce


company 423
CME CPQ

Attribute Purpose
AdjustmentMethod Maps to data entered at runtime using the adjustment picklist. Use the following values in your rule
conditions, to evaluate what the user selects.

• If the user selects Percentage, then the AdjustmentMethod value is Percent.


• If the user selects Amount or Override, then the AdjustmentMethod value is Absolute.

AdjustmentPercentTotal Defines the maximum manual adjustment percent allowed. Does not include adjustments or overrides
applied at the product level or by an applied promotion.
Available starting in Fall '18
AdjustmentTotal Defines the maximum manual adjustment allowed, combining absolute and percentages adjustment
totals. Does not include adjustments or overrides applied at the product level or by an applied
Available starting in Fall '18 promotion.

© 2021 Vlocity LLC, a Salesforce


company 424
CME CPQ

Attribute Purpose
AdjustmentType Maps to data entered at runtime using the adjustment picklist. Use the following values in your rule
conditions, to evaluate what the user selects.

• If the user selects Override, then the AdjustmentType value is Override.


• If the user selects Percentage or Amount, then the AdjustmentType value is Adjustment.

AdjustmentValue Maps to data entered at runtime in ADJUSTMENT VALUE box.

ANY Enables you to map to fields across order, quote or opportunity sObjects, similar to the ANY entity
context scope.
Opportunity Maps to fields on the opportunity sObject.
Order Maps to fields on the order sObject.

© 2021 Vlocity LLC, a Salesforce


company 425
CME CPQ

Attribute Purpose
PricingVariableCode Maps to data entered at runtime in the ADJUSTMENT CODE box.

ProductCode Maps to the Product Code field on the Product object. Enables the creation of pricing adjustment rules
for specific products.
Available starting in Fall '18
Quote Maps to fields on the quote sObject.

For details on how to write context mappings to attributes on a virtual object, see Using Source
Expressions.

Penalty Rules for Promotions


To apply a penalty charge when a promotion is canceled in Vlocity Cart, use context rules with a rule type of
Penalty. Because promotions can be canceled only during a move, add, change, or delete operation or
asset-based orders, penalty rules are used only at that stage of the ordering process. Penalty rules can
evaluate one or more conditions under which a penalty might apply. They can also apply different penalty
amounts when those conditions are met.

To cancel a promotion in Vlocity Cart:

1. Click the Promotions tab.


2. Next to the promotion to cancel, click the Cancel button.

© 2021 Vlocity LLC, a Salesforce


company 426
CME CPQ

The Cancel Promotion dialog box opens.


3. Specify a Cancel Date and a Reason for Cancellation.
4. Click Evaluate.

If a penalty rule is triggered, the user is prompted that a penalty will be applied if the promotion is canceled.
The user can continue with the cancellation or keep the promotion.

© 2021 Vlocity LLC, a Salesforce


company 427
CME CPQ

Figure 47. Message to the User Regarding a Penalty

If the user continues with the cancellation, the promotion is given an action status of Disconnect.

Figure 48. Viewing a Canceled Promotion

© 2021 Vlocity LLC, a Salesforce


company 428
CME CPQ

Vlocity Communications, Media, and Energy records the penalty in the Order Pricing object
(vlocity_cmt__OrderPriceAdjustment__c), along with any promotional pricing adjustments that need to
be reversed.

Figure 49. Viewing a Penalty Applied by a Penalty Rule

You create penalty rules in Vlocity Product Console using the same context rule components as
qualification context rules. For more information, see Creating a Penalty Rule.

After creating a penalty rule, you can assign it to a promotion. For more information, see Penalty Rules -
Assigning or Deleting to a Promotion.

Penalty Rules for Contracts


To apply a penalty charge when an asset that is covered by an active contract is deleted or disconnected
using Vlocity Cart, define a penalty rule. The contractual asset must be a root asset and not a child asset.

NOTE
Vlocity Cart does not fully implement penalty rules. Custom configuration is required to
provide a penalty notification message to the user at run time.

To use penalty rules for contracts, you must perform some additional setup steps in addition to creating a
penalty rule and setting up the context rules framework.

• Sett up the ContractTerminationService Interface. Create the following interface and interface
implementation using the following names.
• Interface Name is ContractTerminationService
• Interface Implementation Name is ContractTerminationService

NOTE
For more information about setting up interfaces and interface implementations, see Add a
New Interface and Add a New Interface Implementation.

© 2021 Vlocity LLC, a Salesforce


company 429
CME CPQ

1. Modify the MACD/FDO OmniScript to add a remote action to invoke the


ContractTerminationService.changeToOrder implementation.
2. Modify the CPQ/Submit OmniScript to add two remote actions to invoke
ContractTerminationService.cancelPromotions and ContractTerminationService.submitOrder.
3. Create object level rules for contracts. For more information about object level rules, see Creating
Object Level Rules .

To use penalty rules for contracts, select a root-level asset and begin the asset-based ordering process in
Vlocity Cart. In the order, delete the asset and submit the order. After the order is submitted, the contract
cancellation penalty appears in Order Pricing.

NOTE
Custom configuration is required to provide the user with a cancellation penalty notification
message in Vlocity Cart.

You create penalty rules in Vlocity Product Console using reusable context rule components. See Creating
a Penalty Rule

Evaluation Rules Overview

NOTE
Evaluation rules are only available using an API. Custom configuration is required to
implement them in Vlocity Cart. For more information, contact Vlocity Services.

Evaluation context rules are used exclusively with promotions and evaluate the customer's eligibility for a
promotion after the promotion has been added to the cart. By contrast, qualification context rules determine
eligibility before it is added to the cart.

For example, after adding a promotion to the cart, an agent can change the customer's membership from
Silver to Gold to understand how it affects the promotional price of the product or service. Evaluation rules
can access account information stored in Salesforce, as well as temporary values passed at runtime.
Evaluation rules enable you to create what-if scenarios to determine a customer's qualification for a
promotion by manipulating information at runtime, without committing it to the database and permanently
changing it on the account.

© 2021 Vlocity LLC, a Salesforce


company 430
CME CPQ

Creating Evaluation Rules


Like qualification and penalty context rules, you create and manage evaluation context rules using Vlocity
Product Console. To create an evaluation rule, create a rule set, and then, from the Rule Type picklist,
select Evaluation.

NOTE
If you do not see the value Evaluation in the Rule Types picklist, activate or add
Evaluation to the Rule Type (vlocity_cmt__RuleType__c) picklist values on the
Vlocity Rule object (vlocity_cmt__Rule__c).

© 2021 Vlocity LLC, a Salesforce


company 431
CME CPQ

Invoking Evaluation Rules


Evaluation context rules are not implemented in Vlocity Cart by default. However, you can invoke them
using Vlocity CPQ Web APIs v2 in your custom web application. The parameter ruleEvalutionInput
passes the temporary values that enable the API to handle what-if scenarios.

Format the API request as shown in the following example:

https://{instance}.salesforce.com/services/apexrest/vlocity_cmt/v2/cpq/GET/
carts/{cartid}/promotions?
subaction=getPromotionsAppliedToCart&include=qualifications&ruleType=Evaluation
&category={value}&ruleEvaluationInput={value}

The subaction parameter should be getPromotionsAppliedToCart and the ruleType parameter


should be Evaluation.

Possible category parameter values are:

• disqualified: Returns all promotions for which the customer is disqualified.


• qualified: Returns all promotions for which the customer is eligible.

The ruleEvaluationInput parameter accepts sObject and field values written in JSON notation. For
example, the following API request returns all disqualified promotions using the temporary run time value
specified in the ruleEvaluationInput parameter. In this example, the ruleEvaluationInput
parameter is what if an order's Originating Channel field is set to Web.

/services/apexrest/vlocity_cmt/v2/cpq/carts/8011I000000TNSZ/promotions?
subaction=getPromotionsAppliedToCart&include=qualifications&ruleType=Evaluation
&category=disqualified&ruleEvaluationInput={"Order":
{"OriginatingChannel__c":"Web"}}

See Also
Cart-Based APIs

Using Context Rules with Digital Commerce APIs


The Vlocity Digital Commerce APIs use context rules to determine whether products or promotions are
eligible for purchase by customers based on specific criteria that you define.

As an example, assume you have a catalog configured with two products:

• Product 1: 5G Premium Data Plan


• Product 2: 4G LTE Data Plan

Assume that your business requires that the 5G Premium Data Plan be available in select regions, such as
the West-coast states, while the 4G LTE Data Plan is available to all customers. To support this business
requirement, you can create a qualification context rule for use with the Digital Commerce APIs and assign
it to the 5G Premium Data Plan. For more information, see Qualification Rules for Digital Commerce APIs.

© 2021 Vlocity LLC, a Salesforce


company 432
CME CPQ

After the rule has been created, you must populate the API cache. See Preparing to use Vlocity
Communications API Caching.

Now assume a customer from the West coast is browsing for available data plans. An API call is made to
the GetOffers API with the following context parameter:

?context={"Region":"West"}

The fully formatted API call would be as follows:

/services/apexrest/vlocity_cmt/v3/catalogs/{catalog_code}/offers/{offercode}?
context={"Region":"West"}

The name specified in the parameter, which in this example is “Region”, must match the code of the context
dimension used in the context rule. The value passed, which in this example is “West”, must match the
value specified in the context rule condition in order for the product or promotion to display. You can pass
multiple dimensions in the context parameter as shown below.

?context={"Region":"West",”AccountStatus”:”New”}

At runtime, the Digital Commerce APIs query the API cache and compare the specified context parameters
with cached context dimensions.

Products or promotions that have context rules associated with them will appear in the appropriate cached
context dimension. If a product or promotion in the catalog has no context rule associated with it, it will
appear in all the cached context dimensions. Product and promotions are populated in the cache list in an
inclusive manner. As shown in the table below, the 5G Premium Data Plan product is included in
{"Region":"West",”AccountStatus”:”Active”} and
{"Region":"West",”AccountStatus”:”New”} dimensions because the 5G Premium Data Plan
product is associated with a context rule where the Region = West.

Specified Context Result


{"Region":"West"} 5G Premium Data Plan

4G LTE Data Plan


{"Region":"East"} 4G LTE Data Plan
{"AccountStatus":"Active"} 4G LTE Data Plan
{"AccountStatus":"New"} 4G LTE Data Plan
{"Region":"West",”AccountStatus”:”New”} 5G Premium Data Plan

4G LTE Data Plan


{"Region":"East",”AccountStatus”:”New”} 4G LTE Data Plan
{"Region":"West",”AccountStatus”:”Active”} 5G Premium Data Plan

4G LTE Data Plan


{"Region":"East",”AccountStatus”:”Active”} 4G LTE Data Plan

© 2021 Vlocity LLC, a Salesforce


company 433
CME CPQ

Context Rule Components


You build context rules by combining context rule components. Over time, this will establish a library of
components that can reduce overall development time and expedite new development.

Figure 50. Context Rule Components

The context rules framework consists of the following reusable components:

• Rule sets contain one or more context rules, and are applied to products, promotions, price lists, and
price list entries. See Rule Sets.
• Context rules are analogous to entity filters in the advanced rules framework. Context rules determine
when a rule set applies in Vlocity Cart. See Context Rules.
• Context dimensions are variables that describe the possible values to use in a rule condition. You can
reuse context dimensions across multiple rule conditions. The rules engine compares context dimensions
to data that comes from an sObject, a function, or a static value defined in the context mapping. See
Context Dimensions.
• Context mappings enable the rules engine to compare context dimension variables to data stored in
sObjects, calculated using a function, or entered during design-time in a specified context scope. Vlocity
Communications, Media, and Energy caches context mappings in the session cache. See Context
Mapping.
• Context scopes describe the relational path from a root sObject, such as an Order, to related sObjects.
Context mappings use context scopes to pinpoint the fields on the sObjects or compute data to match
with context dimension variables so the Context Rule Service engine can evaluate them. See Context
Scopes.

© 2021 Vlocity LLC, a Salesforce


company 434
CME CPQ

• Functions are used in context mappings. You can invoke custom implementations to provide additional
logic and processing. See Functions for Rules.
• Object level rules assign penalty rules for contracts. See Creating Object Level Rules.
• Context actions can be used with penalty rules to apply a fee when a promotion or contract is canceled.
Context actions enable you to specify either a flat fee using a pricing element on a price list or calculate a
fee by invoking a custom implementation. See Creating Context Actions.

You combine context rule components to create logical expressions that the rules engine can evaluate. For
example:

Context Rule Condition = true WHEN {{Context Dimension}} == {{Context


Mapping[Context Scope.Source Expression]}}

Rule Sets
A rule set is a logical grouping of one or more context rules. Use a rule set to designate how the grouped
context rules are expressed in a logical expression and how they are used in Vlocity Cart.

Figure 51. Rule Sets

Rule Types
Rule sets have a Rule Type property. The rule type property controls how the rules are used in Vlocity Cart.
There are three rule types.

• Qualification
• Penalty
• Evaluation

For more information about rule types, see Types of Context Rules .

© 2021 Vlocity LLC, a Salesforce


company 435
CME CPQ

Expression Mode
Rule sets can also define an Expression Mode. Use the expression mode when there are multiple context
rules contained in the rule set. The expression mode describes how the rules engine compiles the child
context rules into a logical expression. See Child Rules and Expression Modes and Custom Expressions .

Header Rules
To optimize rules processing, you can set one of the children context rules in the rule set as the header
rule. For more information about header rules, see Header Rule.

Rule Sets and the CPQPartition Platform Cache


Starting in Vlocity Communications, Media, and Energy Summer '18, rule sets, context rules, and rule
conditions are stored in the org cache of the CPQPartition platform cache to optimize performance. When
creating or updating rule sets, you must clear the cache before your changes are reflected.

Rule Set Assignment


Assign rules sets to products, promotions, price lists, price list entries, child price lists, or pricing
adjustments.

For more information about how to assign rule sets, see the following topics:

• Qualification Rule Sets


• Qualification Rules - Assigning or Deleting to Products
• Qualification Rules - Assigning or Deleting to Promotions
• Qualification Rules - Assigning or Deleting to Price Lists
• Qualification Rules - Assigning or Deleting to Price List Entries
• Qualification Rules - Assigning or Deleting to for Price List EntriesChild Price Lists
• Qualification Rules for Pricing Adjustments - Assigning or Deleting to the AdjustmentData Virtual
Object
• Penalty Rule Sets
• Penalty Rules - Assigning or Deleting to a Promotion
• Penalty Rules for Contracts
• Evaluation Rule Sets
• Evaluation Rules Overview

Create rule sets in Vlocity Product Console. For more information about how to create rule sets, see
Creating Rule Sets.

Header Rule
To configure which rule is executed first when you have multiple children rules in a rule set, you can specify
one of the rules as the header rule. If the header rule does not pass, processing stops on the entire rule set.
Using header rules enables you to optimize rule set evaluation.

Header Rule Processing Logic


When a header rule exists, the rules engine processes it using an AND expression with the children rules'
expression mode. The header rule must pass before the rules engine evaluates the children rules using the
expression mode declared in the rule set, which can be And, Or, Custom, If Else If, or If.

© 2021 Vlocity LLC, a Salesforce


company 436
CME CPQ

Figure 52. Header Rule Processing Logic

Setting a Header Rule


Set a header rule using the Header Rule Lookup dialog box in the rule set General Properties facet.

© 2021 Vlocity LLC, a Salesforce


company 437
CME CPQ

Figure 53. Setting a Header Rule in the Rule Set General Properties Facet

© 2021 Vlocity LLC, a Salesforce


company 438
CME CPQ

Expression Modes and Custom Expressions


When a rule set contains more than one child context rule, you must use the expression mode to specify
how the rules engine combines the child rules into a logical expression.

The possible expression modes are:

• And (the default): Requires that all of the child rules in the rule set pass for the rule set to pass. If one
child rule fails, the rule set fails. Used only with qualification rules.
• Or: Requires that only one of the child rules in the rule set passes for the rule set to pass. If one child rule
passes, the rule set passes. Used only with qualification rules.
• Custom: Uses a custom logical expression defined in the Expression property to evaluate the rule set.
Used only with qualification rules. See Custom Expression Definition for more information.
• If Else If: Evaluates the first child rule in the rule set and if it does not pass, continues to subsequent
children rules in the sequence. After a rule passes, it stops processing. The best practice is to set the last
rule to always be true, creating a fallback action. Used with penalty rules to apply different penalty
amounts using context actions.
• If: Evaluates the first child rule in the rule set. If it does not pass, continues to evaluate all subsequent
child rules in sequence. Continues to process until all child rules are processed. Used with penalty rules,
when more than one penalty may be applied.

Custom Expression Definition


When the Expression Mode is set to Custom, you can create a custom logical expression that the rules
engine uses to evaluate the children rules. You enter the custom expression in the Expression property in
the rule set.

When writing the custom expression, use the following syntax rules:

© 2021 Vlocity LLC, a Salesforce


company 439
CME CPQ

• Use AND and OR operators only.


• Refer to child context rules using rule codes.
• Use spaces to delimit each expression element.
• Use parentheses to sequence order of operations for the expression.
• Expressions are case-sensitive.

The following are some example expressions:

( Rule1Code OR Rule2Code )
( ( Rule1Code AND Rule2Code ) OR ( Rule3Code AND Rule4Code ) )
( ( Rule1Code OR Rule2Code ) AND ( Rule3Code ) AND ( Rule4Code ) )

Failure Messages
When creating context rules, you can create failure messages for the following entities: rule sets, context
rules, and rule conditions.

Failure Messages for Rule Sets Assigned to Products and Promotions


Failure messages for rule sets assigned to a product or promotion display in the Disqualified subtab of
Vlocity Cart. The message will be ignored if the same rule set is applied to a price list or price list entry.

© 2021 Vlocity LLC, a Salesforce


company 440
CME CPQ

Figure 54. Setting a Failure Message for a Rule Set

© 2021 Vlocity LLC, a Salesforce


company 441
CME CPQ

Figure 55. Failure Message Appears in Vlocity Cart

Failure Messages for Rule Sets Assigned to Pricing Adjustments


You can alert users when they enter invalid pricing adjustments by specifying a failure message in the rule
set assigned to the pricing adjustment. When the user enters an invalid adjustment value or code, a toast
message displays above the pricing adjustment dialog box.

© 2021 Vlocity LLC, a Salesforce


company 442
CME CPQ

To enable the display of failure messages for pricing adjustments, set the CPQ Toast Message Log Level
in the CPQ Configuration Setup custom settings to All. For more information on this custom setting, see
CPQ Configuration Settings Reference. When changing a failure message for a pricing adjustment, you

© 2021 Vlocity LLC, a Salesforce


company 443
CME CPQ

must clear the CPQPartition platform cache to ensure your changes display. For more information, see
Configuring CPQ Platform Cache.

Using Context Rule Message Service API


You can access failure messages for all entities using the Context Rule Message Service API. For more
information, see Context Rule Message Service.

Create Rule Sets


A rule set is a logical grouping of one or more context rules. A rule set enables you to designate how the
grouped context rules are expressed in a logical expression and how they are used in Vlocity Cart. To
create a rule set, you define general properties and then specify one or more context rules as child rules.

Starting in Summer '18, context rules, rule sets and rule conditions are cached in the org cache of the
CPQPartition. In order to see your changes reflected at runtime, run the Clear Managed Platform Cache
job in the CMT Administration Maintenance jobs page.

To create a rule set:

1. In Vlocity Product Console, in the Rules list, next to Rule Set, click Create .
2. On the New Rule Set tab, enter the following information.

Property Value Description


Name String value The rule set name. This name is displayed in rule selection dialog
boxes and in related lists when assigned to products, promotions,
price lists, and price list entries.
Rule Type • Qualification The rule type property controls how the rules are used in Vlocity
• Penalty Cart. See Types of Context Rules.
• Evaluation
Rule Purpose n/a The rules engine does not currently use this field.
Expression • AND Use expression mode when there are multiple context rules
Mode • OR contained in the rule set. It describes how the rules engine
• Custom compiles the child context rules into a logical expression. See
• If Else If Expression Modes and Custom Expressions.
• If
Expression • Use AND and OR operators to Specifies a custom logical expression. Used when Expression
create custom expression. Mode is set to Custom. See Expression Modes and Custom
• Refer to child context rules using Expressions.
rule codes.
• Use spaces to delimit each rule
code.
• Use parentheses to sequence
order of operations for the
expression.
• Expressions are case-sensitive.
Failure String value Text specified in this property appears in the Disqualified subtab
Message of Vlocity Cart when the rule set is applied to a product or a
promotion. It is not used when applied to a price list or price list
entry. See Failure Messages.
Header Rule Select a context rule using the Specify a header rule for the rule set. See Header Rule.
Header Rule Lookup dialog box.

© 2021 Vlocity LLC, a Salesforce


company 444
CME CPQ

Property Value Description


Active Click to select The context rule service evaluates only active rule sets.
Effective Start Select a date The start date of the period during which the object-level rule is
Date effective.
Effective End Select a date The end date of the period during which the object-level rule is
Date effective.
3. Click Save.
4. Specify one or more context rules as child rules of the rule set.
a. In the sidebar, click Children Rules.
b. In the Children Rules facet, click New Child Rule. The General Properties section appears.

Property Value Description


Rule Select a context rule using Specifies the child context rule to include in the rule set.
the Entity Filter Lookup
dialog box.
Sequence Numeric value Specifies the child rule sequence. Use a sequence of 10, 20, 30, and so
on to allow for easier sequence changes in the future.
Action Taken • Policy Action Specifies the action to take when the child context rule passes or
• No Action evaluates to true.
• Qualify
For penalty rules, select Policy Action or No Action. If you select
• Do Not Qualify
Policy Action, specify a Context Action in the next property.

For qualification rules, select Qualify or Do Not Qualify. When used


with products or promotions, these actions correspond to the Qualified
and Disqualified tabs in the Products and Promotions lists in Vlocity Cart.
Context Select a context action Specifies a Context Action. Used when Action Taken property is set to
Action using the Context Action Policy Action. See Creating Context Actions.
Lookup dialog box.
5. Click Save.

Create Qualification Rule Sets


Create qualification context rules as rule sets in Vlocity Product Console using reusable context rule
components.

To create new qualification context rule sets:

1. Choose a context scope for the rule. If the context scope does not exist, create it. For more information
about creating context scopes, see Creating Context Scopes.
2. Choose a context dimension for the rule. If the context dimension does not exist, create it. For more
information about creating context dimensions, see Creating Context Dimensions.
3. Choose a context rule to use in the rule set. If the context rule does not exist, create it. For more
information about creating context rules, see Creating Context Rules.
4. Create a qualification rule set.
a. In Vlocity Product Console under Rules, click the create icon next to Rule Set.
b. In the New Rule Set dialog box, enter the following information.

© 2021 Vlocity LLC, a Salesforce


company 445
CME CPQ

Property Sample Value Description


Name String value The name of the rule set. This name is displayed in rule selection
dialog boxes and in related lists when assigned to products,
promotions, price lists, price list entries, and pricing adjustment
objects.
Rule Type Qualification The rule type property controls how a rule set is used in Vlocity
Cart. This property determines whether a rule set is a
qualification rule set, a penalty rule set, or an evaluation rule set.
Rule Purpose n/a This field is not currently used by the rules engine.
Expression AND | OR | Custom | If Else IF Expression Mode is used when there are multiple context rules
Mode contained in the rule set. It describes how the rules engine
compiles the child context rules into a logical expression. For
more information, see Child Rules and Expression Modes.

The If Expression mode is not used with qualification rule sets.


Expression • Use AND and OR operators Expression is used when Expression mode is Custom, to enable
to create custom expression you to specify a custom logical expression. For more information,
• Refer to child context rules see Child Rules and Expression Modes.
using rule codes
• Use spaces to delimit each
rule code
• Use parentheses to sequence
order of operations for the
expression
• Expressions are case-
sensitive
Failure String value This message is displayed in the Disqualified subtab of Vlocity
Message Cart when the rule set is applied to a product or a promotion. If
the rule set is applied to a pricing adjustment, it is displayed as a
toast message in Vlocity Cart. It is not used when applied to a
price list or price list entry. For more information, see Failure
Messages.
Header Rule Select a context rule using the Enables you to specify a Header Rule for the rule set. For more
Header Rule Lookup dialog. information, see Header Rule.
Effective Start Select a date The start date of the period during which the rule set will be
Date effective.
Effective End Select a date The end date of the period during which the rule set will be
Date effective.
c. Click Save.
d. In the left sidebar, click Children Rules.
e. In the Children Rules facet, click New Child Rule.
The General Properties window appears.
f. Enter values for the property fields:

PropertyField Sample Value Description


Name
Rule Select a context rule using the Specifies the child context rule to include in the rule set.
Entity Filter Lookup dialog
box.
Sequence 10 | 20 | 30 ... Specifies the child rule sequence. Use a sequence of 10,
20, 30, etc. to allow for easier sequence changes in future.

© 2021 Vlocity LLC, a Salesforce


company 446
CME CPQ

PropertyField Sample Value Description


Name
Action Taken Qualify or Do Not Qualify Because this is a Qualification context rule, the Action
Taken must be Qualify or Do Not Qualify.
Context Action n/a Context Action is not used when Action Taken is Qualify
or Do Not Qualify.

This procedure creates a new qualification rule set. The next step is to assign it to a product, promotion,
price list, price list entry or pricing adjustment object.

Qualification Rules - Assigning or Deleting to Products


To assign a qualification context rule to a product:

1. In Vlocity Product Console, under Product Management, find the product to which you want to assign a
context rule.
2. To open the product for editing, click the PRODUCT NAME or the edit icon.
3. In the left sidebar, click Context Rules.
4. In the Context Rules facet, click Add Rule Set. The Add Rule Set dialog opens.
5. In the Add Rule Set dialog, search for and select the context rule you want to assign.
6. In the Add Rule Set dialog, click Save.
7. The context rule you assigned to the product will now appear in the Context Rules facet
QUALIFICATION list.

To delete a qualification context rule for a product:

1. In Vlocity Product Console, under Product Management, find the product to which you want to assign a
context rule.
2. Click the PRODUCT NAME or the edit icon to open the product for editing.
3. In the left sidebar, click Context Rules.
4. In the Context Rules facet in the QUALIFICATION list, find the context rule you want to delete, and
click Delete in the right side of the table row for that context rule.
5. In the Delete Rule Set dialog, click Delete.

Qualification Rules - Assigning or Deleting to Promotions


To assign a qualification context rule to a promotion:

1. In Vlocity Product Console, under Product Management, find the promotion to which you want to
assign a context rule.
2. Click the PROMOTION NAME or the edit icon to open the promotion for editing.
3. In the left sidebar, click Context Rules.
4. In the Context Rules facet, click Add Rule Set. The Add Rule Set dialog opens.
5. In the Add Rule Set dialog, search for and select the context rule you want to assign.
6. In the Add Rule Set dialog, click Save.

© 2021 Vlocity LLC, a Salesforce


company 447
CME CPQ

The context rule you assigned to the promotion is displayed in the Context Rules facet QUALIFICATION
list.

To delete a qualification context rule for a promotion:

1. In Vlocity Product Console, under Product Management, find the promotion to which you want to
assign a context rule.
2. Click the PROMOTION NAME or the edit icon to open the promotion for editing.
3. In the left sidebar, click Context Rules.
4. In the Context Rules facet in the QUALIFICATION list, find the context rule you want to delete, and
click Delete in the right side of the table row for that context rule.
5. In the Delete Rule Set dialog, click Delete.

Qualification Rules - Assigning or Deleting to Price List Entries


There are two ways to assign a rule set to a price list entry, depending on how you access the price list
entry. You can access price list entries from a price list or from a product.

When you access a price list entry from a product, you will be able to see all price list entries for that
product across multiple price lists, which provides a useful perspective.

To assign a qualification rule to a price list entry via a product:

1. In Vlocity Product Console, under Product Management, find the product that has the price list entry to
which you want to assign a rule set.
2. Click the PRODUCT NAME or the edit icon to open the product for editing.
3. In the left sidebar, click Pricing.
4. In the Pricing facet in the CHARGES list, find (or create) the price list entry to which you want to
assign the context rule.
5. Click the edit icon. The PRICE LIST ENTRY pane appears on the right.
6. In the PRICE LIST ENTRY pane, click the CONTEXT RULES tab at the top of the pane.
7. In the PRICE LIST ENTRY pane, click Add Rule Set. The Add Rule Set dialog opens.
8. In the Add Rule Set dialog, search for and select the context rule you want to assign.
9. In the Add Rule Set dialog, click Save.
10. The context rule you assigned will now appear in the Context Rules facet QUALIFICATION list.

To assign a qualification rule to a price list entry via a price list:

1. In Vlocity Product Console, under Pricing, find the price list to which you want to assign a context rule.
2. Click the PRICE LIST NAME or the edit icon to open the price list for editing.
3. In the left sidebar, click Price List Entries.
4. In the Price List Entries facet, scroll to find the price list entry to which you want to assign the context
rule.
5. Click the edit icon. The PRICE LIST ENTRY pane appears on the right.
6. In the PRICE LIST ENTRY pane, click the CONTEXT RULES tab at the top of the pane.
7. In the PRICE LIST ENTRY pane, click Add Rule Set. The Add Rule Set dialog opens.

© 2021 Vlocity LLC, a Salesforce


company 448
CME CPQ

8. In the Add Rule Set dialog, search for and select the context rule you want to assign.
9. In the Add Rule Set dialog, click Save.
10. The context rule you assigned will now appear in the Context Rules facet QUALIFICATION list.

Deleting a Qualification Rule for a Price List Entry


There are two ways to delete a rule set for a price list entry, depending on how you access the price list
entry. You can access price list entries from a price list or from a product.

To delete a qualification rule for a price list entry via a product:

1. In Vlocity Product Console, under Product Management, find the product that has the price list entry to
which you want to assign a rule set.
2. Click the PRODUCT NAME or the edit icon to open the product for editing.
3. In the left sidebar, click Pricing.
4. In the Pricing facet in the CHARGES list, find the price list entry for which you want to delete the
context rule.
5. Click the edit icon. The PRICE LIST ENTRY pane appears on the right.
6. In the PRICE LIST ENTRY pane, click the CONTEXT RULES tab at the top of the pane.
7. In the Context Rules facet in the QUALIFICATION list, find the context rule you want to delete and
click Delete on the right side of the table row for that context rule.
8. In the Delete Rule Set dialog, click Delete.

To delete a qualification rule for a price list entry via a price list:

1. In Vlocity Product Console, under Pricing, find the price list for which you want to delete a rule set.
2. Click the PRICE LIST NAME or the edit icon to open the price list for editing.
3. In the left sidebar, click Price List Entries.
4. In the Price List Entries facet, scroll to find the price list entry for which you want to delete the context
rule.
5. Click the edit icon. The PRICE LIST ENTRY pane appears on the right.
6. In the PRICE LIST ENTRY pane, click the CONTEXT RULES tab at the top of the pane.
7. In the Context Rules facet in the QUALIFICATION list, find the context rule you want to delete and
click Delete on the right side of the table row for that context rule.
8. In the Delete Rule Set dialog, click Delete.

Assigning a Qualification Rule to a Child Price List


You can assign qualification rules directly to a price list entry. However, if you want to assign the same rule
to many price list entries, it is usually easier to group price list entries in a child price list and assign the
context rule to the child price list.

© 2021 Vlocity LLC, a Salesforce


company 449
CME CPQ

NOTE
Price list entries on a child price lists will be weighted higher than price list entries on a
regular price list. See Condition Weights.

To assign a qualification rule to a child price list:

1. In Vlocity Product Console, under Pricing, find the price list that contains the child price list to which
you want to assign a context rule.
2. Click the PRICE LIST NAME or the edit icon to open the price list for editing.
3. In the left sidebar, click Hierarchy.
4. Click the name of the child price list to which you want to assign a context rule.
5. In the left sidebar, click Context Rules.
6. In the Context Rules facet, click Add Rule Set. The Add Rule Set dialog opens.
7. In the Add Rule Set dialog, search for and select the context rule you want to assign.
8. In the Add Rule Set dialog, click Save.
9. The context rule you assigned will now appear in the Context Rules facet QUALIFICATION list.

Deleting a Qualification Rule from a Child Price List


To delete a qualification rule from a child price list:

1. In Vlocity Product Console, under Pricing, find the price list that contains the child price list to which
you want to assign a rule set.
2. Click the PRICE LIST NAME or the edit icon to open the price list for editing.
3. In the left sidebar, click Hierarchy.
4. Click the name of the child price list to which you want to assign a context rule.
5. In the left sidebar, click Context Rules.
6. In the Context Rules facet in the QUALIFICATION list, find the context rule you want to delete, and
click Delete in the right side of the table row for that context rule.
7. In the Delete Rule Set dialog, click Delete.

Qualification Rules - Assigning or Deleting to Child Price Lists


You can assign qualification context rules directly to a price list entry. If you want to assign the same rule to
many price list entries, it is usually easier to group price list entries in a child price list and assign the
context rule to the child price list.

NOTE
Price list entries on a child price list will be weighted higher than price list entries on a
regular price list. See Condition Weights.

© 2021 Vlocity LLC, a Salesforce


company 450
CME CPQ

To assign a qualification rule to a child price list:

1. In Vlocity Product Console, under Pricing, find the price list that contains the child price list to which
you want to assign a context rule.
2. Click the PRICE LIST NAME or the edit icon to open the price list for editing.
3. In the left sidebar, click Hierarchy.
4. Click the name of the child price list to which you want to assign a context rule.
5. In the left sidebar, click Context Rules.
6. In the Context Rules facet, click Add Rule Set. The Add Rule Set dialog opens.
7. In the Add Rule Set dialog, search for and select the context rule you want to assign.
8. In the Add Rule Set dialog, click Save.
9. The context rule you assigned will now appear in the Context Rules facet QUALIFICATION list.

To delete a qualification rule from a child price list:

1. In Vlocity Product Console, under Pricing, find the price list that contains the child price list to which
you want to assign a context rule.
2. Click the PRICE LIST NAME or the edit icon to open the price list for editing.
3. In the left sidebar, click Hierarchy.
4. Click the name of the child price list to which you want to assign a context rule.
5. In the left sidebar, click Context Rules.
6. In the Context Rules facet in the QUALIFICATION list, find the context rule you want to delete and
click Delete in the right side of the table row for that context rule.
7. In the Delete Rule Set dialog, click Delete.

Creating a Qualification Rule to Disable Pricing Adjustments


In some implementations, you might want to prevent users from making manual pricing adjustments. You
can configure the card templates of Vlocity Cart to remove this capability, or you can create a context rule
to not allow pricing adjustments.

To create a new qualification context rule set to not allow pricing adjustments, follow these instructions.

For this rule to disable pricing adjustments, it must be the only context rule for pricing adjustments in your
org. To conditionally disable pricing adjustments, you must specify additional context rule conditions to
restrict its scope, such as account SLA or order originating channel.

Verify the Adjustment Virtual Context Scope


You must use the AdjustmentData virtual context scope for your rule. If this context scope does not exist,
create it. For more information about creating context scopes, see Creating Context Scopes. For more
information on virtual context scopes, see Virtual Context Scopes.

Create the Context Dimension and Context Mapping to the AdjustmentData Virtual
Object
To create a context dimension with a context mapping to the AdjustmentData virtual object for the rule:

© 2021 Vlocity LLC, a Salesforce


company 451
CME CPQ

1. In Vlocity Product Console, in the Rules area, next to Context Dimension, click Create .
2. On the New Context Dimension tab, enter the following information.

Property Value Description


Name AdjustmentValue The name of this context dimension.

NOTE
You cannot use spaces in a context
dimension name due to rules parsing
engine requirements.

Code DIM_ADJVALUE The code of this context dimension.

NOTE
You cannot use spaces in a context
dimension code due to rules parsing
engine requirements.

Description Context dimension mapped to Specify the purpose of this context dimension.
AdjustmentData.AdjustmentValue
Condition n/a This property is not used for context rules for pricing
Weight adjustments.
Data Type Text Data type of this context dimension.
Domain Type Type in Describes how rule condition values appear when creating a
rule condition.
Object n/a Not needed since the Domain Type is Type in.
Vlocity Picklist n/a Not needed since the Domain Type is Type in.
Picklist n/a Not needed since the Domain Type is Type in.
Selection Mode
Active Click to select Only active context dimensions will be evaluated by the rules
engine.
Effective From [today's date] Specifies the start date of the period during which rules can use
Date the context dimension.
Effective Until n/a Not needed.
Date
3. Click Save.
4. In the left sidebar, click Context Mappings.
5. In the Context Mappings facet, click New Context Mapping.
6. In the New Context Mapping dialog box, enter the following information.

Property Value Description


Context Scope Select the AdjustmentData Specifies the context scope that is linked to this context mapping.
virtual context scope using the
Context Scope Lookup dialog Context rules for pricing adjustments must use the AdjustmentData
box. virtual context scope.

© 2021 Vlocity LLC, a Salesforce


company 452
CME CPQ

Property Value Description


Initialization Policy Always Reinitialize Specifies how frequently context mapping values are refreshed in
the session cache.

Context rules for pricing adjustments must Always


Reinitialize .
Initialization Type Source Expression Specifies where to retrieve the data that will be used to compare to
the rule condition.
Source AdjustmentValue Specifies the name of attribute on the AdjustmentData virtual object.
Expression For more information, see The AdjustmentData Virtual Object
Sequence 10 Specifies the context mapping sequence. To allow for sequence
changes, specify 10, 20, 30, and so on.
Active Click to select Only active context mappings will be evaluated by the rules engine.
Effective From [today's date] Specifies the start date of the period during which rules can use the
Date context mapping.
Effective Until n/a Not needed.
Date
7. Click Save.

Create the Context Rule


To create a context rule and rule conditions to evaluate the AdjustmentValue context dimension and context
mapping:

1. In Vlocity Product Console in the Rules area, next to Rules, click Create .
2. In the New Rule dialog box, enter the following information.

Property Value Description


Name No Pricing Adjustments Rule The name of the context rule
Code NO_PRICING_ADJ_RULE The code by which you will refer to this context rule. Rule
code is used when creating custom expressions. For more
information, see Expression Modes and Custom
Expressions.
Description This rule ensures no pricing adjustments Describes the purpose of the context rule.
are allowed.
Expression Mode n/a Not needed.
Expression n/a Not needed.
Failure Message n/a This message is not currently displayed in Vlocity Cart.
Active Click to select Only active context rules will be evaluated the context rule
service.
Effective Start Date [today's date] Specifies the start date of the period during which rules
can use the context mapping.
Effective End Date n/a Not needed.
3. Click Save.
4. In the sidebar, click Rule Conditions.
5. In the Rule Conditions facet, click Add Condition.
6. Select Simple.
7. Enter the following information in the General Properties window.

© 2021 Vlocity LLC, a Salesforce


company 453
CME CPQ

Property Value Description


Code RC-ADJVALUE The code by which you will refer to this rule condition.
Context Select the AdjustmentValue Specifies the context dimension to use with this rule condition.
Dimension context dimension using the
Context Dimension Lookup
dialog box.
Operator == Specifies the operator the context rule service uses to compare the
Value property to the context mapping.
Value 0 Specifies the value the context rule service uses to compare to the
context mapping.
Fail Level n/a Fail Level is not implemented currently in Vlocity Cart.
Failure Message n/a This message is not currently displayed in Vlocity Cart. Instead, set the
failure message on the rule set. For more information on failure
messages, see Failure Messages.
8. Click Save.

Create the Rule Set


Create a qualification rule set for the AdjustmentValue context rule.

1. In Vlocity Product Console under Rules, next to Rule Sets, click Create .
2. In the New Rule Set dialog box, enter the following information.

Property Value Description


Name No Pricing Adjustments The name of the rule set. This name is displayed in rule selection
Rule Set dialog boxes and in related lists when assigned to products,
promotions, price lists, price list entries, and pricing adjustment
objects.
Rule Type Qualification Pricing adjustment rules must be of type Qualification.
Rule Purpose n/a This field is not currently used by the rules engine.
Expression Mode n/a Not needed
Expression n/a Not needed
Failure Message Manual pricing adjustments This message is displayed as a toast message in Vlocity Cart. For
are not allowed. more information, see Failure Messages.
Header Rule n/a Not needed
Effective Start Date Select a date The start date of the period during which the rule set will be effective.
Effective End Date Select a date The end date of the period during which the rule set will be effective.
3. Click Save.
4. In the left sidebar, click Children Rules.
5. In the Children Rules facet, click New Child Rule. The General Properties window appears.

Property Value Description


Rule Select the No Pricing Specifies the child context rule to include in the rule set.
Adjustments Rule context rule
using the Entity Filter Lookup
dialog box.
Sequence 10 Specifies the child rule sequence. Use a sequence of 10, 20, 30,
etc. to allow for easier sequence changes in future.

© 2021 Vlocity LLC, a Salesforce


company 454
CME CPQ

Property Value Description


Action Taken Do Not Qualify By specifying Do Not Qualify as the Action Taken, the rules
engine will not allow users to apply pricing adjustments of 0 or any
other amount.
Context Action n/a Not needed.
6. Click Save.

This procedure creates the pricing adjustment qualification rule set. The next step is to assign it to the
pricing adjustment virtual object. For details, see Qualification Rules for Pricing Adjustments - Assigning or
Deleting to the AdjustmentData Virtual Object.

After this rule set is assigned, you can test its functionality in Vlocity Cart with an order, quote, or
opportunity. Enter any value in the Adjustment Value text entry box, and verify that a toast message is
displayed, as shown in the screenshot below.

Figure 56. No Pricing Adjustment Rule Set at Run Time

© 2021 Vlocity LLC, a Salesforce


company 455
CME CPQ

Qualification Rules - Assigning or Deleting to Price Lists


To assign a qualification context rule to a price list:

1. In Vlocity Product Console, under Pricing, find the price list to which you want to assign a context rule.
2. Click the PRICE LIST NAME or the edit icon to open the price list for editing.
3. In the left sidebar, click Context Rules.
4. In the Context Rules facet, click Add Rule Set. The Add Rule Set dialog opens.
5. In the Add Rule Set dialog, search for and select the context rule you want to assign.
6. In the Add Rule Set dialog, click Save.

The context rule you assigned to the price list displays in the Context Rules facet QUALIFICATION list.

To delete a qualification context rule for a price list:

1. In Vlocity Product Console, under Pricing, find the price list for which you want to delete a context rule.
2. Click the PRICE LIST NAME or the edit icon to open the price list for editing.
3. In the left sidebar, click Context Rules.
4. In the Context Rules facet in the QUALIFICATION list, find the context rule you want to delete, and
click Delete in the right side of the table row for that context rule.
5. In the Delete Rule Set dialog, click Delete.

Qualification Rules for Pricing Adjustments - Assigning or Deleting to the


AdjustmentData Virtual Object
To assign a qualification context rule to the AdjustmentData virtual object:

1. In Vlocity Product Console, in the Metadata section of the Dashboard, click the search icon next to
Object.
2. In the Search Object dialog box, enter data and click the search icon.
3. Click the name of the AdjustmentData virtual object, or click the edit icon to open the object for
editing.
4. In the sidebar, click Context Rules.
5. In the Context Rules facet, click Add Rule Set. The Add Rule Set dialog box opens.
6. In the Add Rule Set dialog box, search for and select the context rule you want to assign.
7. In the Add Rule Set dialog box, click Save.
8. The context rule you assigned to the virtual object is displayed in the Context Rules facet
QUALIFICATION list.

To delete a qualification context rule for the AdjustmentData virtual object:

1. In Vlocity Product Console, in the Metadata section of the Dashboard, find the AdjustmentData virtual
object.
a. Click the search icon next to Object.
b. In the Search Object dialog box, enter data and click the search icon.
c. To edit the object, click the name of the AdjustmentData virtual object, or click the edit icon.

© 2021 Vlocity LLC, a Salesforce


company 456
CME CPQ

2. In the sidebar, click Context Rules.


3. In the Context Rules facet in the QUALIFICATION list, find the context rule you want to delete, and
click Delete in the right side of the table row for that context rule.
4. In the Delete Rule Set dialog, click Delete.

Create a Penalty Rule


Create penalty rule sets in Vlocity Product Console using reusable context rule components.

For more information on context rule sets, see Creating Rule Sets.

To create new penalty context rule sets, perform the following steps:

1. Choose a context scope to use for your rule. If the context scope does not exist, create it. For more
information on creating context scopes, see Create Context Scopes.
2. Choose a context dimension to use for your rule. If the context dimension does not exist, create it. For
more information on creating context dimensions, see Create Context Dimensions.
3. Choose a context rule to use in your rule set. If the context rule does not exist, create it. For more
information on creating context rules, see Create Rules.
4. Create a penalty rule set.
a. In Vlocity Product Console under Rules, click the create icon next to Rule Set.
b. In the New Rule Set dialog, enter the following information.

Property Value Description


Name String value The name of the rule set. This name is displayed in rule
selection dialogs and in related lists when assigned to
promotions.
Rule Type Penalty The rule type property controls how the rules are used in
Vlocity Cart.
Rule Purpose n/a This field is not currently used by the rules engine.
Expression If Else If | If Expression Mode is used when there are multiple context rules
Mode contained in the rule set. It describes how the rules engine
compiles the child context rules into a logical expression. For
more information, see Child Rules and Expression Modes. The
AND, OR, and Custom Expression Modes are not used with
penalty rule sets.
Expression • Use AND and OR operators to Expression is not used with penalty rule sets.
create custom expression
• Refer to child context rules Expression is used when Expression Mode is Custom, to
using rule codes enable you to specify a custom logical expression. For more
information, see Child Rules and Expression Modes.
• Use spaces to delimit each
rule code
• Use parentheses to sequence
order of operations for the
expression
• Expressions are case-
sensitive
Failure n/a Failure messages are not used with penalty rules.
Message
Header Rule Select a context rule using the Enables you to specify a Header Rule for the rule set. For more
Header Rule Lookup dialog. information, see Header Rule.

© 2021 Vlocity LLC, a Salesforce


company 457
CME CPQ

Property Value Description


Effective Start Select a date The start date of the period during which the object level rule is
Date effective.
Effective End Select a date The end date of the period during which the object level rule is
Date effective.
c. Click Save.
d. In the left sidebar, click Children Rules.
e. In the Children Rules facet, click New Child Rule.
The General Properties window appears.
f. Enter values for each property.

Property Value Description


Rule Select a context rule using the Specifies the child context rule to include in the rule set.
Entity Filter Lookup dialog.
Sequence 10 | 20 | 30 ... Specifies the child rule sequence. Vlocity recommends using a
sequence of 10, 20, 30, etc. to allow for easier sequence
changes in future.
Action Taken Policy Action Since this is a Penalty context rule, the Action Taken should be
Policy Action or No Action.
Context Action Select a context action using the Specifies the context action to use when the Action Taken is set
Context Action Lookup dialog. to Policy Action.
5. Click Save.

This procedure creates a new penalty rule set. The next step is to assign it to a promotion or to use it to
create an object level rule for contracts.

Penalty Rules - Assigning or Deleting to a Promotion


To assigning a penalty context rule to a promotion:

1. In Vlocity Product Console, under Product Management, find the promotion to which you want to
assign a rule set.
2. Click the PROMOTION NAME or the edit icon to open the promotion for editing.
3. In the left sidebar, click Context Rules.
4. In the Context Rules facet, click Add Rule Set. The Add Rule Set dialog opens.
5. In the Add Rule Set dialog, search for and select the context rule you want to assign.
6. In the Add Rule Set dialog, click Save.
7. The context rule you assigned to the promotion will now appear in the Context Rules facet PENALTY
list.

In the Context Rules facet, click the PENALTY tab to display the list of assigned penalty rules.

© 2021 Vlocity LLC, a Salesforce


company 458
CME CPQ

To delete a penalty context rule for a promotion:

1. In Vlocity Product Console, under Product Management, find the promotion to which you want to
assign a rule set.
2. Click the PROMOTION NAME or the edit icon to open the promotion for editing.
3. In the left sidebar, click Context Rules.
4. In the Context Rules facet, click the PENALTY tab to view the penalty rule list.
5. In the penalty rule list, find the context rule you want to delete, and click the Delete button in the right
side of the table row for that context rule.
6. In the Delete Rule Set dialog, click Delete.

Create Object Level Rules


Object level rules are used by the ContractTerminiationService interface to assign penalty rules for
contracts.

For more information on penalty rules for contracts, see Penalty Rules for Contracts.

1. In Vlocity Product Console under Rules next to Object Level Rule, click the create icon.
2. In the New Object Level Rule dialog, enter the following information.

Property Possible Values Description


Name String value The name of the object level rule. You cannot use spaces in the name of an object
level rule due to requirements from the rules parsing engine.
Object Contract The object must be set to Contract for a penalty rule for contracts.

If additional objects display in this list, go to the Object Manager and deactivate
those picklist items from the Vlocity Object Rule Assignment
ObjectRuleAssignment__c Object vlocity_cmt__Object__c picklist.
Rule Select a context rule Lookup dialog that enables you to select any context rule. Although any rule can be
using the Vlocity selected, be sure to select the desired penalty rule for contract cancellations.
Rule Lookup
dialog.

© 2021 Vlocity LLC, a Salesforce


company 459
CME CPQ

Property Possible Values Description


Active Click to select Must set as active to be used at run time.
Effective Select a date The start date of the period during which the object level rule will be effective.
Start Date
Effective End Select a date The end date of the period during which the object level rule will be effective.
Date
3. Click Save.

Context Rules
Context rules determine when a rule set applies in Vlocity Cart. Context rules are analogous to entity filters
in the advanced rules framework.

Context Rule Conditions


Context rules contain one or more rule conditions that describe the conditions under which the rule should
apply. Rule conditions are made up of context dimensions, context scopes, and context mappings.

Rule conditions can be either:

• Simple: A condition that compares a context dimension value to a context mapping value
• Function: A condition that compares the output of the function to a static value

Context Rules and Rule Sets


Context rules are contained within rule sets. You then assign the rule set to a product, promotion, price list,
price list entry, or virtual object. Context rules are never directly assigned.

Create context rules in Vlocity Product Console. See Creating Context Rules.

© 2021 Vlocity LLC, a Salesforce


company 460
CME CPQ

Create Context Rules


Context rules determine when a rule set applies in Vlocity Cart. Context rules contain rule conditions, which
are made up of context dimensions, context scopes, and context mappings. Context rules are analogous to
entity filters in the Advanced Rules framework.

Starting in Summer '18, context rules, rule sets, and rule conditions are cached in the org cache of the
CPQPartition. In order to see your changes reflected at runtime, run the Clear Managed Platform Cache job
in the CMT Administration Maintenance jobs page.

Prerequisites:

• CPQPartition exists and has appropriate org and session cache allocations.
• CacheEnabled is set to true.
• ContextRulesEnabled is set to true.

To create a context rule, define the rule's general properties and then specify one or more rule conditions:

1. In Vlocity Product Console, in the Rules list, next to Rule, click Create.
2. Enter the following information:

Property Value Description


Name String value The context rule name
Code String value The code by which you refer to this context rule. Use the rule code when
creating custom expressions. For more information, see Expression Modes
and Custom Expressions.

IMPORTANT
Because rule code is used when creating custom
expressions, the rule code should be unique,
descriptive, and contain no spaces.

Description String value Describe the context rule's purpose.


Expression • AND Use expression mode when the rule contains multiple conditions. It specifies
Mode • OR how the rules engine compiles the rule conditions into a logical expression.
• Custom For more information, see Expression Modes and Custom Expressions.

Expression • Use AND and OR Use expression when the expression mode is set to Custom. It enables you
operators to create to specify a custom logical expression. For more information, see
custom expressions. Expression Modes and Custom Expressions.
• Refer to conditions
using condition codes.
• Use spaces to delimit
each code.
• Use parentheses to
sequence the
operations for the
expression.
• Expressions are case-
sensitive.

© 2021 Vlocity LLC, a Salesforce


company 461
CME CPQ

Property Value Description


Failure String value This message is not currently displayed in Vlocity Cart. Instead, set the
Message failure message on the rule set. For more information about failure
messages, see Failure Messages.
Active Click to select The context rule service evaluates only active context rules.
Effective Start Select a date The start date of the period during which the rule is effective.
Date
Effective End Select a date The end date of the period during which the rule is effective.
Date
3. Click Save

Setting Context Rule Conditions


Context rules can have one or more rule conditions. Rule conditions can be either:

• Simple: A condition that compares a context dimension value to a context mapping value.
• Function: A condition that compares the function's output to a static value.

To set context rule conditions:

1. Specify one or more rule conditions.


a. In the sidebar, click Rule Conditions.
b. In the Rule Conditions facet, click Add Condition.
c. Select Simple or Function.
d. For simple rule conditions, enter the following information in the General Properties area.

Property Value Description


Code String The code by which you refer to this rule condition. Use the code when
creating custom expressions. For more information, see Expression
Modes and Custom Expressions.

IMPORTANT
Because the rule condition code is used to
create custom expressions, the code should be
unique, descriptive, and contain no spaces.

Context Select a context dimension using Specifies the context dimension to use with this rule condition.
Dimension the Context Dimension Lookup
dialog box.
Operator • > Specifies the operator the context rule service uses to compare the
• >= Value property to the context mapping.
• <
• <=
• ==
• !=
• <>
• LIKE
• NOT LIKE
• INCLUDES
• EXCLUDES

© 2021 Vlocity LLC, a Salesforce


company 462
CME CPQ

Property Value Description


Value Depending on the context Specifies the value the context rule service uses to compare to the
dimension domain type, the Value context mapping.
property displays different
selections.
TIP
• If the domain type is Type In,
If the context dimension is CurrentRuleObjectId,
the Value property displays a
specify the record ID for the product or
text box that enables you to
promotion for which you are looking.
enter a free form string value.
• If the domain type is Object
Lookup, the Value property
displays a lookup dialog box that
you specified in the context
dimension.
• If the domain type is Picklist,
the value property displays the
Vlocity picklist you specified in
the context dimension.
Fail Level • Hard Fail Fail Level is not implemented currently in Vlocity Cart.
• Soft Pass
• Soft Fail
Failure String value This message is not currently displayed in Vlocity Cart. Instead, set the
Message failure message on the rule set. For more information about failure
messages, see Failure Messages.
2. Click Save.
3. For function rule conditions, enter the following information in the General Properties area.

Property Value Description


Code String The code by which you refer to this rule condition. Use this code when creating
custom expressions. For more information, see Expression Modes and Custom
Expressions.

IMPORTANT
Because rule condition code is used to create custom
expressions, the code should be unique, descriptive, and
contain no spaces.

Vlocity Select a function using Specifies the function to use for this rule condition. After it is selected, the
Function the Vlocity Function function's input and output arguments display in the Rule Condition dialog box.
Lookup dialog box.
Operator • > Specifies the operator the context rule service uses to compare the Value
• >= property to the function's output.
• <
• <=
• ==
• !=
• <>
• LIKE
• NOT LIKE
• INCLUDES
• EXCLUDES

© 2021 Vlocity LLC, a Salesforce


company 463
CME CPQ

Property Value Description


Value String value Specifies the value the context rule service uses to compare to the function's
output.
Fail Level • Hard Fail Fail level is not implemented currently in Vlocity Cart.
• Soft Pass
• Soft Fail
Failure String value This message is not currently displayed in Vlocity Cart. Instead, set the failure
Message message on the rule set. For more information about failure messages, see
Failure Messages.
4. In the Function area of the Rule Condition dialog, the input and output arguments of the function are
displayed. Depending on the function's input arguments' domain types, you can specify values in
Object Lookup, Context Dimension, Type in, or Vlocity Picklist.

© 2021 Vlocity LLC, a Salesforce


company 464
CME CPQ

5. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 465
CME CPQ

After creating the context rule, the next step is to create a rule set. For more information about creating rule
sets, see Creating Rule Sets.

Context Dimensions
Context dimensions are variables that describe the possible values to use in a context rule condition. You
can reuse context dimensions across multiple rule conditions. Context dimensions are linked to one or
more context mappings. The rules engine compares them to the linked context mappings.

Context dimensions must have a Domain Type, a property that specifies how the rule condition values
appear when a user creates the rule condition. Valid domain types are:

• Object Lookup: Select a specific record from an sObject.


• Picklist: Select rule condition values from a Vlocity picklist.
• Type In: Type in free form string values.

Figure 57. Context Dimensions

Context dimensions can also have condition weights, which allow the pricing engine to find the tightest
match when used in context rules for price list entries or child price lists. For more information about
condition weights, see Using Condition Weights.

Using Context Dimensions


Use context dimensions when creating rule conditions in two similar but slightly different ways:

• In a simple rule condition, when the context dimension determines the values that will be available to the
user when creating a rule condition
• In a function rule condition, when the context dimension can be used as the input to the function

© 2021 Vlocity LLC, a Salesforce


company 466
CME CPQ

Creating Context Dimensions


Create context dimensions in Vlocity Product Console. For more information about creating context
dimensions, see Creating Context Dimensions.

Condition Weights
Condition weight is a general property of context dimensions. Condition weights are numeric values ranging
from 0 to 60. These values are used by the TightestMatchInterface to calculate the relative weight of rules
assigned to a price list entry.

Condition weight is only used for rules assigned to price list entries or child price lists and not for rules
assigned to products and promotions. Because context dimensions are reusable, a context dimension
might be used for rules for both price list entries and for products or promotions. The condition weight value
is ignored on a context dimension used in a rule for a product or a promotion.

Calculating Condition Weights


When a product is added to the cart, the rules engine determines all of the qualified child price lists and
price list entries based on the configured rules. Then, a weight is assigned to each qualified price list entry.

With multiple price list entries, rules, and conditions, it is important to reduce the possibility for ties, so that a
single price can be selected. Administrators can ensure that certain criteria can win over others by
incrementing condition weight using integers. The Tightest Match algorithm further reduces the possibility of
ties and uses bitwise operators for maximum processing speed, so the weights are calculated as 2n. For
example, 21=2, 22=4, 23=8, 24=16, and so on.

In the following formula, x is the condition weight set on the context dimension used by the child price list
rule and y is condition weight set on the context dimension used by the price list entry rule.

Figure 58. Condition Weight Formula

© 2021 Vlocity LLC, a Salesforce


company 467
CME CPQ

This formula ensures that price list entries on a child price list will win over price list entries on a parent
price list if all other criteria are equal.

Algorithm Assumptions
The Tightest Match algorithm assumes:

• Price list entries with no context rule are assigned a condition weight of 0, or 20, which equals 1.
• Price list entries with a context rule that has a null condition weight are evaluated as 0, or 20, which
equals 1.
• Price list entries with condition weights that are greater than 60 default to 0, or 20, which equals 1.
• Context rules on parent price lists are not evaluated.
• If there are multiple price list entries with the highest weight for the same pricing variable (such as a One
Time Charge or a Monthly Recurring Charge), the interface selects the most recently-created price list
entry and applies that price to the variable in the line item.

Calculating Multiple Condition Weights


A rule can have multiple conditions, each with a different context dimension and condition weight. When
there are multiple rule conditions, the rule conditions are joined together using the expression mode (AND
or OR). The Tightest Match algorithm calculates multiple rule conditions as follows:

• AND: Condition weights are summed together


• OR: The highest condition weight is selected

Figure 59. Calculating Multiple Rule Condition Weights

Ensuring the Right Price Wins


Using Tightest Match, you can more precisely control the selection of the right price by making slight
increments to condition weights.

© 2021 Vlocity LLC, a Salesforce


company 468
CME CPQ

For example, imagine you create two rules that evaluate multiple criteria such as sales channel, geographic
region, customer segment, and SLA/service level, and your business objective is to prioritize existing
customer service level agreements above other criteria. You can weight them as follows:

Criteria Condition Weight


Sales Channel 1
Geographic Region 2
Customer Segment 3
SLA 4

Then, you create two context rules as follows:

• Rule #1 evaluates [Sales Channel] AND [SLA]


• Rule #2 evaluates [Geographic Region] AND [Customer Segment]

The total condition weight for Rule #1 is 1 + 4, and the total condition weight for Rule #2 is 2 + 3. If the
condition weights were simply summed, these rules would tie. However, using the Tightest Match formula,
the business objective of prioritizing the SLA/service level criteria is achieved because using bitwise
operators, the total condition weights are not equivalent.

• Rule #1 = 21 + 24 = 18
• Rule #2 = 22 + 23 = 12

To simplify your rules environment, the right approach is to leave the condition weight property blank for
most context dimensions. Then, when you want to prioritize certain criteria, it is easy to weight conditions
quickly because 21=2, 22=4, 23=8, 24=16, and so on.

Related Information
Create Context Dimensions.

Tightest Match

Create Context Dimensions


Context dimensions are variables that describe the values that can be used in a context rule condition.

For more information about context dimensions, see Context Dimensions.

1. In Vlocity Product Console, in the Rules area, next to Context Dimension, click Create .
2. On the New Context Dimensiontab, enter the following information.
• Name is the context dimension name.

NOTE
You cannot use spaces in a context dimension name due to rules parsing engine
requirements.

© 2021 Vlocity LLC, a Salesforce


company 469
CME CPQ

• Code is the code that refers to the rule when creating custom expressions. Use a unique but
meaningful code, so that it is easy to read custom expressions. For more information about custom
expressions, see Child Rules and Expression Modes and Custom Expressions.

NOTE
You cannot use spaces in a context dimension code due to rules parsing engine
requirements.

• Description describes the context dimension's purpose.


• Condition Weight helps the TightestMatchInterface weigh rules for price list entries and child price
lists. Product and promotion rules do not use condition weight.
• Data Type describes the context dimension data type, for example Text, Number, Date, DateTIme,
or Boolean.
• Domain Type describes how rule condition values appear when creating a rule condition.
• Picklist: Select rule condition values from a Vlocity picklist.
• Object Lookup: Select a specific record from an sObject.
• Type In: Enter free form strings.
• Object specifies the sObject to look up when the Domain Type is Object Lookup.
• Vlocity Picklist specifies the picklist to use when the Domain Type is set to Picklist. If you are
using a Vlocity picklist as the domain type, you must create the picklist before creating a context
dimension. You cannot use Salesforce picklists in context rules.
• Picklist Selection Mode specifies whether to allow the user to select a single value or multiple
values from the Vlocity picklist.

NOTE
The context rule service supports only single values.

• Cacheable Mode; When this option is checked, cacheable jobs (that is, jobs that populate the API
Cache) will use this Context Dimension. If this option is not selected, the Context Dimension will not
be cached, and therefore will not available to Digital Commerce APIs.
• Default Value specifies the value that will be used for the Context Dimension (and passed to the
Context Rules) when the input context parameters do not have a given value. The value is used in
the case of tightest match for price list entries. If this field is left empty, then the value will be passed
as null.
• Values for caching specifies the list of possible values for this dimension. For each of these values,
the Cacheable Jobs (for example, the Populate API Cache job) will cache a response.During
runtime, if the input context parameter is passed a value that is not present in this list, the CPQ
engine will evaluate the response on the fly and then cache the result.
• Active specifies whether this context dimension is active or not.
• Effective From is the start date of the period during which rules can use the context dimension.
• Effective Until is the end date of the period at which rules can no longer use the context dimension.
3. Click Save

© 2021 Vlocity LLC, a Salesforce


company 470
CME CPQ

After creating your context dimension, the next step is to create a context mapping. For more information
on creating context mappings, see Creating Context Mappings.

Some example context dimensions include:

• Create the Originating Channel Context Dimension


• Create the Account Status Context Dimension
• Create the Order Status Context Dimension
• Create the Account SLA Context Dimension

CurrentRuleObjectId Variable
In some cases, you might want to create a context rule that evaluates the entity to which it is applied. For
example, you might want to create a rule that disqualifies a promotion for accounts that have already used
that promotion. Or perhaps you want a rule to disqualify products when they are already in the cart line
items of Vlocity Cart. To do this, you use a special variable called CurrentRuleObjectId, which enables your
rule conditions or functions to access the current object's record Id as it iterates over them.

Creating the CurrentRuleObjectId Variable


Before you can use the CurrentObjectId variable, you must create a context dimension and a context
mapping to store it in. After this context dimension and context mapping are created, you can specify the
context dimension for a rule condition or as an input argument to a function. At run time, the context rules
service replaces the context mapping's Type In Value with the record Id of the current entity that it is
evaluating.

Create the CurrentRuleObjectId Context Dimension

1. In Vlocity Product Console under Rules, click the create icon next to Context Dimension.
2. In the New Context Dimension dialog, enter the following information.

Property Value Description


Name CurrentRuleObjectId This name must be typed exactly as shown here in order for the context rules
service to recognize this as the CurrentRuleObjectId variable. The name of
this context dimension is the key.You cannot use spaces in the name of a
context dimension due to requirements from the rules parsing engine.
Code CurrentRuleObjectId The code by which you will refer to this rule when creating custom
expressions.

You cannot use spaces in the code of a context dimension due to


requirements from the rules parsing engine.
Data Type Text
Domain Type Type in
Active Click to select Only active context dimensions are evaluated by the rules engine.
Effective From Select a date The start date of the period during which the context dimension will be
Date effective.
Effective Until Select a date The end date of the period during which the context dimension will be
Date effective.
3. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 471
CME CPQ

Create the CurrentRuleObjectId Context Mapping

1. In the left sidebar, click Context Mappings.


2. In the Context Mappings facet, click New Context Mapping.
3. In the New Context Mapping dialog, enter the following information.

Property Value Description


Context Scope Select a context scope The CurrentRuleObjectId variable supports all context scopes.
using the Context
Scope Lookup dialog.
Initialization Always Specifies how frequently context mapping values should be refreshed in the
Policy Reinitialize session cache.

For a CurrentRuleObjectId, the Initialization Policy must be set to


Always Reinitialize. By default, the current object ID is not reset, and
instead remains the typed-in value specified below.
Initialization Type Type In Specifies where to retrieve the data that is used to compare to the rule
condition. For a CurrentRuleObjectId this property must be set to Type
In.
Type In Value [current object Displays when the Initialization Type is set to Type In.
id]
This is a temporary value that is replaced by the current object record ID at
run time.
Sequence 10 Specifies the context mapping sequence. To allow for future sequence
changes, use a sequence of 10, 20, 30, and so on.
Active Click to select Only active context mappings dimensions are evaluated by the rules engine.
Effective From Select a date The start date of the period during which the context mapping can be used
Date in rules.
Effective Until Select a date The end date of the period during which the context mapping can be used in
Date rules.
4. Click Save.

After you create the CurrentRuleObjectId variable, you can use it in a rule condition or as an input argument
to a function.

For more information on rule conditions, see Create Context Rules.

For more information on creating and using functions, see Functions for Rules.

Create the Originating Channel Context Dimension


These instructions use the Channel_PKL picklist which has been previously created. The picklist has the
following values: Web and Retail. For instructions on how to create a picklist, refer to Create a Picklist.

To create a context dimension:

1. In the Vlocity Product Console, the Rules section, click the plus icon next to Context Dimensions.
2. In the General Properties section, complete the following fields:

© 2021 Vlocity LLC, a Salesforce


company 472
CME CPQ

Field Name Sample Value Description


Name Channel Originating channel.

You cannot use spaces in the name of a context dimension.


Code VAR0001 The code must be a unique value.
Description This is the originating Describe the purpose of the context dimension.
channel.
Condition Weight 1 Acceptable values are 1 to 62. The higher the number, the higher the
weight.

To learn more about condition weights, refer to Condition Weights.


Data Type Text Select the data type that matches the data type of the context dimension.
Domain Type Picklist Available values include: [Picklist | Object Lookup | Type In ].
Object N/A Since using a picklist, the object value is not used.
Vlocity Picklist Channel_PKL This example assumes that you have previously created a picklist, The
Channel_PKL is the name of the picklist used in this example,
Picklist Selection Single At this time only the Single value is supported.
Mode
The Multiple value is reserved for future use.
Active Select the checkbox Only active picklists can be associated with context dimensions.
Effective From Date Select a date The start date of the period during which the context dimension can be
used in rules.
Effective to Date Select a date The end date of the period during which the context dimension can be used
in rules.
3. Click Save.

Create the Order Status Context Dimension


These instructions use the XStatus_PKL which has been previously created. The picklist has the following
values: Draft and Activated.

For instructions on how to create a picklist, refer to Create a Picklist.

1. In the Vlocity Product Console, the Rules section, click the Plus icon next to Context Dimensions.
2. In the General Properties section, complete the following fields:

Field Name Sample Value Description


Name XStatus Since context dimensions can be reused between multiple context scope
entities, such as Order, Opportunity or Quote, use a generic name.

You cannot use spaces in the name of a context dimension.


Code VAR0002 The code must be a unique value.
Description Order, Opportunity or Describe the purpose of the context dimension.
Quote status.
Condition Weight 2 Acceptable values are 1 to 62. The higher the number, the higher the weight.

To learn more about condition weights, refer to Condition Weights.


Data Type Text Select the data type that matches the data type of the context dimension.
Domain Type Picklist Available values include: [Picklist | Object Lookup | Type In ].
Object N/A Since using a picklist, the object value is not used.

© 2021 Vlocity LLC, a Salesforce


company 473
CME CPQ

Field Name Sample Value Description


Vlocity Picklist XStatus_PKL This example assumes that you have previously created a picklist, The
XStatus_PKL is the name of the picklist used in this example,
Picklist Selection Single At this time only the Single value is supported.
Mode
The Multiple value is reserved for future use.
Active Select the checkbox Only active picklists can be associated with context dimensions.
Effective From Select a date The start date of the period during which the context dimension can be used
Date in rules.
Effective to Date Select a date The end date of the period during which the context dimension can be used
in rules.

Create the Account Status Context Dimension


These instructions use the CustAcctStatus_PKL which has been previously created. For instructions on
how to create a picklist, refer to Create a Picklist.

To create the Account Status context dimension:

1. In the Vlocity Product Console, the Rules section, click the Plus icon next to Context Dimensions.
2. In the General Properties section, complete the following fields:

Field Name Sample Value Description


Name AccountStatus You cannot use spaces in the name of a context dimension.
Code VAR0005 Channel code must be a unique value.
Description Status of an account. Describe the purpose of the context dimension.
Condition Weight 1 Acceptable values are 1 to 62. The higher the number, the higher the weight.

To learn more about condition weights, refer to Condition Weights.


Data Type Text Select the data type that matches the data type of the context dimension.
Domain Type Picklist Available values include: [Picklist | Object Lookup | Type In ].
Object N/A Since using a picklist, the object value is not used.
Vlocity Picklist CustAcctStatus_PKL This example assumes that you have previously created a picklist, The
CustAcctStatus_PKL is the name of the picklist used in this example,
Picklist Selection Single At this time only the Single value is supported.
Mode
The Multiple value is reserved for future use.
Active Select the checkbox Only active picklists can be associated with context dimensions.
Effective From Select a date The start date of the period during which the context dimension can be used
Date in rules.
Effective to Date Select a date The end date of the period during which the context dimension can be used in
rules.

Create the Account SLA Context Dimension


These instructions use the AccountSLA_PKL which has been previously created. The picklist has the
following values: Gold, Silver, Platinum and Bronze. For instructions on how to create a picklist, refer to
Create a Picklist.

To create the Account SLA context dimension:

© 2021 Vlocity LLC, a Salesforce


company 474
CME CPQ

1. In the Vlocity Product Console, the Rules section, click the Plus icon next to Context Dimensions.
2. In the General Properties section, complete the following fields:

Field Name Sample Value Description


Name AccountSLA You cannot use spaces in the name of a context dimension.
Code VAR0008 The code must be a unique value.
Description Account SLA Describe the purpose of the context dimension.
Condition Weight 1 Acceptable values are 1 to 62. The higher the number, the higher the weight.

To learn more about condition weights, refer to Condition Weights.


Data Type Text Select the data type that matches the data type of the context dimension.
Domain Type Picklist Available values include: [Picklist | Object Lookup | Type In ].
Object N/A Since using a picklist, the object value is not used.
Vlocity Picklist AccountSLA_PKL This example assumes that you have previously created a picklist, The
AccountSLA_PKL is the name of the picklist used in this example,
Picklist Selection Single At this time only the Single value is supported.
Mode
The Multiple value is reserved for future use.
Active Select the checkbox Only active picklists can be associated with context dimensions.
Effective From Date Select a date The start date of the period during which the context dimension can be used in
rules.
Effective to Date Select a date The end date of the period during which the context dimension can be used in
rules.

Context Rule Components


You build context rules by combining context rule components. You can establish a library of components
that enables you to reduce overall development time and expedite new development.

© 2021 Vlocity LLC, a Salesforce


company 475
CME CPQ

Figure 60. Context Rule Components

The context rules framework consists of the following reusable components:

• Rule sets contain one or more context rules, and are applied to products, promotions, price lists, and
price list entries. See Rule Sets.
• Context rules are analogous to entity filters in the advanced rules framework. Context rules determine
when a rule set applies in Vlocity Cart. See Context Rules.
• Context dimensions are variables that describe the possible values to use in a rule condition. You can
reuse context dimensions across multiple rule conditions. The rules engine compares context dimensions
to data that comes from an sObject, a function, or a static value defined in the context mapping. See
Context Dimensions.
• Context mappings enable the rules engine to compare context dimension variables to data stored in
sObjects, calculated using a function, or entered during design-time in a specified context scope. Vlocity
caches context mappings in the session cache. See Context Mapping.
• Context scopes describe the relational path from a root sObject, such as an Order, to related sObjects.
Context mappings use context scopes to pinpoint the fields on the sObjects or compute data to match
with context dimension variables so the Context Rule Service engine can evaluate them. See Context
Scopes.
• Functions are used in context mappings. You can invoke custom implementations to provide additional
logic and processing. See Functions for Rules.
• Object level rules assign penalty rules for contracts. See Creating Object Level Rules.

© 2021 Vlocity LLC, a Salesforce


company 476
CME CPQ

• Context actions are used with penalty rules to apply a fee when a promotion or contract is canceled.
Context actions enable you to specify either a flat fee using a pricing element on a price list or calculate a
fee by invoking a custom implementation. See Creating Context Actions.

You combine context rule components to create logical expressions that the rules engine can evaluate. For
example:

Context Rule Condition = true WHEN {{Context Dimension}} == {{Context


Mapping[Context Scope.Source Expression]}}

Creating Context Mappings


Context mappings allow the rules engine to compare context dimensions to data stored in an sObject,
calculated using a function, or entered during design time within a specified context scope. Create context
mappings in Vlocity Product Console. For more information about context mappings, see Context
Mappings.

You must define context scopes and context dimensions before configuring context mappings.

Context scopes and context dimensions link to context mappings. You can access the context mappings
facet when editing a context scope or a context dimension.

Figure 61. Accessing Context Mappings From a Context Scope

To create a context mapping:

1. In Vlocity Product Console, in the Rules list, next to Context Dimension or Context Scope, click Search.
2. Find the context dimension or the context scope for which to make a context mapping.
3. Click Edit to open the context mapping for editing.
4. In the sidebar, click Context Mappings.
5. In the Context Mappings facet, click New Context Mapping.
6. In the New Context Mapping dialog box, enter the following information:

© 2021 Vlocity LLC, a Salesforce


company 477
CME CPQ

Property Value Description


Context Select a context Specifies the context dimension linked to this context mapping.
Dimension dimension using the
Context Dimension This property only appears when creating a context mapping from a context
Lookup dialog box. scope.
Context Scope Select a context scope Specifies the context scope linked to this context mapping.
using the Context
Scope Lookup dialog This property only appears when creating a context mapping from a context
box. dimension.
Initialization • Do Not Reinitialize Specifies how frequently context mapping values are refreshed in the
Policy • Always Reinitialize session cache. Vlocity recommends Always Reinitialize. For entity scopes,
the rules engine always reinitializes by default, essentially ignoring this
selection. However, for session context scopes, the initialization policy is
honored.
Initialization • Scope SObject Specifies where to retrieve the data to use to compare to the rule condition.
Type • Source Expression Supported initialization types are:
• Function
• Scope SObject is reserved for future functionality.
• Type In
• Function enables you to select a function to perform complex logic. For
more information about functions, see Functions for Rules.
• Type In enables you to enter free-form string values.
Source String value Specifies the sObject API name from the context scope. When referring to a
Expression field on a custom object using a custom lookup, use __r instead of __c as
the suffix syntax, for example, ContractId__r.ContractTerm using the Asset
context scope. Appears when the Initialization Type is set to Source
Expression.
Vlocity Select a function using Appears when the Initialization Type is set to Function.
Function the Function Lookup
dialog box.
Type In Value String value Appears when the Initialization Type is set to Type In.
Sequence Numeric value Specifies the context mapping sequence. Use a sequence of 10, 20, 30, and
so on. to allow for easier sequence changes in the future.
Active Click to select The rules engine evaluates only active context mappings.
Effective From Select a date The start date of the period during which rules can use the context mapping.
Date
Effective Until Select a date The end date of the period during which rules can use the context mapping.
Date
7. Click Save.

After creating a context mapping, the next step is to create a context rule. For more information about
creating context rules, Creating Context Rules.

Using Source Expressions


You can create context mappings to specific data stored in sObjects using the source expression property.
Using source expressions, you can trace the object hierarchy to access data in objects related by
Salesforce lookups.

• Use API names of related sObjects and fields when writing source expressions.
• When referring to a field on a custom object using a custom lookup, use __r instead of __c as the suffix
syntax, e.g., ContractId__r.ContractTerm using the Asset context scope.

© 2021 Vlocity LLC, a Salesforce


company 478
CME CPQ

Figure 62. Tracing the Object Hierarchy using Source Expressions

Using Source Expressions to Map to Virtual Objects


You can also create context mappings to data in virtual objects. Similar to context mappings for regular
sObjects, you write source expressions to describe where the rules engine looks for the data. However,
when creating mappings to virtual objects, note the following differences.

• Create context mappings to attributes on the virtual object.


• Use the attribute names when writing source expressions.
• Account, Order, Quote and Opportunity are the only sObjects currently supported.
• The ANY attribute is similar to the ANY context scope. For more information, see Any Context Scope.
• For the ANY, Account, Order, Quote and Opportunity attributes, you can refer to fields on those sObjects
using the format of [attribute name].[API field name].
• You can't trace the object hierarchy to access data in related objects.

© 2021 Vlocity LLC, a Salesforce


company 479
CME CPQ

Figure 63. Using Source Expressions for Virtual Objects

Context Scopes
Context scopes describe the relational path from a root sObject, such as an Order, to related sObjects.
Context mappings use context scopes to identify the fields on the sObjects or computed data that is
matched with context dimension variables. The Context Rule Service evaluates the information.

© 2021 Vlocity LLC, a Salesforce


company 480
CME CPQ

Currently, Vlocity supports the following root context scopes:

• Order
• Opportunity
• Quote
• Asset*
• Any

*You can only use the Asset scope for rules invoked during repricing.

Each of these scopes can then reference account and contract scopes.

Figure 64. Root and Second-Level Context Scopes

For more information about the any context scope, see Any Context Scope.

Types of Context Scopes


Most context rules use an Entity context scope type. Entity context scopes refer to specific sObjects entities
such as Order, Quote, and Asset.

As of CME Summer '18, context rules for pricing adjustments must use a Virtual context scope type. You
use virtual context scopes to map to data entered by users at run time, which is stored only in memory.

Creating Context Scopes


If context scopes are not defined in your environment, you must define them before creating context rules.
For instructions about how to create context scopes, refer to Creating Context Scopes.

Any Context Scope


The any context scope enables you to create context mappings that can be used across all root context
scopes. For example, instead of creating separate context mappings to evaluate the status field across

© 2021 Vlocity LLC, a Salesforce


company 481
CME CPQ

orders, quotes, and opportunities, you can use any context scope to evaluate the status for all root entities,
including orders and quotes. You can also specify any as the entity for second-level context scopes,
enabling you to evaluate information in accounts and contracts across all root entities.

Figure 65. Any and Second-Level Context Scopes

Figure 66. Any.Account Context Scope

© 2021 Vlocity LLC, a Salesforce


company 482
CME CPQ

While the any context scope allows more flexibility and efficiency when defining context mappings, in some
cases, when you know that the value can come from only on sObject, you might want to explicitly specify
that object as the root scope entity. By doing so, you limit the number of fields that are retrieved and stored
in the session cache. When the context scope is Order.Account, the rules engine retrieves fields from the
account sObject only. If the context scope is Any.Account, the rules engine retrieves fields from all root
entities: Order, Opportunity, Quote, and Asset. For example, the Originating Channel field only exists on
the Order object. If you specify Any as the root entity for Originating Channel, the system will look across all
root entities even though it only exists on Order, which is not an efficient design.

Virtual Context Scopes


Starting in Summer '18, virtual context scopes enable you to create context mappings to virtual objects.
Virtual context scopes and virtual objects enable you evaluate data entered by the user at run time that is
stored only in memory, such as pricing adjustment data. The Summer '18 release contains one supported
virtual object, AdjustmentData, that is used for context rules for pricing adjustments. See Qualification
Rules for Pricing Adjustments.

© 2021 Vlocity LLC, a Salesforce


company 483
CME CPQ

Figure 67. Virtual Context Scopes

The entity for a virtual context scope is the virtual object name. There are no entity paths used for virtual
context scopes.

Creating Context Scopes


If context scopes have not been created in your environment, you must create them before defining context
rules. This process is performed once as part of the initial context rule setup.

© 2021 Vlocity LLC, a Salesforce


company 484
CME CPQ

Context scopes are used to build context mappings for your context rules.

Using the information in the table below, create context scopes for each of the following entities.

1. In the Vlocity Product Console, in the Rules section, click the plus icon next to Context Scope.
2. In the General Properties section of the New Context Scope dialog, enter the required values for
each entity using the information in the table below.
3. Click Save.

Name Code Description Scope Entity Entity


Type Path
OrderScope SCOPE01 Root scope for the Entity Order
Order sObject
OrderAccountScope SCOPE02 2nd level scope for Entity Order Account
the Account sObject
OrderContractScope SCOPE03 2nd level scope for Entity Order Contract
the Contract
sObject
QuoteScope SCOPE04 Root scope for the Entity Quote
Quote sObject
QuoteAccountScope SCOPE05 2nd level scope for Entity Quote Account
the Account sObject
QuoteContractScope SCOPE06 2nd level scope for Entity Quote Contract
the Contract
sObject
OpportunityScope SCOPE07 Root scope for the Entity Opportunity
Opportunity sObject
OpportunityAccountScope SCOPE08 2nd level scope for Entity Opportunity Account
the Account sObject
OpportunityContractScope SCOPE09 2nd level scope for Entity Opportunity Contract
the Contract
sObject
AnyScope SCOPE10 Root scope for the Entity Any
Any context
AnyAccountScope SCOPE11 2nd level scope for Entity Any Account
the Account sObject
AnyContractScope SCOPE12 2nd level scope for Entity Any Contract
the Contract
sObject
AdjustmentDataScope SCOPE13 Virtual scope for Virtual AdjustmentData
the AdjustmentData
virtual object
AssetScope SCOPE14 Root scope for the Entity Asset
Asset object for
repricing
AssetAccountScope SCOPE15 2nd level scope for Entity Asset Account
the Account sObject
for repricing

© 2021 Vlocity LLC, a Salesforce


company 485
CME CPQ

Name Code Description Scope Entity Entity


Type Path
AssetContractScope SCOPE16 2nd level scope for Entity Asset Contract
the Contract
sObject for
repricing

The AdjustmentDataScope is a virtual context scope used to create context rules for pricing adjustments.
Virtual context scopes are supported starting in CME Summer '18. For more information, see Virtual
Context Scopes.If your implementation is using CME Summer '18 or later and the Scope Type picklist does
not display the Virtual picklist item, you must update the picklist items available for the Scope Type picklist
on the Context Scope object. For more information, see Adding the Virtual Picklist Item to the Scope Type
Picklist.

For more information about context scopes, see:

• Context Scopes
• Any Context Scope
• Virtual Context Scopes

Context Rule Message Service


You can define failure messages for qualification rule sets, context rules, and rule conditions. Only the
failure message for rule sets appear in Vlocity Cart. Use the Context Rule Message Service to access
failure messages on rule sets, context rules, and rule conditions for disqualified products or promotions.

You can invoke the Context Rule Message Service using the getRuleMessages action for either the
getProductList or getPromotionList APIs. These APIs are part of the CPQ APIs, which are available using
REST or Apex Remote actions.

Invoking the Context Rule Message Service Using Apex Remote


To invoke the Context Rule Service using Apex Remote, pass the following values:

Parameter Value
Apex Remote Service Class CpqAppHandler
methodName getRuleMessages
ruleEvaluationInput null
ruleType Qualification
include qualifications
id • {pricebookentryId} for products
• {promotionId} for promotions
cardId {cardId}

© 2021 Vlocity LLC, a Salesforce


company 486
CME CPQ

Figure 68. Sample Response

© 2021 Vlocity LLC, a Salesforce


company 487
CME CPQ

See Also
Cart-Based APIs

Invoking the Context Rule Message Service Using REST


API Request for Promotions

xx##.salesforce.com/services/apexrest/vlocity_cmt/v2/cpq/GET/carts/{cartid}/
promotions/{promotionId}?include=qualifications&ruleType=Qualification

API Request for Products

xx##.salesforce.com/services/apexrest/vlocity_cmt/v2/cpq/GET/carts/{cartid}/
products/{pricebookentryId}?include=qualifications&ruleType=Qualification

The include parameter is required and must be qualifications. The ruleType parameter is
optional.

Failure Messages
When creating context rules, you can create failure messages for the following entities: rule sets, context
rules, and rule conditions.

Failure Messages for Rule Sets Assigned to Products and Promotions


Failure messages for rule sets assigned to a product or promotion display in the Disqualified subtab of
Vlocity Cart. The message will be ignored if the same rule set is applied to a price list or price list entry.

© 2021 Vlocity LLC, a Salesforce


company 488
CME CPQ

Figure 69. Setting a Failure Message for a Rule Set

© 2021 Vlocity LLC, a Salesforce


company 489
CME CPQ

Figure 70. Failure Message Appears in Vlocity Cart

Failure Messages for Rule Sets Assigned to Pricing Adjustments


You can alert users when they enter invalid pricing adjustments by specifying a failure message in the rule
set assigned to the pricing adjustment. When the user enters an invalid adjustment value or code, a toast
message displays above the pricing adjustment dialog box.

© 2021 Vlocity LLC, a Salesforce


company 490
CME CPQ

To enable the display of failure messages for pricing adjustments, set the CPQ Toast Message Log Level
in the CPQ Configuration Setup custom settings to All. For more information on this custom setting, see
CPQ Configuration Settings Reference. When changing a failure message for a pricing adjustment, you

© 2021 Vlocity LLC, a Salesforce


company 491
CME CPQ

must clear the CPQPartition platform cache to ensure your changes display. For more information, see
Configuring CPQ Platform Cache.

Using Context Rule Message Service API


You can access failure messages for all entities using the Context Rule Message Service API. For more
information, see Context Rule Message Service.

Create Context Actions


Use context actions with penalty rules to apply a fee when a promotion or contract is canceled. Context
actions enable you to specify a flat fee using a pricing element on a price list.

NOTE
When specifying a pricing element on a price list for a context action, the price list can be
different than the price list associated with the order.

Create context actions in Vlocity Product Console. Use context actions when specifying child context rules
for a penalty rule set. For more information about rule sets, see Create Rule Sets.

1. In Vlocity Product Console, in the Rules area, next to Context Action, click Create .
2. On the New Context Action tab, enter the following information.
• Name is the name of the context action.

NOTE
You cannot use spaces in a context action name.

• Code is the context action code.


• Type is the rule purpose. Flat Fee uses the pricing element specified below as the penalty fee.
Custom Calculation is reserved for future functionality.
• Price List specifies the price list that contains the pricing element to use as the penalty fee. Use the
Price List Lookup dialog box to find the price list.
• Pricing Element specifies the pricing element to use as the penalty fee. Use the Pricing Element
Lookup dialog box to find the pricing element.
• Custom Implementation is reserved for future functionality.
• Active specifies whether the context action is active.
• Effective From is the start date of the period during which the context action is effective.
• Effective Until is the end date of the period at which the context action is no longer effective.
3. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 492
CME CPQ

Functions for Rules


In context rules, when you need rules to evaluate complex criteria, you can create a function.

You might want to count records, looking for a certain threshold because, for example, a customer with
more than two mobile phone assets is eligible for the family data plan promotion. Or, you might want to
know if a certain type of record exists in a data set, returned as a Boolean value (true/false); for example,
has the account participated in a campaign in the last 12 months? Because information like this does not
exist as a single field on an object, functions enable you to insert custom logic to create advanced rule
criteria. Creating rules using functions allows complete flexibility and control, but also requires Apex code.

Functions invoke Apex classes and methods. When you create the function, you can define multiple input
arguments and a single output argument that will be passed to and from the Apex class and method. Over
time, you can build a library of functions that can be reused for a variety of different purposes and for
different context rules.

Figure 71. Functions

Functions are used in context mappings or in rule conditions. When functions are used in context
mappings, the function output becomes the context mapping value and is compared by the rules engine to
the rule condition values, which are set by the context dimension, just like when you create a context
mapping to a field on an object.

However, when functions are used in rule conditions, the output from the function is compared to a static
value in the rule condition. The other context rule components (such as context dimension) can be used as
input arguments.

In some cases, you might want to create a context rule to evaluate the product or promotion that the
context rule has been applied to.

For example, you might want to prevent customers who have used a promotion from using it again. To do
this, you can create a function that uses the CurrentRuleObjectId variable as an input argument.

© 2021 Vlocity LLC, a Salesforce


company 493
CME CPQ

Creating Functions
1. Create your Apex class and note the Apex class name and the method name. For more information on
working with Apex classes, see Salesforce's Apex Developer Guide.
2. Create a function definition in Custom Metadata.
3. In Setup, go to Custom Metadata Types.
4. Click Manage Function Definitions.
5. In Function Definitions, Click New.
6. Enter the following information:

Label Value Description


Name String value The function name will be displayed in the list on the Functions Definitions tab.
Function String value The unique function name used by the API and managed packages, and which you use in
Definition formulas. The name must begin with a letter and use only alphanumeric characters and
underscores. The name cannot end with an underscore or have two consecutive
underscores.
Class Name String value The Apex class containing the method that implements the logic for the function.
Method Name String value The name of the method in your Apex class that implements the logic for the function.
7. Create a function.
a. In Vlocity Product Console under Rules, click the create icon next to Function.
b. In the New Function dialog, enter the following information:

Property Values Description


Name String value The name of the function. You cannot use spaces in the name of a function
due to requirements from the rule parsing engine.
Code String value The code of the function.
Description String value Describe the purpose of the function. It's also helpful to note the inputs and
output.
Implementation Name String value The name of the method in your Apex class that implements the logic for the
function.
Output Mode Single Used to specify whether the output will be a single value or multiple values.

Currently, only single output values are supported.


Active Click to select Must set as active to be used at runtime.
Effective From Date Select a date The start date of the period during which the function will be effective.
Effective Until Date Select a date The end date of the period during which the function will be effective.
8. Click Save.
9. Create function arguments.

NOTE
You can create multiple input arguments but a single output argument. The names of
the arguments are not passed to the Apex class. Instead, the sequence of the input
arguments is used to identify each argument within the Apex code. After the argument
sequence has been set, do not change it without editing the corresponding Apex class
accordingly.

© 2021 Vlocity LLC, a Salesforce


company 494
CME CPQ

10. In the left sidebar, click Function Arguments.


11. In the Function Arguments facet, click New Argument.
12. In the General Properties window, enter the following information:

Property Value Description


Sequence Numeric value The sequence of the argument. Vlocity recommends using a 10, 20, 30 ...
numbering sequence to allow for easy insertions in future. The sequence specified
for each argument must match the sequence of arguments expected by the Apex
class specified in function's Implementation Name property.
Argument String value The name of the argument.
Name
Function argument names cannot contain spaces.
Direction • Input Input specifies the argument that will be passed to the function as input. You can
• Output define multiple input arguments.

Output specifies the argument that will be passed to the function as output. You
can only define one output arguments.
Data Type • Text Specifies the data type of the argument.
• Number
• Date
• DateTime
• Boolean
Domain Type • Picklist Specifies the domain type of the input argument.
• Object Lookup
• If you select Picklist and specify a Vlocity Picklist here, the picklist values are
• Type in
displayed next to the Picklist radio button when you create a rule condition or a
• Context
context mapping later.
Dimension
• If you select Object Lookup and then specify an object in the Object field
here, you can select a record from that object when you create a rule condition
or a context mapping later.
• If you select Type in, you can type in a value when you create a rule condition
or a context mapping later.
• If you select Context Dimension, you can specify a context dimension to
pass as input to the function when you create a rule condition or a context
mapping later.
Select Context Dimension as the Domain Type when using the
CurrentRuleObjectId variable.
Object String value Used with Domain Type of Object Lookup. Specifies the API name of the sObject
to lookup.
Vlocity Select a picklist using Used with Domain Type of Picklist. Specifies the picklist to use as input to the
Picklist the Vlocity Picklist function.
Lookup dialog.
Picklist • Single Used with domain type of picklist. Specifies whether the user is allowed to pick one
Selection • Multiple value from the picklist or multiple values.
Mode
13. Click Save.
Add as many arguments as needed to support the function's implementation class, then create the
context mapping or rule condition that uses the function.

Using Context Rules to Check User's Eligibility in Self-Service Transactions


The following configurations enable you to evaluate the eligibility of the logged-in user for self-service
transactions:

© 2021 Vlocity LLC, a Salesforce


company 495
CME CPQ

• Create a New Custom Formula Field for the Order Object


• Create a New Rule with Simple Condition

Creating a New Custom Formula Field for the Order Object


This task is a step in Using Context Rules to Check User's Eligibility in Self-Service Transactions.

To create a new field:

1. As a System Administrator, navigate to Setup.


2. Search for Orders Fields.
3. In the Order Custom Fields & Relationships section, click New.
4. In the Data Type page, select Text.
5. Click Next.
6. Complete the required fields.
7. In the Default Value text area, click Show Formula Editor.
8. Define the validation formula: $User.<Field>
For example, the below formula checks whether the currently logged in user belongs to a specific
company:
$User.CompanyName
9. Click Next and Save.
10. In the list of custom fields, find the new field.
11. Copy and save the API name without the namespace.
For example:
UserCompany__c
You will use the API name when configuring a new context dimension.

Creating a New Rule with Simple Condition


This task is a step in Using Context Rules to Check User's Eligibility in Self-Service Transactions.

To create a new rule:

1. In Vlocity Product Console, the Rules area, click the Plus icon.
2. Complete the required fields and click Save.
3. In the right menu, click the Rule Conditions option.
4. Click Add Condition and select Simple.
5. Enter the following rule conditions:
a. Code — any unique value
b. Field Name — name of the context dimension you have created
c. Operator — select a desired operator
d. Value — select a desired value
e. Fail Level — select a desired value
For example:

© 2021 Vlocity LLC, a Salesforce


company 496
CME CPQ

Migrate Context Rules Between Environments


You can migrate context rules from one environment to another, for example from a Sandbox environment
to a Production environment.

You can also migrate context rules using IDX Workbench. See IDX Workbench Desktop Application.

The migration process migrates all data related to context rules, including:

• Functions
• Context Actions
• Context Dimensions
• Context Scopes
• Object Level Rules
• Rule Sets

You can migrate context rule data using the DataPack Export functionality, which is invoked by the URL to
the DataPack Home Visualforce page.

The following input parameters must be appended to the URL:

• DataPack name [ Rule | ContextDimension ]


• Record ID for a rule or context dimension

For example:

apex/DataPacksHome?exportDataPackType=<data-pack-name>&exportData=<record-ID>

Example URL for context rule export:

apex/DataPacksHome?exportDataPackType=Rule&exportData=a2b46000000dsxM

Example URL for context dimension export:

© 2021 Vlocity LLC, a Salesforce


company 497
CME CPQ

apex/DataPacksHome?
exportDataPackType=ContextDimension&exportData=a3441000000S5BA

You must export each context rule and context dimension individually. Once exported, you can create a
multi-pack to bulk import all context rules and context dimensions at the same time.

NOTE
At this time, the export of multiple context rules or context dimensions is not supported.

To migrate context rules, perform the following tasks:

1. Export Context Rules


2. Export Context Dimensions
3. Create a MultiPack
4. Import the MultiPack with Context Rules and Context Dimensions to a Different Environment

Export Context Rules


You must export each context rule individually as a JSON file. After exporting all rules, you can bulk import
them to another environment using a DataPack.

This task is a step in the Migration of Context Rules Between Environments process.

1. In the All Tabs page, click the Vlocity Rules link.


2. Create a view that displays only context rules.
3. Click the name of a rule you wish to export.
4. In the browser URL line, copy the ID of the context rule.

5. Append the ID to the rule export URL.

© 2021 Vlocity LLC, a Salesforce


company 498
CME CPQ

6. Click Enter. The Export DataPack dialog box appears.

7. Click Next, Next.


8. Enter the name for the context rule.
9. Click Done.
A JSON file is downloaded to your Downloads folder.
10. Repeat Steps 1 - 9 for each additional context rule you wish to export.

Export Context Dimensions


You must export each context dimension individually as a JSON file. After exporting all context dimensions,
you can bulk import them to another environment using a DataPack.

This task is a step in the Migration of Context Rules Between Environments process.

1. In the All Tabs page, click the Vlocity Context Dimensions link.
The Vlocity Context Dimensions pages displays all existing context dimensions.
2. Click the name of a context dimension you wish to export.
3. In the browser URL line, copy the ID of the context dimension.

© 2021 Vlocity LLC, a Salesforce


company 499
CME CPQ

4. Append the ID to the rule export URL.

5. Click Enter.
The Export DataPack dialog box appears.

© 2021 Vlocity LLC, a Salesforce


company 500
CME CPQ

6. Click Next, Next.


7. Enter the name for the context dimension.
8. Click Done.
A JSON file is downloaded to your Downloads folder.
9. Repeat Steps 1 - 8 for each additional context dimension you wish to export.

Create a MultiPack
Once you have exported all context rules and context dimensions, to import all rules and dimensions to
another environment at the same time, create a multipack.

This task is a step in the Migration of Context Rules Between Environments process.

1. In the source environment, the All Tabs page, click the Vlocity DataPacks link.
For each context rule and context dimension, a data pack is created and listed in the Vlocity
DataPacks page. Use the Last Modified column to view a list of recently created datapacks.
2. Click each data pack you wish to import to expand it and select the checkbox.

© 2021 Vlocity LLC, a Salesforce


company 501
CME CPQ

3. Click Create MultiPack.


4. Enter the name for the multipack and click Next, Next, and Done.
A JSON file with the same name is created and downloaded to your Downloads folder.

Import the MultiPack to a Different Environment


Once you have created a multipack with Context Rules and Context Dimensions, you can import it to a
different environment.

This task is a step in the Migration of Context Rules Between Environments process.

1. In the source environment, the All Tabs page, click the Vlocity DataPacks link.
2. Click the Installed tab.
3. Click Import From File.
4. Browse to the location of the multipack JSON file, which is located in the Downloads folder by default.
5. Select the file.
6. Click Next, Next, Next, and Done.

Advanced Rules Framework


Vlocity Advanced Rules Framework allows you to design sophisticated natural language criteria along with
customizable interfaces to ensure the right products are available to eligible customers at the right price in
the right configuration. Advanced Rules determine which products and under what circumstances they
apply using Entity Filters, and they are built using Vlocity Rule Builder. You can use Advanced Rules to
create rules that depend on context, product attributes, and multiple criteria.

Vlocity provides the following rule types: Compatibility, Pricing, and Availability & Eligibility rules.

• Compatibility rules: Use product relationships to ensure products ordered in Vlocity Cart are compatible
based on conditions in order line items and related objects. They are also known as Configuration or
Validation rules.
• Pricing rules change standard pricing and operate on order line items in Vlocity Cart.
• Availability & Eligibility rules are legacy rules that display or hide products in Vlocity Cart's product list
based on conditions in opportunity, quote or order header data or data in related objects such as
Accounts or Assets. (Except in certain circumstances, these rules have been replaced by context rules.)

Advanced Rules Framework works in tandem with Context Rules Framework. To understand which type of
rule to use in each situation, see Context Rules or Advanced Rules: What Type to Use?

Vlocity provides a configure, price, quote (CPQ) rules framework. Rules are associations of entity filters and
actions. Entity filters evaluate objects for specific conditions. Rules execute actions on qualified objects.

You can create and implement reusable rules using the Vlocity Rule Builder. Each rule is built using natural
language. The natural language and visual Rule Builder enables designing new offers and managing
promotions through availability, eligibility, compatibility, and pricing rules. Rules use filters to identify a set of
items, and then apply one or more action steps to each remaining item. You can choose from existing filters
and actions, or you can create new ones.

© 2021 Vlocity LLC, a Salesforce


company 502
CME CPQ

Rules Overview
Vlocity provides a Configure, Price, Quote (CPQ) rules framework. Rules are associations of entity filters
and actions. Entity filters evaluate objects for specific conditions. Rules execute actions on qualified
objects.

A defined rule applies to an object, such as an Opportunity, Order, or a Quote. Rules are run based on the
implementation that the interface calls. Rules can operate on any object, but they are usually used on CPQ
objects. The Vlocity open interface implementations invoke the rules that you specify in flow steps.

A rule often includes an entity filter, which filters the objects on which to run. Each rule includes a rule
action, which defines what the rule does. For every rule, the rule action is different. Rules can use entity
filters to define what the rule is, how it’s used, and what it does.

Some examples of rules include:

• Some products are not available to customers in Alaska and Hawaii.


• Only high-value customers are eligible for a specific promotion.
• If a customer orders high-speed Internet service, automatically add the hardware necessary to support
that service.
• If a customer orders 10 or more of a specific product, reduce the price for each product.

Rule processing occurs in the following sequence, using pricing as an example:

1. The interface calls an implementation.


2. The implementation specifies that a rule is applied to the order.
3. (Optional) The entity filter qualifies line items.
4. The rule action is applied to the qualified line items.
5. The applied rule action changes the order.
6. More rules may run in a defined sequence to result in appropriate order pricing.

© 2021 Vlocity LLC, a Salesforce


company 503
CME CPQ

Figure 72. Rule Processing Diagram

Rules execute with system, or org, privileges, and not those of the user triggering them. For example, a
user who has no rights to see the customer class level can run rules that are based on the customer class
level. If a rule must exclude certain products or pricing based on a user profile, the profile check must be a
part of the rule itself.

Rule Levels and Types


There are two Rules levels: Header-level Rules, and Item-level Rules. There are four Rule types:
Availability, Eligibility, Compatibility, and Pricing.

• Header-level Rules act on parent objects, such as Opportunity, Order, and Quote.
• Item-level Rules act on line items.

There are four Rule types. Each Rule type has a different action behavior.

• Availability
• Eligibility
• Compatibility, also known as Configuration or Validation
• Pricing

© 2021 Vlocity LLC, a Salesforce


company 504
CME CPQ

Availability and Eligibility Rules are defined at the header level. Compatibility and Pricing Rules are defined
at the item level.

Vlocity supports standard and advanced Rules. Using standard Rules, you might restrict availability of
products to customers in specific locations or restrict eligibility of some products based on Account type.
Advanced Rules implement a story. They provide the answers to questions such as, “How is each product
in a quote priced? Why is this set of products available to this specific customer at this time?” You can use
advanced Rules to do the following:

• Compute the pricing for the entire Order.


• Change the processing sequence.
• Add new steps.
• Include branching logic.
• Apply Entity Filters and Rule Actions to each product.

Use advanced Rules in the following situations:

• Compatibility depends on context, for example, recommend free installation for Gold customers.
• Compatibility depends on Product attributes, for example, exclude a service if the Internet speed is less
than 100 Mbps.

Availability and Eligibility Rules


Availability and eligibility rules provide the ability to show or hide products based on location, account
attributes, and other related information. The rules determine if a customer can obtain specific products and
ensure that only the appropriate offers or products are displayed to the customer. The rules provide the
ability to show or hide objects based on location, account attributes, and other related information.

Offering procedures support inclusion or exclusion. Vlocity supports multi-service point ordering, in which
different sites have different availability and eligibility rules. Eligibility rules exclude products of specific
types.

Availability and eligibility rules must run against the header object (Opportunity, Quote, or Order).

Availability rules are usually run first. If a product or service is unavailable, then eligibility is irrelevant.

Figure 73. Availability and Eligibility Rule Process Diagram

© 2021 Vlocity LLC, a Salesforce


company 505
CME CPQ

Use availability implementations to specify what product is available for a specific shipping state, city,
country, street, contact, or product attributes. Availability rules use the ProductAvailabilityInterface and
associated implementations. The ProductAvailabilityInterface is called when a request is made to provide a
list of products that are available to the customer to select. Availability implementations include the
following:

• AvailabilityFlowOpenImplementation: Evaluates defined availability rules and filters products and still
displays products that are not available so the user can see them but cannot add them to the cart.
• AvailabilityRulesFlowImplementation: Run advanced availability rules when the sequence of those rules
is important.
• DefaultAvailabilityOpenImplementation: Provides availability in a loosely typed nonoperative interface.
• DefaultProductAvailabilityImplementation: Nonoperative (does not run availability rules)
• FilterAvailabilityImplementation: Run advanced availability rules when the sequence of those rules is
unimportant.
• LocaleProductAvailability: Run standard availability rules.
• XLIAvailabilityValidationService: Invokes availability rules to validate line items.

Eligibility Rules use the ProductEligibilityInterface and associated implementations. The


ProductEligibilityInterface is called immediately after the ProductAvailabilityInterface and
DefaultProductAvailabilityImplementation. Eligibility implementations include the following:

• AccountTypeProductEligibilityImplementation: Run standard eligibility rules.


• DefaultEligibilityOpenImplementation
• DefaultProductEligibilityImplementation: Nonoperative (does not run eligibility rules)
• EligibilityFlowOpenImplementation
• EligibilityMatrixFlowImplementation
• EligibilityRulesFlowImplementation: Run advanced eligibility rules when the sequence of those rules is
important.
• FilterEligibilityImplementation: Run advanced eligibility rules when the sequence of those rules is
unimportant.
• XLIEligibilityValidationService: Availability Rules define which offers and products are available to a
customer based on address or account type. Eligibility rules exclude products of specific types.

See Interfaces, Implementations, and Services.

Example availability and eligibility rules include:

• The gold iPhone is not available in New York.


• Do not ship orders when the number of contract months is less than or equal to 10.
• Office Internet Solution is not available in Alaska or Hawaii.
• Billing accounts are not eligible to purchase Office Internet Solution.
• Bronze and silver accounts are not eligible to purchase Office Internet Solution.
• Office Internet Solution is available only in California.
• Free installation offer is shown only to customers who have not used it in the last year.
• Products are not available based on the postal code returned by the Canadian post portal.

© 2021 Vlocity LLC, a Salesforce


company 506
CME CPQ

• Products are not available if they have already been ordered.


• New customers are not eligible for specific products.

Vlocity supports multi-service point ordering, in which different sites within the same opportunity, order, or
quote have different availability and eligibility rules.

To base availability rules on attributes, you must ensure that you set those attributes on the appropriate
products. For more information, see Set Up Product Attributes.

The rule actions in availability and eligibility rules are called offering procedures. Offering procedures
support inclusion or exclusion. An offering procedure is another object that you define to include or exclude.
For more information, see Rule Actions.

Compatibility Rules
Compatibility rules are also known as configuration rules or validation rules. Compatibility rules determine if
a product combination is valid. Using compatibility rules, you can define that, when a product is added to
the cart, related products are added with it. You can also automatically add, automatically remove, or
recommend products based on other products in the cart.

Compatibility rules run on Order Line Item objects—Opportunity Line Item, Quote Line Item, or Order Line
Item. The rule actions involve product relationships.

Compatibility rules define the relationship between products to ensure that the correct combination of
products is added to the cart. Compatibility rules use the ProductValidationInterface and associated
implementations to execute definitions in the Product Relationship object. For more information about
product relationships, see Product Relationships Overview.

The validation interface and implementation are triggered when products are added to an order.
Compatibility rule implementations include:

• ValidationRulesFlowImplementation
Use ValidationRulesFlowImplementation when using a flow with Compatibility Rules included.
• ValidationRulesImplementation
Use ValidationRulesImplementation when using advanced Compatibility Rules, including those that
should be run conditionally.
• ProductRelationshipValidationImpl (deprecated)
Use ProductRelationshipValidationImpl when using standard Compatibility Rules with soft relationships—
requires or excludes.

NOTE
With the ValidationRulesImplementation, you must also use a flow that includes a custom
action with the class name UnconditionalProductValidation.

© 2021 Vlocity LLC, a Salesforce


company 507
CME CPQ

For more information about interfaces and implementations, see the Interfaces, Implementations, and
Services.

Figure 74. Compatibility Rule Process Diagram

Example compatibility rules include:

• VOIP requires Office Internet.


• Office Internet excludes Business Video Service when the download speed is less than 100 Mbps.
• Office Internet automatically adds free installation for high-priority accounts in California.
• VOIP requires Office Internet only if the customer doesn’t already have Office Internet.
• Automatically add an iPhone case when the customer adds two or more iPhones to the cart.

You can also create compatibility rules based on product attributes, for example, exclude Product B if
Internet speed is less than 100Mbps. For more information about product attributes, see Product Attributes.

Before you create a compatibility rule, you must create an entity filter that defines the conditions. The entity
filter must be run on the same object type as the rule. For more information about entity filters, see Entity
Filters Overview.

© 2021 Vlocity LLC, a Salesforce


company 508
CME CPQ

Pricing Rules
Pricing rules determine the price of the products in the cart. They use calculation procedures to calculate
the appropriate prices and apply discounts. When you create a pricing rule, you specify a calculation
procedure as the rule action.

Pricing rules can be hard or soft. When a pricing rule is soft, a customer can see a price even if she is not
eligible for it. When a pricing rule is hard, a customer cannot see the price if she is not eligible for it.

Many pricing rules run in a defined sequence to result in the correct order pricing. Pricing rules, using entity
filters and rule actions, modify orders. Actions may include calculation procedures, offering procedures,
product relationships, and entity filters.

Pricing depends on pricing rules, which are based on attributes. The attributes drive the pricing. You can
offer one product with pricing based on its attributes.

For example, you can offer broadband Internet service at different prices for 50 Mbps, 100 Mbps, and so
on. You can also define rules that specify one price for a product by itself, but a different price when the
product is part of a bundle.

You can implement promotions using pricing rules and the PricingRulesFlow. For more information about
flows, see Flows.

Pricing rules use the PricingInterface and associated implementations to calculate the correct order total.
The pricing interface and implementation are triggered when a product is added to, deleted from, or
modified in an opportunity, order, or quote.

Pricing rule implementations include:

• DefaultPricingImplementation: Use with standard pricing rules that are not dependent on any external
factors.
• PricingRulesFlowImplementation: Use with advanced pricing rules that are dependent on external
factors.

NOTE
You must associate the PricingRulesFlowImplementation class with the flow name. For
more information see PricingRulesFlowImplementation .

Example pricing rules include:

• Office Internet Solution costs $25 per month with a $10 one-time fee.
• All non-discounted child items should be priced at $0.
• Office Internet Solution is discounted by 10% if the quantity is 10 to 25, discounted by 15% for a quantity
of 26 to 99, and discounted by 20% for a quantity of 100 or more.

© 2021 Vlocity LLC, a Salesforce


company 509
CME CPQ

• The monthly price of Office Internet Solution is based on the selected download speed and upload
speed.

Pricing rules must be run on Line Item objects—Opportunity Line Item, Order Line Item, or Quote Line Item.

Rule Objects
A Rule object is a header object with three related objects: Rule Filter, Rule Action, and Rule Variable.

Rule object fields include:

• Rule Name specifies the Rule name.


• Is Active indicates if the Rule is currently in use.
• Object Name is the name of the object on which the Rule runs.
• Type specifies the rule type: Configuration, Pricing, Eligibility, or Availability.
• Description is a description of what the Rule does.

Figure 75. Rule Object Detail

The Rule Filter object encompasses the Entity Filter that a Rule uses. Rule Filter object fields include:

• Rule Filter Name specifies the name of the Rule Filter. Salesforce automatically names the Rule Filter.
• Entity Filter is a lookup to the Entity Filter that the Rule uses to qualify the objects. For more information,
see Entity Filters Overview.
• Rule is a lookup to the associated Rule object.

Figure 76. Rule Filter Object

The Rule Action object defines the actions associated with the Rule. Rule Action object fields include:

© 2021 Vlocity LLC, a Salesforce


company 510
CME CPQ

• Rule is a lookup to the associated Rule object.


• Entity Filter is a lookup to the Entity Filter the Rule uses. The Entity Filter serves different purposes
based on the Rule type. For more information, see Entity Filters Overview.
• Calculation Procedure is a lookup to the Calculation Procedure object associated with the Rule
Action. The Pricing Rule type uses the Calculation Procedure. For more information about Calculation
Procedures, see Calculation Procedures Overview.
• Offering Procedure is a lookup to the Offering Procedure object associated with the Rule Action.
The Availability and Eligibility Rule types use the Offering Procedure.
• Product Relationship is a lookup to the Product Relationship object associated with the Rule
Action. The Compatibility Rule type uses the Product Relationship. For more information about Product
Relationships, see Product Relationships Overview.

Figure 77. Figure: Rule Action Object

The Rule Variable object defines the variables that are used in the Entity Filters. Rule Variable object fields
include:

• Variable name specifies the name of the variable, which is used to reference the variable in the Entity
Filter.
• Rule is a lookup to the associated Rule object.
• Entity Filter is a lookup to the Entity Filter that the rule uses to qualify the objects that populate the
variable.
• Type specifies the variable type.
• Field Name to Assign specifies the field used to populate the variable.
• Object Path is a comma-delimited value that describes the path to the list of objects to use when
populating the variable.

Figure 78. Rule Variable Object

Rule Actions

You can specify the sequence in which rules execute rule actions. You can associate rule actions with
evaluation entity filters. If the rule action in an entity filter evaluates to false, then the action will not be
executed. The available rule actions vary by rule type.

© 2021 Vlocity LLC, a Salesforce


company 511
CME CPQ

Rules can perform the following actions:

• Require: If a customer adds Product A, require that she also adds Product B.
• Recommend: If a customer adds Product A, recommend that he also adds Product B.
• Exclude: If a customer adds Product A, stop her from adding Product B.
• Order add, or automatically add: If a customer adds Product A, automatically add Product B.
• Order replace, or switch: If a customer adds Product A, replace it with Product B.
• Order remove, or automatically remove: If a customer adds Product A and Product B, automatically
remove Product B.

The rule actions on eligibility and availability rules are offering procedures, special procedures for
presenting products and offers. Offering procedures are Exclusions or Inclusion. See Create Offering
Procedure Rule Actions.

Create Offering Procedure Rule Actions


The rule actions on eligibility and availability rules are offering procedures. These are special procedures
for presenting products and offers. Offering procedures include Exclusions or Inclusions.

• Exclusions: Exclude all products qualified by the entity filter in the rule action.
• Inclusions: Include all products qualified by the entity filter in the rule action.

To create offering procedures:

1. Click the Vlocity Offering Procedures tab in your org. If it is not visible, click Vlocity Offering
Procedures in the App Launcher.
2. Click New.
The Vlocity Offering Procedure Details page appears

© 2021 Vlocity LLC, a Salesforce


company 512
CME CPQ

3. In the Offering Procedure Name box, enter Exclusion.


4. Click Save & New.
5. In the Offering Procedure Name box, enter Inclusion.
6. Click Save.

Rule Variables
Rule Variables can hold information passed to them by Entity Filters. For example, suppose that you want
to identify offers that a customer has rejected in the past year. You must check each Product against the
Account Offers that a customer has rejected. This means you must check the vlocity_cmt__ProductId__c
field. When you do that, you must store the Product IDs in a list to compare them. In the Rule Variable, you
specify the path from the Product to the Account Offer, AccountId, vlocity_cmt__AccountOffer__c,
vlocity_cmt__AccountId__c.

You define a Rule Variable in a Rule and refer to it from the associated Entity Filter. You must create a Rule
before you can create a Rule Variable.

Variables use the syntax {!$Variable.variableName}, where variableName is the name of the Rule
Variable.

The Rule Variable includes the following fields:

• Variable Name specifies the variable name, which you will refer to in the Entity Filter conditions using the
format {!$Variable.variableName}.
• Rule is a lookup to the associated Rule. Salesforce automatically populates the Rule field.
• Type specifies the variable type:
• If the variable has a single value, select sObject, String, or Id.
• If the variable has more than one value, select List <sObject>, List <String>, or List <Id>.
• Object Path is a comma-delimited value describing the path to the list of objects to use to populate the
variable.
• Entity Filter is a lookup to the Entity Filter used to qualify the objects that populate the variable.
• Field Name to Assign specifies the object field used to populate the variable.

The Object Path consists of three comma delimited values. For example:

AccountId,vlocity_cmt__AccountOffer__c,vlocity_cmt__AccountId__c

The example describes the path from the Opportunity object related list to the Account.

1. AccountId defines the field holding the header object ID.


2. vlocity_cmt__AccountOffer__c defines the related list object API object name.
3. vlocity_cmt__AccountId__c defines the lookup field from the related list object to the header
object.

This example translates to:

SELECT allFields FROM vlocity_cmt__AccountOffer__c WHERE


vlocity_cmt__AccountId__c =: 'value in field AccountId'

© 2021 Vlocity LLC, a Salesforce


company 513
CME CPQ

The Field Name to Assign defines that vlocity_cmt__ProductId__c will be extracted from the
related list and added to the variable.

For more information about using and creating Rule Variables, see Create a Rule Variable.

Entity Filters Overview


Each rule may have an entity filter, which filters out the orders on which to run, and a rule action, which
defines what the rule does. Rules use entity filters to determine which items in an order are subject to the
rule action. Rules can contain one filter or many filters, depending on the business logic that the rule
implements. Filters are reusable. For example, as part of a promotion, you might create a filter to identify
premises where the service activation date is 45 days or less. Once created, that filter is available for use in
any rule that needs to use it.

An entity filter focuses on selected items in the order. For example, the flow implements promotional pricing
for Sports and Movies channels that are child products of the ICU Cable service. The action is applied to
the selected items, in this case, Sports and Movies. Applying the action results in changed order pricing.

An entity filter consists of one or more conditions that are based on fields or attributes. Entity filters apply
those conditions to objects. Each object is evaluated to determine if the condition applies to it.

You build entity filters by dragging elements to visually represent the filter results. Entity filters are
associated with rule actions. A rule action can be a matrix, calculation, or procedure.

Entity filters focus on select line items. For example, you can create an entity filter to return all child
products, except discounts. You can define entity filters to run for specific dates, or you can leave the dates
blank to run the filters on any date (all the time). You can also reuse entity filters.

You can add only one entity filter to an action, but you can create compound entity filters.

Filters are reusable and additive. Over time, it is possible to build a library of filters.

NOTE
Other names for entity filters include rule action filters and rule filters.

Entity Filter Conditions


An Entity Filter must include conditions. If it doesn’t, you might receive a Rule Support Error.

There are three types of Entity Filter conditions:

• Attribute—Select products based on attributes.


When you open the Attribute Selection dialog, it shows attribute categories and their associated
attributes. Attribute categories are only shown if their Applicable Type is set to any entity and

© 2021 Vlocity LLC, a Salesforce


company 514
CME CPQ

Applicable Sub Type is set to Product Attribute. See Create Attribute Categories in the Product
Designer.
• Field—Select products based on fields in an object.
• Filter—The system looks up something that was found in another filter and does something else with it.
This type is also known as a compound filter.

Entity Filters include operators and values. Conditions use the operators and/or. The index starts at zero.
You can use the following operators in an Entity Filter:

Table 60. Entity filter operators


Operator Meaning Example Explanation
﹦ Equal to Field = 1 Returns True if the Field or Attribute is equal to the specified Value.
≠ Not equal to Field ≠ 3 Returns True if the Field or Attribute isn’t equal to the specified
Value.
< Less than Field < 4 Returns True if the Field or Attribute is less than the specified Value.
≲ Greater than Field ≲ 4 Returns True if the Field or Attribute is less than or equal to the
or equal to specified Value.
> Greater than Field > 9 Returns True if the Field or Attribute is greater than the specified
Value.
≳ Greater than Field ≳ 10 Returns True if the Field or Attribute is greater than or equal to the
or equal to specified Value.
starts with Value starts with ABC Returns True if the Field or Attribute string begins with the specified
Value.
ends with Value ends with ABC Returns True if the Field or Attribute string ends with the specified
Value.
contains Value contains ABC Returns True if the Field or Attribute string is found within the Value.
not contains Value not contains Returns True if the Field or Attribute isn’t contained within the
A;B;C specified Value.
in Field in 2;4;6 Returns True if the Field or Attribute string is found within the
specified Value.
not in Field not in 2;4;6 Used in many-to-one relationships, to check whether one value isn’t
in a list of values.
of type Field of type string Used to check whether an object ID is of a certain object type.
not of type Field not of type string Returns True if the Field or Attribute string isn’t the specified data
type.

Used to check whether an object ID isn’t of a certain object type.


contains all Field contains all Returns True if the Field or Attribute string contains all of the
characters in the Value. Used for many-to-many evaluations if two
semicolon-delimited values are specified.
contains any Field contains any Returns True if the Field or Attribute contains any of the characters
in the Value. Used for many-to-many evaluations if two semicolon-
delimited values are specified.

Entity Filter Types


There are two types of Entity Filters: Evaluation and Qualification.

• Evaluation— Determines if a set of object records matches specific conditions. Returns true or false.

© 2021 Vlocity LLC, a Salesforce


company 515
CME CPQ

• Qualification— Determines if a set of records qualify to be acted upon. Returns qualified line items.

In Evaluation Entity Filters, the input is a list of items, and the output is the result true or false. Evaluation
filters are internal filters. Evaluation filters evaluate if all, any, or none of the objects satisfy a set of
conditions.

In the image below, the evaluation filter evaluates to true if any of the product children has a maximum
quantity of less than 10 and a minimum quantity larger than 2. You would also use an Evaluation Entity
Filter to act on accounts that have not used free installation in the past year. You can use Evaluation Entity
Filters as arguments in Qualification Entity Filter conditions.

Figure 79. Sample Evaluation Entity Filter

In Qualification Entity Filters, the input is a list of items and the output is a list of qualified items. Qualified
items meet the filter conditions. Qualification Entity Filters quantify a set of objects against a set of
conditions.

For example, you could return only those accounts where the shipping state is Alaska or Hawaii.

© 2021 Vlocity LLC, a Salesforce


company 516
CME CPQ

Figure 80. Sample Qualification Download Speed

Compound Entity Filters


When using entity filters of type filter, you provide a comma-delimited path to the list of objects to pass to
the internal filter. That internal filter must be an evaluation filter and the evaluation criteria must be set.

Compound filter example:

Id,vlocity_cmt__ProductChildItem__c,vlocity_cmt__ParentProductId__c

The value consists of three comma-delimited values. The example describes the path from the product
object to the product child items related lists.

• Id defines the field that holds the header object ID.


• vlocity_cmt__ProductChildItem__c defines the API object name of the related list object.
• vlocity_cmt__ParentProductId__c defines the lookup field from the related list object to the
header object.

This example translates to:

SELECT allFields FROM vlocity_cmt__ProductChildItem__c WHERE


vlocity_cmt__ParentProductId__c =: 'value in field Id'

Entity Filters Tab


You create and edit Entity Filters on the Entity Filters tab. The Entity Filters tab consists of two sections—
Entity Filter Details and Entity Filter Conditions.

© 2021 Vlocity LLC, a Salesforce


company 517
CME CPQ

Entity Filter Details includes the following information:

• Entity Filter Name defines the name of the filter.


• Active defines if a filter is active.
• Filter On Object Name defines the API object name on which the filter acts.
• Formula for Conditions defines the how the filter conditions are connected. If not specified, the
conditions are joined by and. That is, all of the conditions must apply.
• Attribute Lookup Field Name defines a field name that contains a JSON attribute string.
• Type defines the filter type—Qualification or Evaluation.
• Evaluation Criteria defines the evaluation criteria for Evaluation filters. The Evaluation Criteria field is
required for Evaluation filters. The available values are All, Any, or None.
• Valid From defines the date the filter becomes active. The Valid From field must be used with the Valid
Until field.
• Valid Until defines the date the filter becomes inactive. The Valid Until field must be used with the Valid
From field.
• Description describes the filter. This value is displayed when the filter excludes or includes a product
using an Availability or Eligibility Rule.

The Entity Filter Conditions section includes the following information:

• Index defines the sequence of conditions. Using the index values, you can build a formula to evaluate
the conditions. For example, {0}AND{1}OR{2}.
• Type defines the filter condition type. The supported values are Attribute, Field, and Filter.
• Use Attribute when creating a condition on a JSON attribute.
• Use Field when creating a condition on a field.
• Use Filter when creating a condition on another internal filter.

NOTE
If you select Attribute from the Type picklist, you must include a valid attribute in the
Field/Attribute Name field. If you do not, you may receive a null pointer error.

• Field Type defines the field type for a Field Entity Filter. Vlocity automatically populates this field when
you select the field name.
• Field/Attribute Name defines the field name or attribute identifier on which the condition is run.
• Operator defines the condition operator.
• Value defines the value to compare. Currently, the following values are available:
• Literals—Literal string values.
• Variables—Variables defined through the rules or passed through the implementation. Use the
following syntax to reference variables: {!$Variable.variableName}, where variableName corresponds
to the variable name used.
• Functions—Supports simple Date and DateTime functions, such as today, today-numOfDays, and
today+numdOfDays.

© 2021 Vlocity LLC, a Salesforce


company 518
CME CPQ

Figure 81. Entity Filter Object Detail Page

Entity Filters and Rule Types


Entity Filters behave slightly differently depending on their Rule type.

• In Availability and Eligibility Rules, the Entity Filter qualifies products. The system expects the Entity Filter
to run on the Product2 object. Entity Filters for Availability and Eligibility Rules run on the header level.
• In Compatibility Rules, an Entity Filter works with the Rule Filter to further qualify an object. That is, the
Rule Filter is a general qualifier and the Entity Filter narrows down the qualified products. The Entity Filter
and the Rule must be run on the same object type. Entity Filters for Compatibility Rules run on the line-
item level.
• In Pricing Rules, the Entity Filter determines to which items the Rules are applied. Entity Filters for
Pricing Rules run on the line-item level.

FilterEvaluator Class
The FilterEvaluator class uses Entity Filters to compare objects to the defined conditions.

Table 61. FilterEvaluator Class Parameters


Parameter Name Parameter Description
objectIds The IDs of the objects on which the filter runs.
entityFilterIds The IDs of the filters to run.
fieldsToQuery The extra object fields to query.
variablesMap The external variables passed to the filter evaluator. This parameter is used with the parameter
variableNameToType.
variableNameToType The external variable names and their types. This parameter is used with the parameter variablesMap.

© 2021 Vlocity LLC, a Salesforce


company 519
CME CPQ

Example 16. FilterEvaluator Class


FilterEvaluator filterEvaluator = new FilterEvaluator();
filterEvaluator.objectIds = (List<Id>)inputMap.get('objectIds');
filterEvaluator.entityFilterIds = (List<Id>)inputMap.get('entityFilterIds');
filterEvaluator.fieldsToQuery = (List<String>)inputMap.get('fieldsToQuery');
filterEvaluator.variablesMap = (Map<String,
Object>)inputMap.get('variablesMap');
filterEvaluator.variableNameToType = (Map<String,
String>)inputMap.get('variableNameToType');
filterEvaluator.evaluateFilters();

Table 62. FilterEvaluator Class Methods


Method Name Input Parameters Return Value
evaluateFilters None Map<Id,Set<Id>>

Map of filter IDs to a set of qualified object IDs.

Product Relationships Overview


Products can be related to one another. For example, a product may require, exclude, or recommend
another product. You can define relationships between products using Product Relationship objects.
Product Relationship objects are then used in compatibility rules to ensure that the correct combination of
products is ordered. For example, if a customer orders Product A, the interface may recommend Product B.

A product relationship is or is not conditional. If a product relationship is conditional, it is only applied under
certain conditions, defined in the compatibility rules. If a product relationship is not conditional, then it
always applies.

There are soft relationship types and hard relationship types.

Soft relationships include:

• Recommends
• Requires
• Excludes

Hard relationships include:

• Automatically add
• Automatically replace
• Automatically remove

You define product relationships in the Product Relationship object, which corresponds to the Product
Relationship record detail page.

• Product Relationship Name is a short description of the Product Relationship.

© 2021 Vlocity LLC, a Salesforce


company 520
CME CPQ

• Product is a lookup to the product to evaluate.


• Relationship Type is the action to execute.
• Soft relationships recommend, require, or exclude products.
• Hard relationships automatically add, automatically remove, or automatically replace products.
• Related Product is a lookup to the product to act upon.
• Default Quantity is the default number of products to add, delete, recommend, and so on.
• Add Mode specifies if the related product is a child, sibling, or root.
• asSibling adds the related product at the same level as the current product.
• asChild adds the related product as a child of the current product.
• asRoot adds the related product at the root of the cart.

NOTE
For the asChild option to work, the product to be added must be defined as a child to
the original product, with a default quantity of zero. You may also need to run the
Product Hierarchy maintenance job. For more information, see Administration Jobs
Reference for Vlocity Communications, Media, and Energy.

• Context is the context of the defined relationship.


• Bundle specifies that the defined relationship executes only within the context of its root product.
• Cart specifies that the defined relationship executes if the product is anywhere in the cart.
For example, a rule specifies that adding an iPhone to the cart automatically adds the Airpod. The iPhone
and Airpod are both included in the Wireless bundle. If the Context is Cart, only one Airpod will be added
regardless of the number of Wireless bundles in the cart. If the Context is Bundle, then an Airpod will be
added for each Wireless bundle that includes the iPhone.
• Description is a longer description of the product relationship.
• Max Quantity is the maximum number of the related product a customer can add to the original product.
• Min Quantity is the minimum number of the related product a customer must add to the original product.
• Is Conditional specifies if a relationship is or is not conditional.

NOTE
This option is only applicable if the UnconditionalProductValidation custom action is
included in the Validation flow. For more information about flows, see Flows.

To use Product Relationship objects to their fullest extent, you must use the
ValidationRulesFlowImplementation, which includes a custom action with the specified class name
UnconditionalProductValidation. You can also use a custom implementation, as long as it includes the
UnconditionalProductValidation class or a similar class. For more information, see Interfaces,
Implementations, and Services.

Create a Product Relationship


You create product relationships to relate products to one another.

© 2021 Vlocity LLC, a Salesforce


company 521
CME CPQ

For example, you may want to recommend that, when a customer orders an iPhone, he also orders an
iPhone case. To do so, you create a product relationship for the iPhone.

1. Go to the Products tab.


2. Search for and go to the product on which to base the relationship.
3. Scroll down to the Product Relationships related list.

4. Click New Product Relationship.


5. On the Product Relationship Edit page, enter the following information:
• Product Relationship Name describes what this relationship is, for example Sonic Screwdriver
recommends Psychic Paper.
• Product is a lookup to the product.
• Relationship Type defines the action that occurs, for example, Recommends.
• Related Product is a lookup to the product to relate, for example, Psychic Paper.
• Description describes the relationship.
• Max Quantity is the maximum number of the related product a customer can add to the original
product.
• Min Quantity is the minimum number of the related product a customer can add to the original
product.
• Is Conditional specifies if a relationship is or is not conditional.
This option is only applicable if the UnconditionalProductValidation custom action is include in the
Validation flow.
• Message is the custom message that appears when the product is added to the cart. For more
information, see Create a Custom Product Configuration Message.
• Default Quantity is the number of products to add, delete, recommend, and so on, for example,
1.00.
• AddMode indicates how the product should be added in relation to the original product.
• Context is the context of the defined relationship, Bundle or Cart.
For detailed field descriptions, see Product Relationships Overview.

© 2021 Vlocity LLC, a Salesforce


company 522
CME CPQ

6. Click Save.

Test a Product Relationship


After you create a Product Relationship, you can test it by creating a new Opportunity, Order, or Quote and
adding the Product to the cart.

To test a Product Relationship:

1. Create a new Opportunity, Order, or Quote.


2. Add the Product to the cart.
3. Confirm that the message appears.

4. Add the related Product to the cart.


5. Confirm that the message no longer appears.

About Build Rules and Entity Filters


Before building a Rule, you must create all of the associated Entity Filters, Rule Filters, and Rule Actions.
Also, you must create all of the Rule Action procedures.

© 2021 Vlocity LLC, a Salesforce


company 523
CME CPQ

Rules can include four different objects:

• Rule
• Rule Filter
• Rule Action
• Rule Variable (optional)

For more information, see Rule Objects.

When you define a Rule, you provide a descriptive short name and a long description. You specify the filter
type to apply to the object. You also set the status as active or inactive and set the effective dates. You can
define Rule using natural language, so people can read and understand what the rule is meant to do.

Before you build a rule, plan ahead:

• What triggers the rule?


• What does the rule do?
• When does the rule apply?
• On which objects do the rules run?

After you have created the prerequisite elements, use Vlocity Rule Builder to group the elements in a Rule.

Accessing the Vlocity Rule Builder


There are several ways to go to Vlocity Rule Builder.

To go to the Vlocity Rule Builder from a recently created Rule:

1. Click the Vlocity Rules tab.


2. In the Recent Vlocity Rules list, click the Rule Name.
3. In the Vlocity Rule Detail section, click Edit.

To go to the Vlocity Rule Builder from an existing Rule:

1. Click the Vlocity Rules tab.


2. Click Go.
3. Click the Rule Name.
4. In the Vlocity Rule Detail section, click Edit.

To go to the Vlocity Rule Builder to create a new Rule:

1. Click the Vlocity Rules tab.


2. Click New Vlocity Rule.

Using the Rule Builder, you define what the Rule must do, associate Entity Filters with the Rule, and define
the Rule Actions.

© 2021 Vlocity LLC, a Salesforce


company 524
CME CPQ

Figure 82. Vlocity Rule Builder

Create a Rule Action Entity Filter


Entity filters filter the orders on which to run. An entity filter consists of one or more conditions that are
based on fields or attributes. Entity filters apply those conditions to objects.

You build entity filters by dragging elements to visually represent the filter results. You can define entity
filters to run for specific dates, or you can leave the dates blank to run the filters on any date (all the time).
You can also reuse entity filters.

In this example, Office Internet Solution is not available to customers in Alaska and Hawaii when the
selected download speed is less than 100 Mbps.

NOTE
To edit entity filters, the DefaultEntityFilterEditFieldset custom setting must be present and
include the value Entity_Filter_Edit_Field_Set. For more information, see CPQ
Configuration Settings and Add CPQ Configuration Setup Settings.

© 2021 Vlocity LLC, a Salesforce


company 525
CME CPQ

To create a rule action entity filter:

1. Click the Vlocity Entity Filters tab.


2. Click New.

3. Enter the following information:


• Entity Filter Name is the name for the entity filter, for example, Alaska Hawaii Download
Speed.
• Filter On Object Name specifies the object on which to run the entity filter, for example, Order
Product <Order Item>.
• (Optional) Attribute Lookup Field Name defines a field name that contains a JSON attribute string.
• (Optional) Valid From defines the date the filter becomes active. The Valid From field must be used
with the Valid Until field.
• (Optional) Valid Until defines the date the filter becomes inactive. The Valid Until field must be used
with the Valid From field.
• Active specifies if the entity filter is active or inactive.
• Type defines the filter type—Qualification or Evaluation. For more information, see Entity Filter
Types. This example uses a qualification entity filter.
• Evaluation Criteria defines the evaluation criteria for evaluation filters. The Evaluation Criteria field
is required for evaluation filters. The available values are All, Any, or None.
• Description provides a short description for the entity filter.
• Formula for Conditions defines how the filter conditions are connected. If not specified, the
conditions are joined by and.
4. Click Save.
5. On the Vlocity Entity Filter page, scroll down to the Entity Filter Conditions section.
6. Click Add.

© 2021 Vlocity LLC, a Salesforce


company 526
CME CPQ

7. From the Type picklist, select the appropriate value.


• Use Attribute when creating a condition on a JSON attribute.
• Use Field when creating a condition on a field.
• Use Filter when creating a condition on another internal filter.
In this example, there are two types, Field and Attribute.
8. In the Field/Attribute Name box, click Select.
The Field or Attribute Selection dialog box opens. The option you select in the first column may
expose more columns. In this example, selecting Account ID<AccountId> exposes another column
from which you can select Shipping State/Province.

© 2021 Vlocity LLC, a Salesforce


company 527
CME CPQ

9. Select the appropriate fields and click Save.


10. From the Operator picklist, select the appropriate condition operator. In this example, select = (equal
sign) for the states and in for the download speed.

11. In the Value box, enter the appropriate value. In this example, enter AK when creating the first
condition, HI when creating the second condition, and 25 Mpbs;50 Mbps;75 Mbps when creating
the third condition.

© 2021 Vlocity LLC, a Salesforce


company 528
CME CPQ

NOTE
The delimiter is a semi-colon (;). Ensure there is no space between the “;” and the
next value. The values must exactly match the attribute values as they’re defined on
the product.

12. Repeat steps 6 through 11 to define all of the conditions.


13. Click Save.

Figure 83. Entity Filter

Rule Variables
Use Rule Variables to hold the information passed to Rules from Entity Filters.

The following are two examples of when to use Rule Variables.

• You want to identify offers that have been rejected in the past year.
• You want to identify promotions that have been offered to and rejected by a customer in the last six
months.

Before you create a Rule Variable, plan ahead:

1. Create the Rule that will use the variable.

© 2021 Vlocity LLC, a Salesforce


company 529
CME CPQ

2. Determine the Entity Filter field that will populate the Rule Variable.
3. Determine the Rule Variable type. What information do you need the variable to store?
• If the variable has a single value, it will be an Sobject, String, or Id.
• If the variable has more than one value, it will be a List<Sobject>, List<String>, or List<Id>.
The Rule Variable type should match the Entity Filter field type.
4. Determine the path from the parent object to the queried object.
5. Determine which Entity Filter you must use to qualify the object records and populate the Rule Variable.

Creating a Rule Variable


To create a Rule Variable:

1. Create the Rule. For more information, see Go to Vlocity Rule Builder.
2. After you save the rule, on the Vlocity Rule page, scroll down to the Rule Variables related list.
3. Click New Rule Variable.

4. Enter the following information:


• Variable Name: for example, DeclineOfferIds.
• Entity Filter is a lookup to the Entity Filter associated with this variable, if that filter has been
created.
• Type specifies the variable type—sObject, String, Id, List<sObject>, List<String>, or
List<ID>.
• Field Name to Assign specifies the object field that populates the variable, for example
vlocity_cmt__ProductId__c.
• Object Path specifies the path from the parent object to the queried object, for example,
AccountId, vlocity_cmt__AccountOffer__c, vlocity_cmt__AccountId__c.

NOTE
Salesforce automatically enters the associated Rule name, for example, Exclude
offers rejected by customers.

5. Click Save.

Create a Standard Availability Rule


You can create Availability Rules for a product to restrict products by shipping address state or postal code
range. Unavailable products are excluded from selection in Opportunities, Orders, and Quotes.

© 2021 Vlocity LLC, a Salesforce


company 530
CME CPQ

NOTE
The Country and City fields are not currently used in Availability Rules.

1. On the Product page, scroll down to the Products Not Available related list.
2. Click New Product Not Available.

In the Product Not Available Rule box, enter a name for the rule.
3. Enter either a state or an inclusive postal code range.

NOTE
Data in the State field is case-sensitive and must match data in the Shipping Address
field on the Opportunity, Order, or Quote.

4. Enter a start date.


5. If you want the Rule to expire, enter an end date.
6. Click Save.
For example, in the screenshots, the Office Internet Solution is not available in Alaska or Hawaii.

Figure 84. Products Not Available List

© 2021 Vlocity LLC, a Salesforce


company 531
CME CPQ

Create a Standard Eligibility Rule


You can create Eligibility Rules to restrict products by Account Type or SLA. Ineligible products are
excluded from the Opportunity, Order, and Quote Managers.

For example, you can make a Product ineligible for all Bronze-level business accounts. Another product
may be restricted to all Consumer Accounts, regardless of SLA.

In this procedure, the Office Internet Solution cannot be ordered on an Account when the Record Type is
Billing.

1. On the Product page, scroll down to the Products Not Eligible related list.
2. Click New Product Not Eligible.

3. In the Product Not Eligible Rule field, enter a name for the Rule.
4. Enter a Start Date.
5. If you want the Rule to expire, enter an End Date.
6. From the Account Record Type picklist, select the Account record type that is not eligible for the
product, for example, Billing.
7. From the Account SLA picklist, select the account service level agreement to which the Rule applies.
8. Click Save.

Figure 85. Products Not Eligible Related List

Create an Advanced Eligibility Rule


Use an advanced eligibility rule when there are multiple criteria to determine if a customer is eligible for a
product.

© 2021 Vlocity LLC, a Salesforce


company 532
CME CPQ

In this example, customers are eligible for free installation when they have been a customer for less than
one year.

To create an advanced eligibility rule:

1. Create the necessary entity filters.


In this example, create an entity filter that returns accounts that have been active for less than one
year.
• The Entity Filter Name is New customers.
• The Filter on Object Name is Order.
• Active is selected.
• The Type is Qualification.
2. Create the necessary entity filter conditions.
In this example, the condition returns the accounts that were created less than one year from today.
• The Type is Field.
• The Field/Attribute Name is Account.CreatedDate.
• The Operator is < (less than sign).
• The Value is today-364.

3. Click the Vlocity Rules tab.


a. Click New.
b. Enter the following information:
• Rule Name is the name of the rule. Enter a descriptive name so you can easily remember what
the rule does.
• From the This defines picklist, select the rule type, for example, Eligibility.
• From the Rule that applies to picklist, select the object to which the rule applies, for example,
Order <Order>.
• From the And is picklist, select if the rule is Active or Inactive.
• In the Description field, enter a description of what the rule does.

© 2021 Vlocity LLC, a Salesforce


company 533
CME CPQ

c. Scroll down to the Filters and Actions section.


4. Click Filters.
a. In the Filters and Actions list, locate the entity filter.
b. Click the Add to Rule Filter link to the right of the filter to add.
5. Click Actions.

a. In the Filters and Actions list, click Add To Rule Action to include or exclude the filter.

NOTE
The rule actions in availability and eligibility rules are called offering procedures.
Offering procedures support inclusion or exclusion. An offering procedure is
another object that you define to include or exclude. For more information, see
Rule Actions.

b. Scroll to the top of the page and click Save.

© 2021 Vlocity LLC, a Salesforce


company 534
CME CPQ

Figure 86. Rule Builder, Advanced Eligibility Rule

Test Availability and Eligibility Rules


You can test Availability and Eligibility Rules by adding products to the cart in the Opportunity, Order, or
Quote Manager. You can create a new Opportunity, Order, or Quote from the appropriate Account and try to
add items to the cart.

For example, the Office Internet Solution product should not appear in the list if the shipping address state
is AK or HI, nor should it appear for Billing Accounts.

NOTE
Before you can test Rules, you must ensure that Vlocity is using the appropriate interface
implementation. For more information, see the Interfaces, Implementations, and Services.

To test Availability and Eligibility Rules:

1. Click the Orders tab.


2. Create a new Order.
3. On the Order detail page, scroll down to the Order Manager.

© 2021 Vlocity LLC, a Salesforce


company 535
CME CPQ

4. Search for the products that are not supposed to be there.


5. Confirm that only the available and eligible products appear.

Create a Compatibility Rule


Compatibility Rules determine if a product combination is valid. Using Compatibility Rules, you can define
that, when a product is added to the cart, related products are added with it. You can also automatically
add, automatically remove, or recommend products based on other products in the cart.

Compatibility Rules are also known as Configuration Rules or Validation Rules.

In the example, Gold accounts are automatically given a free case when they order an iPhone 6.

To create a Compatibility Rule:

1. Create the necessary Product Relationships. For more information, see Create a Product Relationship.
In this example, create a Product Relationship for the Apple iPhone 6 that automatically adds an
iPhone case.
2. Create the necessary Entity Filters. For more information, see About Build Rules and Entity Filters
In this example, create an Entity Filter that returns the Gold accounts.
• The Entity Filter Name is Parent Order Account Gold.
• The Filter on Object Name is Order Product<OrderItem>.
• Active is selected.
• The Type is Qualification.
3. Create the necessary Entity Filter conditions. For more information, see Entity Filter Conditions.
In this example, the condition finds the Gold accounts.
• The Type is Field.
• The Field/Attribute Name is Order.Account.vlocity_cmt_vCustomerPriority.
• The Operator is = (equal sign).
• The Value is Gold.
4. Click the Vlocity Rules tab.
5. Click New.

6. Enter the following information:


• Rule Name is the name of the Rule. Enter a descriptive name so you can easily remember what the
Rule does.

© 2021 Vlocity LLC, a Salesforce


company 536
CME CPQ

• From the This defines picklist, select the Rule type, for example, Configuration.
• From the Rule that applies to picklist, select the object to which the Rule applies, for example,
Order Product<Order Item>.
• From the And is picklist, select if the rule is Active or Inactive.
• In the Description field, enter a description of what the Rule does.
7. Scroll down to the Filters and Actions section.

8. Click the Filters button.


9. In the Filters and Actions list, locate the Entity Filter. Click the Add to Rule Filter link to the right of the
filter to add.
10. Click the Actions button.
11. In the Filters and Actions list, click the Add to Rule Action link to the right of the action to add.
12. Scroll to the top of the page and click Save.

© 2021 Vlocity LLC, a Salesforce


company 537
CME CPQ

Figure 87. Rule Builder, Compatibility Rule

Test a Compatibility Rule


You can test Compatibility Rules by adding products to the cart in the Opportunity, Order, or Quote
Manager. You can create a new Opportunity, Order, or Quote from the appropriate Account and add items
to the cart.

For example, ordering an iPhone 6 from a Gold Account should add a free case.

NOTE
Before you can test Rules, you must ensure that Vlocity is using the appropriate interface
implementation. For more information, see "Set an Implementation," in the Interfaces,
Implementations, and Services.

To test a Compatibility Rule:

© 2021 Vlocity LLC, a Salesforce


company 538
CME CPQ

1. Click the Orders tab.


2. Create a new Order.
3. On the Order detail page, scroll down to the Order Manager.
4. Add the product that should activate the Compatibility Rule.
5. Confirm that the appropriate message appears or action has been taken.

Create a Standard Pricing Rule


In the example, the Call Me 500 Plan costs $10 per month with a $10 one-time fee. One-time and monthly
totals reflect quantity and manual discounts. To implement this, you must define the one-time and recurring
list price for Call Me 500 Plan.

1. Click the Products tab.


2. Search for and go to the Product to price.
3. Scroll down to the Price Books section and confirm that the appropriate Price Book is there, including
the List Price and Standard Price.
For more information about Price Books, see Manage Price Books in the Salesforce Help.
4. Click Edit.
5. On the Price Book Entry Edit page, enter the List Price and Recurring Price.
6. Click Save.

Figure 88. Price Book Entry Edit Page

Create an Advanced Pricing Rule


Use advanced pricing rules to implement attribute- and volume-based pricing. Advanced pricing rules price
products based on attributes instead of a price book.

For example, you can base the price of the Office Internet Solution on download and upload speeds. You
can also provide a discount if a customer orders more than one Call Me 500 Plan. For more information
about pricing, see Pricing Rules.

To create an advanced Pricing Rule:

© 2021 Vlocity LLC, a Salesforce


company 539
CME CPQ

1. If necessary, create a Calculation Matrix to define quantity ranges or discounts. For more information,
see Calculation Matrices.
2. Create a Calculation Procedure to calculate the different charges. For more information, see Test a
Product Relationship.
3. If necessary, create one or more Entity Filters. For more information, see Entity Filters Overview.
4. Click the Vlocity Rules tab.
a. Click New.
b. Enter the following information:
• Rule Name is the name of the Rule. Enter a descriptive name so you can easily remember what
the Rule does.
• From the This defines picklist, select the Rule type, for example, Pricing.
• From the Rule that applies to picklist, select the object to which the Rule applies, for example,
Order Product<Order Item>.
• From the And is picklist, select if the rule is Active or Inactive.
• In the Description field, enter a description of what the Rule does.

5. Scroll down to the Filters and Actions section.


a. Click the Filters button.
b. Click the Add to Rule Filter link to the right of the filter to add.
6. Click the Actions button.
7. In the Filters and Actions list, click the Add to Rule Action link to the right of the action to add.
8. Scroll to the top of the page and click Save.

Test a Pricing Rule


You can test Pricing Rules by adding products to the cart in the Opportunity, Order, or Quote Manager. You
can create a new Opportunity, Order, or Quote from the appropriate Account and add items to the cart.

NOTE
Before you can test Rules, you must ensure that Vlocity is using the appropriate interface
implementation. For more information, see "Set an Implementation," in the Interfaces,
Implementations, and Services.

© 2021 Vlocity LLC, a Salesforce


company 540
CME CPQ

To test a Pricing Rule:

1. Add the Rule to the Pricing Flow. For more information, see Add a Rule to the Pricing Flow.
2. Click the Orders tab.
3. Create a new Order.
4. On the Order detail page, scroll down to the Order Manager.
5. Add the products that are relevant to the Pricing Rule.
6. Confirm that the price each product is correct.

Add a Rule to the Pricing Flow


A pricing flow defines the sequential processing of rules and logic.

1. From Setup, in the Quick Find box, enter Flows.


2. Click Flows.
3. Click Pricing Rules Flow.

4. Open the flow.

If… Then…
An active flow is not present Next to the latest inactive flow, click Open.
An active flow is present Deactivate the latest flow, and then click Open. Save the flow as a new version.
5. In the palette, scroll to the Apex section.

© 2021 Vlocity LLC, a Salesforce


company 541
CME CPQ

6. Select vlocity_cmt__RuleAction and drag it to the flow.


The vlocity_cmt__RuleAction dialog box opens.

© 2021 Vlocity LLC, a Salesforce


company 542
CME CPQ

a. Enter a unique Name for the step.


b. On the Inputs tab, select ruleType. In the Source field, enter Pricing.
c. Click Add Row.
d. Select ruleName. In the Source field, enter the exact name of the pricing Rule. You may want to
copy the Rule name and paste it to avoid errors.
e. Click Add Row.
f. Select doCommit. In the Source field, enter {!GlobalConstant.True}.
g. Click OK.
7. Connect the new step as the last step under the Is Order branch.

© 2021 Vlocity LLC, a Salesforce


company 543
CME CPQ

Invoke the Rules Engine Using Apex


You can reference the Rules Engine in two ways—using a flow or using Apex code. You invoke the Rules
Engine using Apex code.

You can invoke rules using the RuleSupport class. The elements in FlowStaticMap are different based on
the rule type.

//The elements in the FlowStaticMap will be different based on the rule type
//The following describes the input in the case of an Eligibility/Availability
rule
FlowStaticMap.flowMap.put('itemList',new list<Sobject>{item});
FlowStaticMap.flowMap.put('pricebookIdToItemWrapper',
pricebookIdToItemWrapper);
Map<String, Object> input = new Map<String, Object>();
Map<String, Object> output = new Map<String, Object>();
input.put('ruleIdentifierType', 'Id');
input.put('ruleIdentifiersList', ruleIds);
input.put('flowMap', FlowStaticMap.flowMap);
RuleSupport ruleSupport = new RuleSupport();
RuleSupport.invokeMethod('executeRules',input, output, null);

© 2021 Vlocity LLC, a Salesforce


company 544
CME CPQ

Deactive a Rule
You can deactivate rules. You want to deactivate rules when migrating Vlocity CLM to another org, for
example.

To deactivate a rule:

1. Go to the Vlocity Rules tab.


2. View all rules.
3. Next to the rule to deactivate, click Edit.
4. Click Edit Mode.

5. From the And Is picklist, select Inactive.


6. Click Save.

Setting Up an Availability or Eligibility Rule to Exclude Declined Products


This topic provides an example of how to configure an availability or eligibility rule where all products that
have been declined as part of the account offers within the last 12 months are excluded from the product
list. Eligibility and availability rules must be created against the Header object (Opportunity, Quote , Order).
This example is based on the Opportunity object.

© 2021 Vlocity LLC, a Salesforce


company 545
CME CPQ

To configure the rule, you must create one rule action and one rule variable. The rule variable will collect
the declined product IDs from the account offers object related to the account. This variable will then be
used within the entity filter associated with the rule action in order to exclude the correct products.

Configuring the rule involves the following tasks:

1. Create the Exclude Offering Procedure


2. Create the Decline Account Offers Entity Filter
3. Create the Filter Excluded Products Entity Filter
4. Create the declinedProductIds Rule Variable

Create the Exclude Offering Procedure


The offering procedure defines an exclusion type.

Create the Decline Account Offers Entity Filter


The entity filter is used to collect the product ids from the AccountOffer__c object based on the specified
criteria. In this case, declined offers within the past 12 months.

© 2021 Vlocity LLC, a Salesforce


company 546
CME CPQ

Create the Filter Excluded Products Entity Filter


The entity filter is used to qualify products against the previously collected variable declinedProductIds.
Please note the reference to the variable in the filter condition.

Create the declinedProductIds Rule Variable


The rule variable defines how to populate the variable.

• Variable Name: Name of the variable. This name will be used to reference the variable in the entity filter
conditions.
• Rule: Lookup to the associate rule
• Type: Type of variable
• Object Path: Comma-delimited value describing the path to the list of objects to use in populating the
variable. The Object Path consists of three comma-delimited values. The sample
AccountId,vlocity_cmt__AccountOffer__c,vlocity_cmt__AccountId__c describes the
path to the account offers related list from the opportunity object.

© 2021 Vlocity LLC, a Salesforce


company 547
CME CPQ

• AccountId defines the field holding the ID of the header object


• vlocity_cmt__AccountOffer__c defines the API object Name of the related list object
• vlocity_cmt__AccountId__c defines the lookup field from the related list object to the header
object, so effectively this value translates to:

SELECT allFields FROM vlocity_cmt__AccountOffer__c WHERE


vlocity_cmt__AccountId__c =: 'value in field AccountId'

• Entity Filter: The filter used to qualify the objects populating the variable
• Field Name to Assign: the field used to populate the variable. It defines that
vlocity_cmt__ProductId__c is extracted from the related list and added the variable.

Setting Up a Vlocity Attribute Configuration Rule to Modify Attributes Across


Line Items
This topic provides an example of how to define a configuration rule in which a parent line item modifies the
attributes of a child line item.

In this example, the parent must have a quantity greater than one and an attribute memory size of 16GB.

© 2021 Vlocity LLC, a Salesforce


company 548
CME CPQ

In this example, you create a configuration rule with one action. Pair the action with a filter to qualify the
triggering product that checks the quantity and the memory attribute value. Create configuration rules
against the Line item objects (Opportunity Line Item, Quote Line Item, or Order Item). This example is for
the Order Item, with a product relationship of type Modify Attributes, and an action parameter JSON
describing the actions to be against the target line item.

Verify that the has rule flag is enabled for each attribute with a rule. Failure to set that flag results in the
runtime user interface bypassing the required APIs, so the rule will not apply.

Product relationship of type Modify Attributes considerations:

• The rule supports two attribute modification contexts: Bundle and Cart. Selecting Bundle causes the rule
to apply the actions to the related product within the same bundle of the triggering line item. Selecting
Cart applies the actions to the related product within the cart.
• The action parameters JSON can be created using the product configuration procedure editor. Once
created the JSON can be moved to the product relationship. Make sure to delete the mock product
configuration procedure once the JSON is copied.
• The rule supports a self action by leaving the related product field empty, the actions are applied to the
triggering product.

To create the rule:

1. Verify the Prerequisites are Configured.


2. Create the Product Relationship.
3. Create the Entity Filter.
4. Create the Rule in the Vlocity Rule Builder.

© 2021 Vlocity LLC, a Salesforce


company 549
CME CPQ

Verify the Prerequisites are Configured


Before configuring the rule:

• Create all the entity filters used within the rule actions.
• Create all the action procedures used within the rule actions.

Create the Product Relationship


This product relationship defines the triggering product Test Attribute Config Prod which modifies the
attributes of the related product Test Attribute Config Prod Child1 in the context of the cart applying the
defined action parameters.

For the Actions Parameter field, see Create Action Parameter JSON with Product Configuration Procedure.

Create the Entity Filter


This entity filter is associated with the rule action to qualify the triggering line item that checks if the memory
size is equal to 16GB and the quantity is larger than 1.

© 2021 Vlocity LLC, a Salesforce


company 550
CME CPQ

Create the Rule in the Vlocity Rule Builder


To create the rule:

1. Navigate to the Rules tab.


2. Click New.
3. Associate all the elements with one another.

Create Action Parameter JSON with Product Configuration Procedure


Product relationships use JSON for the action parameters. To generate this JSON, create a product
configuration procedure.

© 2021 Vlocity LLC, a Salesforce


company 551
CME CPQ

After you save the product configuration procedure, you can view the Action Parameters code on its
Details tab. You can copy the code and paste it into a product relationship's Action Parameters field.

Before You Begin


1. Create the required product.
2. Create the required attributes and, if applicable, picklists.

1. In the Product Configuration Procedures tab, click New.


To open the Product Configuration Procedures tab, search for it from the App Launcher.
2. Enter a name for the configuration, and select a product.
To search for a product, you must enter at least one character, and then click the magnifying glass
icon. You can then select a product from the results, and click Save.
3. Select an attribute to modify.
4. Click the + button to add a configuration line for the attribute.
5. Click Add Action.
6. Select an applicable action.

Action Description
Constrain Include or exclude certain picklist entries.
Assign Assign a value to any type of attribute.
Disable Disable an attribute of any type.
Require Mark an attribute of any type as required.
Hide Hide attribute in the UI. The attribute definition is still in the JSON, but it's hidden from the user.
7. Select the action type, which varies depending on the action.
• Disable, Require, and Hide have Yes and No options.
• Constrain has Exclude and Include options.
• Assign has no action types.
8. Select an attribute value.
• For Constrain, select the attribute to include or exclude.
• For Assign, enter the value to set for the attribute.
• Disable, Require, and Hide require no attribute value.
9. Click Save after you specify all the attribute actions and values for a product.
10. In the Details tab for the saved configuration, copy the JSON for the Action Parameters field, and
paste it to your Product Relationship.

© 2021 Vlocity LLC, a Salesforce


company 552
CME CPQ

See Also

• Setting Up a Vlocity Attribute Configuration Rule to Modify Attributes Across Line Items

Context Rules or Advanced Rules: What Type to Use?


Because context rules and the advanced rules frameworks work together, you must determine what type of
rule to use to accomplish your business objective.

Always prefer context rules unless key functionality is not supported.

Context rules and advanced rules support slightly different functionality, so it's important to understand
these differences to determine the best type of rule to use. You must fully define your requirements end-to-
end before you can map your requirements to the rules functionality matrix below.

Here are some questions to help you define your requirements and select the best rule framework to meet
those requirements.

What will the rule apply to?


What object will the rule apply to? Will it be used to determine eligibility for a product or promotion? Will it
apply pricing? Will it apply a penalty when canceling a promotion or a contract?

Object Context Rules Advanced Rules


Product Supported Supported
Promotion Supported Not supported
Contract Supported Supported
Price List / Price List Entry Supported Not supported
Pricebook / Pricebook Entry Not supported Supported

© 2021 Vlocity LLC, a Salesforce


company 553
CME CPQ

Object Context Rules Advanced Rules


Adjustment Data Virtual Object Supported Not supported

When will the rule apply?


At what point in the order capture process will this rule apply? Will the rule evaluate items before they are
placed in the cart in an order, quote, or opportunity? Will it be used to evaluate the line items after they are
in the cart?

Stage Context Rules Advanced Rules


Order Supported Supported
Quotes Supported Supported
Opportunity Supported Supported
Order Line Item Not supported Supported

Why do you need this rule?


Why do you need this rule? Do you need to check product compatibility? Do you need to check whether a
customer is eligible for a product? Or whether a product is available in a geographic region? Do you need
to apply a penalty? Do you need to weigh multiple prices and then apply a single price? Do you need to
automatically add a product to the cart based on other conditions in the cart?

Why do you need this rule? Context Rules Advanced Rules


To check product compatibility Not supported Supported
To check product availability Supported Supported
To check customer eligibility Supported Supported
To automatically add products based on other products in the cart Not supported Supported
To automatically add products based on an applied promotion Supported Not supported
To apply a penalty for a promotion or contract cancellation Supported Not supported
To select a single price when a customer is eligible for multiple prices (tightest match) Supported Not supported
To restrict manual pricing adjustments Supported Not supported

How will you manage this rule?


How will you administer or manage the rule? Will this rule apply to a single product or to thousands? Do
you need maximum performance?

How will you manage this rule? Context Rules Advanced Rules
I need to apply this rule to a large number of products. Not supported Supported
I need maximum performance using caching. Supported Not supported

After You Edit and Before You Test Rules


After you edit a context or advanced rule, and before you test it in Vlocity Cart, you must refresh the
Platform Cache to activate the rule.

See Refresh Platform Cache.

© 2021 Vlocity LLC, a Salesforce


company 554
CME CPQ

Promotions

Promotions offer a variety of capabilities. You can configure the cart so that agents or customers can add a
promotion list to the cart. You can create more than one promotion to apply to a product or product bundle.
You can apply promotions to new or existing line items in the cart. You can use follow-on promotions, apply
penalty fees, and define service continuation after a promotion expires.

Promotions allow you to:

• Discount the price of a product in a promotion without updating the product hierarchy or price book.
• Apply promotional discounts to products that are already assets.
• Automatically charge a penalty if the customer does not fulfill the promotion’s time commitment.
• Create promotions which begin automatically as soon as a previous promotion ends.
• Automatically continue or discontinue the subscription of a promotion’s products based on the customer’s
request.

Discounts allow you to create products and offers that have discount prices. Promotions offer additional
functionality.

Products within Promotions


A promotion applies to at least one product. You can add to a promotion both individual products and
product bundles. Then you can change the pricing and cardinality of any product in the promotion.

As part of the promotion’s settings, you determine:

• Time commitment: How long the customer must subscribe to the promotion’s products
• Changes to pricing and time frame: Whether the products of the promotion are changed by an
adjustment or override, and for what length of time
• Whether the promotion appears in the Promotions list of the cart

Price Lists, Products, and Promotions


You create Quotes, Order, and Opportunities based on price lists to show eligible products and promotions
that you can add to Vlocity Cart. Price lists contain price adjustments, and promotion discounts are created
using price adjustments. You must define promotions in the same price list as the products you want to see
available in Vlocity Cart. This means if you have the same product in several different price lists for which
you want to create a promotion, you must add that promotion to each price list.

Differences between Promotions and Discounts


In the shared product catalog, you can use, adjust, or override the base prices of products in product
bundles.

A product:

© 2021 Vlocity LLC, a Salesforce


company 555
CME CPQ

• Typically does not expire after a brief limited time, such as three months
• Contains products or quantities of each product that are not necessarily limited
• Is not for a limited group of customers

Promotions consist of individual products or product bundles you create for a limited:

• Time
• Customer group
• Subset of products
• Combination of products

Both promotions and discounts allow applying time-based pricing adjustments in Opportunities, Quotes, or
Orders.

The following table summarizes the differences between promotions and discounts.

Promotions Discounts
Allow setting pricing adjustments at product level only. Allow setting pricing adjustments at both the product and the catalogue or
category level.

Example: 20% off accessories, where accessories is a catalogue record


to which multiple products are assigned.
Are returned, along with products, in a Are not returned in a getOffersbyCatalog response.
getOffersbyCatalog response of Digital Commerce APIs.
Allow a mix-and-match of adjustments. Allow adjustments that apply to all discounted items.
Cannot be applied to all items in the cart. Can be applied to all items in the cart.

Example: 10% off one-time charge for the whole cart.


Must be defined ahead of time through the Product Can be created on the fly in the cart or defined ahead of time either
Console before they can be applied to the cart. through the Product Console or through a related list linked to an
Account.
Can't be automatically applied. Must always be added to Account-based discounts can be set up based on contractual negotiation
the cart. with a customer. These discounts are automatically added to the cart.
Can’t apply to children of a product hierarchy bundle. Can be applied to root items and child items if predefined.
Can add multiple root items to the cart.
Have no approval process. Have an approval process linked to discounts created outside of the cart.
Support penalty rules for promotions canceled before the Don't support penalty rules.
time plan commitment ends.

Promotions Capabilities
Promotions offers a variety of capabilities. You can configure the cart so that agents or customers can add
a promotion list to the cart. You can create more than one promotion to apply to a product or product
bundle. You can apply promotions to new or existing line items in the cart. You can use follow-on
promotions, apply penalty fees, and define service continuation after a promotion expires.

Orderable Promotions
Promotions that appear in the Promotions list of the cart can be added to the cart by the agent or customer.
If you have configured Vlocity cart to do so, a qualified and disqualified promotions list appears.

© 2021 Vlocity LLC, a Salesforce


company 556
CME CPQ

Multiple Promotions for One Product or Product Bundle


You can create more than one promotion to apply to a product or product bundle. For example, you can
offer a discount on the mobile phone included in a product bundle using Promotion A. Promotion B can
discount the wireless modem that is part of the same product bundle. For more information, see Creating
Multiple Promotions for a Single Product Bundle.

Promotions that Apply to Assets


You can create promotions that can apply promotional pricing to line items in the cart that are being
purchased as well as assets that have already been purchased and are in the cart as a result of a change
order.

Promotions Automation
You can automate functionality with promotions to:

• Set a promotion to begin as soon as a previous one ends. This is called a follow-on promotion. Follow-on
promotions are not orderable, meaning they do not appear in the list of promotions of the cart. For more
information, see Using a Follow-on Promotion.
• Apply penalty fees. You can use context rules to automatically apply a penalty fee when a promotion is
canceled before the date committed to by the customer. For more information on the how to use a
context rule to trigger a penalty fee, For more information, see Penalty Rules for Promotions.
• Determine whether the product subscriptions of a promotion continue or discontinue at the end of the
promotion, depending on whether the customer contacts you. For more information on service
continuation after a promotion expires, see the settings for Service Continuation in Basic Promotion
Settings.

Promotion Design Considerations


As part of designing a promotion, there are several criteria to consider.

Answer these questions:

• How do you describe the promotion? The promotion description can appear in the Vlocity Cart promotion
list. It’s important to describe clearly what the promotion includes. See Completing Basic Promotion
Settings.
• Do you want the promotional pricing to apply only to line items in the cart or to assets as well?
• How long is the subscription commitment? You need this information to set the commitment duration time
plan. See Time Plans for Products in Promotions.
• When does the subscription start and end? This information is important for the time policy.
• How will the subscription end? Will the subscription end unless the customer chooses to continue the
product subscription or will the customer need to cancel for the subscription to end? See Completing
Basic Promotion Settings.
• What is the time frame for child product price reductions? Some child products may require time plans
that are separate from and shorter than the commitment duration time plan of the promotion. See Time
Plans for Products in Promotions.

© 2021 Vlocity LLC, a Salesforce


company 557
CME CPQ

Configuration of Products in Promotions


When you create a promotion, you must add and configure at least one product to it.

You can add:

• One or more single products


• A group of products contained in a product bundle
• Multiple product bundles
• Any combination of single products and product bundle

You may find it more convenient to group products together in bundles before adding them to a promotion,
instead of putting products in a promotion to group them.

Minimum, Default, and Maximum Quantity


After you add a product to a promotion, you can edit the product's minimum, default, and maximum
quantities within the promotion. These quantities are referred to as cardinality. For example, you can add a
product bundle that includes two optional products. You can edit these two products to be required in the
promotion. See Adding a Product to a Promotion.

Time Plan Hierarchy


If you do not specify a different time plan for a product in a promotion, the promotion's time plan is inherited
by the product. However, you can choose to limit the duration of a change in the product's price. For
example, you can create a promotion that has a two-year commitment duration. But the price of a product
within the promotion can be discounted for a six-month time plan only, and resume regular pricing for the
remaining 18 months of the promotion's time plan. See Time Plans for Products in Promotions.

Product Hierarchy in a Promotion


You can nest products under another product. For example, you can add Product A to the promotion. Then
you can add Products 1, 2, and 3, and designate Product A as the Parent Offer Product.

Context Rules and Promotions


You can apply context rules to a promotion so that specific promotions qualify for purchase depending on
whether the account meets certain conditions, such as an account's status or service level agreement. See
Qualification Rules for Products and Promotions.

Time Plans for Products in Promotions


When a product's charge recurs on a regular basis, such as every month, you can decide how long a
promotional discount on the charge will continue. It can continue the entire duration of the promotion, or it
can end before the promotion commitment duration ends. For more information about product time plans,
see Products in Promotions.

Create a Promotion
To create a promotion, you define basic settings and add products to the promotion. You can change the
pricing of products, and add context rules to the promotion.

© 2021 Vlocity LLC, a Salesforce


company 558
CME CPQ

1. Complete basic settings about the promotion, including its name, unique code, and the price list the
promotion uses. See Basic Promotion Settings.
2. Add one or more products to the promotion and make the appropriate edits. See Adding a Product to a
Promotion.
3. Change the pricing of any product of the promotion. See Changing the Price of a Product in a
Promotion .
4. Add any context rules to apply to the promotion. See Qualification Rules for Promotions.

Define Basic Promotion Settings


When you create a promotion you must define some basic settings in the Product Console.

This task is a step in the Creating a Promotion process.

To complete the basic promotion settings, start by creating a new promotion.

1. Navigate to the Product Console. For more information, see Navigating to the Vlocity Product Console.
2. Next to Promotion, click Create .
3. In the New Promotion page, complete the General Properties section.
a. In Name, enter a name for the promotion.
b. In Code, enter a unique code to identify the promotion from all other promotions.
c. In Description, include specific information about the promotion. This description can show in the
Promotions list of the cart when you configure the cart to do so.
d. In Price List, search for and select the price list where the promotion is stored.
4. Complete the Duration section.
a. In Commitment Duration Time Plan, choose the time plan for the entire promotion.
b. In Commitment Duration Time Policy, choose the time policy that applies to the entire
promotion.
5. Complete the Additional Properties section.
a. For Orderable, select this option if you want the promotion to appear in the Promotions list of the
cart.
b. In Service Continuation, choose an option for automatically continuing service after the
promotion ends, if applicable.
c. In Follow-on Promotion, choose a promotion that you want to begin as soon as the promotion
you are creating ends.
6. Complete the Effectivity section.
a. Select Active to make the promotion available for use.
b. Click in the Effective From field and select a date the promotion becomes effective.
7. Click Save.

The following tables explain the fields to complete for a price list entry.

© 2021 Vlocity LLC, a Salesforce


company 559
CME CPQ

Table 63. General Properties Section


Field Description
Name The name of the promotion.
Code The unique code that differentiates this promotion from others. As best practice, use all caps and no spaces.
Description The description that can appear along with the promotion name in the Promotions list of the cart. As best
practice, include the details of the price changes and durations for each product.

For example, "20% off data plan for 6 months and $150 off the iPhone X".
Redeemable Code A code available for customers to use to be eligible for the promotion.
Price List The price list where the promotion will be stored. The products you add to the promotion must be from the same
price list as the promotion.

Table 64. Duration Section


Field Description
Commitment Duration Time Plan The time plan that defines the commitment duration for the promotion and its product prices.
Commitment Duration Time The time policy which indicates when the pricing for the promotion starts and ends, where
Policy appropriate.

Table 65. Additional Properties Section


Field Description
Orderable Select this option if you want the promotion to appear in the Promotions list of the cart.
Auto-Add Do not use. This is for future use.
Products
Service Select an option to determine how the subscription to the promotion's products continue after the promotion
Continuation commitment duration ends.

Options are:

• Not Applicable: No automatic functionality applies when the promotion commitment duration ends.
• Manual Opt-In: Select this option to require the customer to contact you and request the subscription to the
promotion's products continue. If the customer does not contact you, the subscription to the promotion's
products ends automatically.
• Manual Opt-Out: Select this option to require the customer to contact you and request the subscription to the
promotions products to end. If the customer does not contact you, the subscription to the promotion's
products automatically continues.
Follow-on Select a promotion to begin after this promotion's commitment duration ends.
Promotion

Table 66. Effectivity Section


Field Description
Active If this option is selected, the promotion is available for use.
Effective From The date and time the promotion becomes available for use. When you choose the date, the system automatically
populates the time with the current time. If the promotion does not have a beginning effective date that is current, it
is not available for use. See Effectivity Date Ranges for Price List Entries.
Effective Until The date and time the promotion is no longer available for use. When you choose the date, the system adds the
current time.

© 2021 Vlocity LLC, a Salesforce


company 560
CME CPQ

Add a Product to a Promotion


When you add one or more products to a promotion, you determine what actions occur when the promotion
is added to the cart, and then edit the minimum, default, and maximum quantity of the product(s) where
applicable.

This task is a step in the Creating a Promotion process.

To add to and edit a product in a promotion:

1. Navigate to the Product Console. For more information, see Navigating to the Vlocity Product Console.
2. Next to Promotion, click Search.
3. Search for and select the promotion.
4. From the search results, click Promotion Products.
5. In the configuration panel, complete the General Properties section.
a. In Action Type, choose how the promotion acts.
b. In Product, search for and select the product to add to the promotion.
c. In Update Scope,
6. Complete the Cardinality section.
a. In Minimum Quantity,
b. In Quantity,
c. In Maximum Quantity,
7. Complete the Effectivity section.
a. Select Active to make the promotion available for use.
b. Click in the Effective From field and select a date the promotion becomes effective.
8. Click Save.

The following tables explain the fields to complete for a price list entry.

Table 67. General Properties Section


Field Description
Action Type The type of action the promotion takes on the product. Options are:

• Add: Select this option to add the promotional changes to products in the cart. If the products are already in
the cart, this option adds the promotional changes to them.
• Update: Select this option to add the promotional changes to assets placed in the cart as a result of a change
order.
• Add/Update: Select this option to perform either the add or update option as previously explained.
Product Search for and find the product or product bundle to become part of the promotion.
Description Description
Is Undoable Do not select. For future use.
Undoable Do not select. For future use.
Message

© 2021 Vlocity LLC, a Salesforce


company 561
CME CPQ

Field Description
Cardinality Options are:
Check Scope
• Context Product Scope: Leads to the cardinality checks to be conducted within the scope of the context
product.
• Cart Scope: Leads the cardinality checks to be conducted within the full cart scope (default).
Update Scope Update Scope determines whether the top level item or the top level item and all of its child items are updated
with the promotional changes.

Options are:

• Update Item Only: Select this option to update only the top level item of a product bundle.
• Update Item and Child Items: Select this option to update the top level item of a product bundle and its child
products.

Table 68. Selection Criteria Section


Field Description
Parent Offer Product If defined, will cause the action to be attempted inside this root product offer.
Selection Context Product If defined, will cause the action to be attempted inside this selection product.
Selection Context Rule If defined, this rule will qualify the selection product.

Table 69. Cardinality Section


Field Description
Minimum Quantity The minimum amount of this product that must be purchased.
Quantity The default amount of this product to be purchased.
Maximum Quantity The maximum amount of this product to be purchased. If the product is part of a product bundle that you have
added to the promotion, this amount cannot exceed the maximum quantity designated for this product in the
product bundle.

Table 70. Effectivity Section


Field Description
Active If this option is selected, the promotion is available for use.
Effective From The date and time the promotion becomes available for use. When you choose the date, the system automatically
populates the time with the current time. If the promotion does not have a beginning effective date that is current, it
is not available for use. See Effectivity Date Ranges for Price List Entries.
Effective Until The date and time the promotion is no longer available for use. When you choose the date, the system adds the
current time.

Product Price Changes in a Promotion


When you create a promotion, you can change the price of a child product by:

• Adjusting the price with an absolute price or a percentage. For more information, see Adjusting a
Product's Price in a Promotion.
• Overriding the price completely. For more information, see Overriding the Base Price for a Product in a
Bundle.

© 2021 Vlocity LLC, a Salesforce


company 562
CME CPQ

An adjustment to a product in a promotion can be an amount added or subtracted from the base price.
When you create product adjustments and overrides for products in promotions, you do so in the Product
Adjustments facet of the promotion.

Adjust a Product's Price in a Promotion


When you create an adjustment for the price of a promotion's product, you are creating a price list entry
that adjusts the product's base price in the context of the promotion.

To create an adjustment to the base price of a product contained in a promotion:

1. Navigate to the Product Console. For more information, see Navigating to the Vlocity Product Console.
2. Search for and select the promotion.
3. Click Product Adjustments.
4. Click in the row of the product to show the configuration panel to configure the product.
5. In the Price List Entry window, complete the General Properties section.
a. In Price List, find and choose the price list where the adjustment should be stored.
b. In Display Text, enter an explanation for the adjustment, including any duration limits if applicable.
6. Click Product Structure.
7. In the configuration panel, click the Product Pricing tab, then click the Adjustments sub-tab.
8. Click New.
9. In the Price List Entry dialog box, complete the General Properties section:
a. Find and select the price list where this price list entry should be stored. Keep in mind the
adjustment must be stored in the same price list as the base price.
b. In Display Text, enter a description of the adjustment you are making, including any duration
limits. For example, 20% off monthly for six months.
10. In the Pricing Variable section, complete the search criteria and click Search. A results list of available
pricing variables appears.
11. In the pricing variable results list, click the appropriate pricing variable. A results list of available pricing
elements appears. You can choose to adjust the price by a percentage or an amount. If you do not see
the pricing element you need in the list, you must create it. For more information, see Creating a
Pricing Element Adjustment.
12. A results list in the Pricing Element section appears listing pricing elements that are associated with
the pricing variable you chose. Click the appropriate pricing element.
13. In the Time Plan/Policy section, choose the appropriate time plan and time policy if applicable.
14. Complete the Effectivity section.
a. Click in the Effective From field and select a date the adjustment becomes effective for use.
b. Click in the Effective From field and select a date the adjustment becomes effective for use.
15. Click Save.

The following tables explain the fields to complete for a price list entry.

Table 71. General Properties Section


Field Description

© 2021 Vlocity LLC, a Salesforce


company 563
CME CPQ

Price List The price list where you want the adjustment stored. The adjustment must be stored in the same price list as the base
price you are adjusting. For more information on price lists, see Price Lists.
Display Text This text appears in the Details dialog box when you click on the price of a product in the cart, and then click on the
Price Details button (a lowercase i in a circle).
Base Price Do not select base price.
Virtual Price Do not select. For future use.

Table 72. Selection Criteria Section


Field Description
Charge Type This field filters the search to find pricing variables with this charge type. Choose Adjustment.
Sub-Type This field filters the search to find pricing variables with this sub-type. Options are: Standard, Fee. Choose the type
that matches the frequency of the charge you are adjusting.
Type This field filters the search to find pricing variables with this type. Options are Price, Cost. Choose the type that
matches the frequency of the charge you are adjusting.

Table 73. Effectivity Section: Time Plan/Policy


Field Description
Time Plan Choose the time plan for if the adjustment is for a recurring charge and if you want the time plan for the adjustment to
be different from the promotion's commitment duration. For more information, see Create a Time Plan for a Product's
Price.
Time Policy Choose the time policy if the adjustment is for a recurring charge and if you want the start and end time to be different
from the promotion's start and end. For more information, see Create a Time Policy for a Product's Price .

Table 74. Effectivity Section


Field Description
Active If this option is selected, the promotion is available for use.
Effective The date and time the adjustment becomes available for use. When you choose the date, the system automatically
From populates the time with the current time. If the price does not have a beginning effective date that is current, you will
not be able to use the adjustment and no adjustment will appear in the cart.
Effective Until The date and time the adjustment for the product is no longer available for use. When you choose the date, the
system adds the current time.
Active The status of the adjustment price list entry. If Active is selected, the adjustment to the base price will show in the
cart. Otherwise, no adjustment will appear.

Override the Base Price of a Product in a Bundle


When you create an override to a base price of a product in a bundle, the base price is replaced with the
override price. No calculation with the base price is necessary. The override you create is also price list
entry. Overrides use the same pricing element charges that base prices use.

You can assign a time plan to limit the override duration and a time policy to determine when the override
begins and ends. A product must be contained in a product bundle before you can override its base price.

To create an override to a product's base price:

1. Go to the Product Console.

© 2021 Vlocity LLC, a Salesforce


company 564
CME CPQ

2. Search for and open the product bundle.


3. Click Product Structure.
4. Expand the parent product to view the child products.
5. Click the child product row.
6. In the configuration panel, click the Product Pricing tab, then click the Adjustments tab.
7. Click New.
8. In the Price List Entry dialog box, complete the General Properties section:
• Find and select the price list to store this price list entry. The override must be in the same price list
as the base price.
• In the Display Text field, enter a description of the override you are creating, including any duration
limits. For example, $5.99 monthly for six months.
9. In the Pricing Variable section, complete the search criteria and click Search. A results list of
available pricing variables appears.
10. In the pricing variable results list, click the appropriate pricing variable. A results list of available pricing
elements appears.
11. In the results list in the Pricing Element section, click the appropriate pricing element. If you do not
see the price, you must create a new pricing element charge. For more information, see Creating a
Pricing Element Charge.
12. In the Time Plan/Policy section, select the appropriate time plan and time policy, if applicable.
13. Complete the Effectivity section.
• Click the Effective From field and select a date the adjustment becomes effective for use.
• Select Active to make the price adjustment available for use.
14. Click Save.

The following tables explain the fields to complete for an adjustment price list entry.

Table 75. General Properties Section


Field Description
Price List The price list in which to store the price list entry. The override must be stored in the same price list as the base price.
For more information, see Price Lists.
Display Text This text appears when the product has been placed in the cart and you click the Price Details button.

As a best practice, clearly describe the adjustment and any duration limit on it.
Base Price Do not select Base Price.
Virtual Price Do not select. Reserved for future use.

Table 76. Time Plan/Policy Section


Field Description
Time Plan Choose the time plan, where appropriate.
Time Policy Choose the time policy, where appropriate.

© 2021 Vlocity LLC, a Salesforce


company 565
CME CPQ

Table 77. Effectivity Section


Field Description
Effective The date and time the override becomes available for use. When you choose the date, the system automatically
From populates the time with the current time. If the price does not have a current beginning effective date, you will not be
able to use the adjustment and no adjustment appears in the cart. For more information, see Effectivity Date Ranges
for Price List Entries.
Effective The date and time the override for the product is no longer available for use. When you choose the date, the system
Until adds the current time.
Active The override price list entry status. If Active is selected, the override of the base price appears in the cart.
Otherwise, no override appears.

Activate a Follow-on Promotion


A follow-on promotion is a promotion that will become active after a previous promotion's commitment
duration ends. To indicate within the promotion which promotion will begin after the initial promotion ends, in
the Follow-on Promotion field, search for and find the promotion that will follow.

For more information, see Completing Basic Promotion Settings.

Run the Batch Job PromotionExpirationBatch


To ensure the follow-on promotion is activated after the previous promotion has expired, you must run the
PromotionExpirationBatch batch job. You can schedule this job to execute according to your company's
workflow. For example, if you have many follow-on promotions, you might want to schedule this job on a
daily basis.

1. From the User menu, choose Developer Console.


2. From the Debug menu, choose Open Execute Anonymous Window.
3. Paste the following statement into the Enter Apex Code dialog box.

vlocity_cmt.PromotionExpirationBatch peb = new


vlocity_cmt.PromotionExpirationBatch();
ID batchprocessid = Database.executeBatch(peb, 1);

Or, if you want to use a specific date, use the following statement and substitute the example date
(2017/05/19) with another date.

vlocity_cmt.PromotionExpirationBatch peb = new


vlocity_cmt.PromotionExpirationBatch(‘2017/05/19’);
ID batchprocessid = Database.executeBatch(peb, 1);
4. Select the statement.
5. Click Execute Highlighted.
6. Close Developer Console.

Promotions that Apply to Products in the Cart


When you create a promotion that applies to products in the cart, the promotion must be directly related to
the product currently in the cart. If a bundle or single product currently in the cart has been used in a

© 2021 Vlocity LLC, a Salesforce


company 566
CME CPQ

promotion, when you add the promotion to the cart, its promotional pricing applies to the bundle or the
single product in the cart.

For example, you can create an iPhone X promotion that discounts the iPhone X by taking $200 off the
original price. If the iPhone X has been added to the cart, when you add the iPhone X promotion, Vlocity
CME applies the discount and the name of the promotion appears in the Promotions column next to the
product line item.

Or you can create a promotion by adding a product bundle to the promotion, and discounting the products
in the bundle. If the same product bundle you used for the promotion is in the cart, when you add the
promotion, it applies the promotional discounts to the product bundle. The name of the promotion appears
in the Promotions column next to the product line items.

Figure 89. Bundle Currently in the Cart

Figure 90. Promotional Pricing Applied to Bundle

Multiple Promotions for a Single Product Bundle


You can create more than one promotion to apply to products in a product bundle. For example, one
promotion discounts products 1 and 2 of the product bundle. A different promotion discounts product 3. For
promotional pricing to apply to products of product bundles that you have already placed in the cart, the
Update Scope setting must be set to Update Item and Child Items.

© 2021 Vlocity LLC, a Salesforce


company 567
CME CPQ

Figure 91. iPhone X Intro Promo Discounts Two Products in iPhone X Intro Bundle

Figure 92. Unlimited Talk + Text Promotion Discounts One Product in iPhone X
Intro Bundle

Promotions List in the Cart


The Promotions list is displayed in the cart on the left-hand side along with the Products list. Click the
Promotions tab to reveal the list of promotions, and enter a term in the search box to find a specific
promotion.

For more information, see Adding a Promotion to the Cart.

With Promotions, you can:

© 2021 Vlocity LLC, a Salesforce


company 568
CME CPQ

• View a list of qualified and unqualified promotions. For more information, see Qualified and Disqualified
Promotions.
• Add a promotion to the cart. For more information, see Adding a Promotion to the Cart.
• Delete a promotion from the cart and the products it applies to, or delete a promotion from the cart
without removing the products it applies to. For more information, see Deleting a Promotion from the
Cart.
• Add a promotion to products already placed in the cart. For more information, see Creating a Promotion
That Applies to Products in the Cart.
• Add more than one promotion to a product. For more information, see Creating Multiple Promotions for a
Single Product Bundle.
• Create a change order, then add a promotion to the cart which applies to an asset in the cart.
• Create a change order and cancel a product in a promotion. For more information, see Canceling a
Promotion.

Qualified and Disqualified Promotions


There are two lists of promotions in the cart:

• Qualified
• Disqualified

Qualified promotions are promotions that are currently eligible for purchase. Disqualified promotions are
promotions that are not eligible for the customer to purchase. However, if a specific factor related to the
customer’s account changes, the promotion can become eligible for them to purchase.

For example, a promotion can have a context rule to limit promotional discounts to accounts with a status of
“student”. The agent can check the disqualified promotions list to determine whether the customer might be
eligible for a promotion if certain conditions for the account change. If the customer indicates to the agent
they are a student and the agent changes the account status, the previously disqualified promotion is now
eligible for purchase by the customer.

For more information, see Qualification Rules for Promotions.

Add a Promotion to the Cart


To add a promotion to the cart, go to the Promotions tab in the cart and click Add to Cart.

For any price changed due to the promotion, the cart displays the beginning price with a line through it and
the changed price appears in below it.

© 2021 Vlocity LLC, a Salesforce


company 569
CME CPQ

If the products contained in the promotion are not already in the cart, all the products in the promotion are
added to the cart.

If the products contained in the promotion are already in the cart, the prices of products in the cart are
updated with the promotional pricing. If the promotion contains a product bundle, the promotional changes
to products appear in either of the following ways:

• Only the price of the product bundle shows a promotional price. This occurs when the promotional setting
of Update Scope is Update Item Only.
• The price of the product bundle and its children show the promotional prices. This occurs when the
promotional setting of Update Scope is Update Item and Child Items.

For more information on the Update Scope field, see Completing Basic Promotion Settings.

Delete a Promotion from the Cart


You can delete a promotion and its products, or you can delete only the promotion.

A deep delete removes the promotion and its changes along with the products pertaining to the promotion.
This is the default setting for DeleteServices.

When you delete the promotion, it only deletes the promotion and its changes (discounts and cardinality).
The products that the promotion applies to remain in the cart. To change the delete to a shallow delete, edit
the DeleteServices setting.

When you have applied more than one promotion to a bundle in the cart, you must have shallow delete
enabled. Then you can delete each promotion individually. If deep delete is enabled, you cannot delete
multiple promotions applied to one bundle of products.

To delete a promotion from the cart:

1. To see the promotions you have added to the cart, click the PROMOTIONS tab.
2. Click Delete next to the promotion that you want to delete.
3. When prompted, click Delete again.

© 2021 Vlocity LLC, a Salesforce


company 570
CME CPQ

Cancel a Promotion
You can cancel a promotion after you have applied the promotion to products that are now assets or after
you have applied a promotion to products that are assets.

To cancel a promotion:

1. Create a change order or asset-based order.


2. Click the Promotions tab in the cart.
3. Click the Cancel button next to the promotion you want to cancel.
4. In the Cancel Promotion dialog box, choose a date in Cancel Date.
5. Enter the reason for the cancellation in Reason for Cancellation.
6. Click Evaluate.

Figure 93. Cancel Promotion Dialog Box

You can assign a context rule to assign a penalty if a promotion is canceled. For more information, see
Penalty Rules for Promotions.

© 2021 Vlocity LLC, a Salesforce


company 571
CME CPQ

Discounts

A discount is defined as a reduction in price on a product, a catalog (collection of products), or the contents
of Vlocity Cart. The discount is negotiated, approved, activated, and applied towards the current or future
purchase of products or services. You can create and apply discounts to an account or define and apply
discounts as part of a contract. You can also apply discounts in Vlocity Cart.

See also Differences between Promotions and Discounts.

Discount Definition Stages


Vlocity discounts go through the following stages during the definition process:

1. Creation: Create a discount. There are two ways to create a discount. The product administrator
creates a pre-defined discount using the Vlocity Product Console. Alternatively, product executives can
create custom discounts from Vlocity Cart or CPQ. After you create discounts, they are independent of
the price list that the Vlocity Cart is associated with.

TIP
The pricing interface implementation should refer to the PricingPlanService (instead of
the DefaultPricingPlanImplemenatation) for discounts to be applied. By default, the
pricing step "Apply Context Discounts" is included in the pricing plan.

2. Negotiation: You can negotiate and agree on a discount. For example, an account executive is
responsible for negotiating the discount and ensuring that the appropriate agreement with discounts
are in place.
In the following example scenario, an account executive negotiates a 10% contract-based discount for
all employees of ABC when they purchase iPhone accessories.
3. Approvals: You can automate the approval of discounts or define custom logic using Vlocity's interface
implementations to determine, for example, whether the approval for a specific discount type is
required.
4. Activation: When you activate a discount, it goes into effect when the discount is submitted. The
discount is effective in the following cases:
a. No end date: If you do not specify an end date for a discount, the duration of the discount is
effective from the time the discount was activated.
b. Valid end date: If you specify an end date, the discount is active as long as the end date is valid.
The duration is ignored. In this case, the end date takes precedence over the duration.
c. No end date or duration: If you do not specify an end date or a duration, the discount never
expires.

Discount Management in the Vlocity Cart


The CSR or sales representative can manage discounts in Vlocity Cart by:

© 2021 Vlocity LLC, a Salesforce


company 572
CME CPQ

• Creating custom discounts. See Define Custom Discounts in Vlocity Cart.


• Editing discounts placed in the cart. See Edit Discounts in Vlocity Cart.
• Building an optional approval process for discounts. See Approve Discounts.
• Discontinuing an active discount. See Activating and Deactivating Discounts.

Types of Discounts
Discounts can be applied to orders, accounts, or contracts. Each discount type can be associated with
products or specific categories or catalogs (a group of products). Discounts have a duration with an
effective end date and can be applied to future contracts or accounts. You can apply discounts to all items
in your cart or individual items in your cart. You can also adjust the discount manually.

NOTE
You can have zero or more products and zero or more categories.

Vlocity provides three types of discounts:

• Order-Based Discounts: Most commonly used by Customer Service Representatives (CSRs) to apply as
a one-time courtesy towards an order to incentivize customers.
• Account-Based Discounts: Most commonly defined by Product Administrators and applied, for example,
towards a loyalty and retention program.
• Contract-Based Discounts: Most commonly defined by Product Administrators as part of a contract or
frame agreement.

Order-Based Discounts
An order-based discount is defined as a one-time discount that is applied at the time of the purchase. With
order-based discounts, you can identify, create, and apply a discount for that order against a specific
product or a collection of products (catalogs or categories). You can specify a reduction in price using a
percentage (for example 10% off on your phone plan) or an absolute value (for example $10 off all iPhone
accessories).

TIP
Order-based discounts are useful during a conversation between a sales representative
and a CSR during an active sales order to incentivize a behavior during the purchase
process. You can apply an order-based discount to a single item in the cart or all items in
the cart.

© 2021 Vlocity LLC, a Salesforce


company 573
CME CPQ

Order-based discounts differ from account-based and contract-based discounts as follows:

• Order-based discounts can only be applied once to the product or catalog for that instance of the order.
• Order-based discounts can be applied to opportunities and quotes.

For more information, see Defining a New Discount.

Account-Based Discounts
An account-based discount allows you to apply a reduction in prices to products and services in the future.
This discount type applies to all orders or individual orders in your account. You can save account-based
discounts for future use. This means that the account-based discounts can be applied towards any future
purchases made as part of the account till the validity of the discount ends.

TIP
Account-based discounts are most relevant during a conversation between a CSR and a
customer, especially to retain the business of a loyal customer (part of the loyalty and
retention program).

For example, ABC Headquarters negotiates a 15% discount for all internet services. The negotiated
discount is stored in ABC's account. This means that any future orders for account ABC will receive a 15%
discount on internet services.

For more information, see Define a New Discount.

Contract-Based Discounts
A contract-based discount applies the negotiated discount specified in the contract to the product or catalog
being purchased. Contract-based discounts are tied to frame agreements. When a contract is created as a
frame agreement with applicable discounts, you can update the discounts based on the agreement in the
Vlocity Cart. The agreement is updated with a new version with the revised discounts applied to it.

TIP
Contract-based discounts are useful during the contract negotiation phase and may
become a part of a frame agreement.

For example, an account executive negotiates and establishes a 5% discount on all accessories for
employees of company ABC who have purchased iPhone products. The 5% discount is stored under

© 2021 Vlocity LLC, a Salesforce


company 574
CME CPQ

company ABC. When any new employee joins company ABC, the 5% discount is applied automatically
when they add any iPhone accessories to the cart.

For more information, see Define a New Discount.

Define a New Discount


To use Discounts, you must run the Create Default Time Policy job at least once. This is required to define
recurring adjustments for contextual discounts. There are validations that check for the existence of the
Time Policy created by the job and errors occur if something is required.

The Create Default Time Policy job creates a default time policy, but you can clear the time policy. Time
Plan is not defaulted. If both Time Plan and Time Policy are undefined, then runtime time plan and policy
are ignored and start and end dates are not calculated.

See Create Default Time Policy job and Setting Up Attribute-Based Pricing with Time Plan and Time Policy.

To define a new discount:

1. Log in to Salesforce and click the App Launcher.


2. Search for Vlocity Product Console in the quick find box and launch it.
The Vlocity Product Console dashboard is displayed.
3. Click the + icon next to Discount to define a new discount.

© 2021 Vlocity LLC, a Salesforce


company 575
CME CPQ

© 2021 Vlocity LLC, a Salesforce


company 576
CME CPQ

4. Enter the following required information. All fields marked with an asterisk are required.

Table 78. New Discount, Required Fields and Descriptions


Required Fields Description
Name Enter the name of the discount.
Code Enter a unique code for the discount.
Discount Type Select the order, account, or contract to which the discount applies.

• Select Order to create an order-based discount.


• Select Account to create an account-based discount.
• Select Contract to create a contract-based discount.
Price List Search for and select the price list to which you want to apply this discount.
5. Enter the following optional information.

Table 79. New Discount, Optional Fields and Descriptions


Optional Fields Description
Description Enter a brief description of the discount.
Discount Duration Enter the number of months during which this discount applies. When the discount expires, it becomes
unavailable for future sales and orders. If you do not specify a duration, the discount will expire when
the end date becomes effective. If you do not specify an end date or a duration, the discount will never
expire.
Applies to All Items Indicate whether this discount applies to all the items in the cart. If you select this option, specific
in Cart discount items will be ignored as the discount applies to all items in the cart.
Effectivity
Active Select Active to activate the discount.
Effective From Enter the effectivity of the discount record which determines if the discount is available for use. This is
defined and determined by the product administrator.
Effective Until Enter the effective until date for the discount to determine whether the discount should be displayed in
the selectables list in the left pane of Vlocity Cart.
6. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 577
CME CPQ

Define New Discount Items

NOTE
Skip this step if you select the option "Applies to All Item in Cart" when you create a new
discount. The New Discount Item button located in the Discount Items facet is disabled if
you select the option "Applies to All Item in Cart" in the General Properties facet.

To define a new discount item:

1. Search for and open the discount you created.


2. Click the Discount Items facet and click New Discount Item.

3. In the General Properties area, enter the following information.

Table 80. Discount Items, General Properties Fields and Descriptions


General Descriptions
Properties Fields
Types Search for the Product or Catalog/Category and select the one to which you want to apply the discount.

© 2021 Vlocity LLC, a Salesforce


company 578
CME CPQ

General Descriptions
Properties Fields
Product or Catalog/ Select the item to which you want to apply the discount. Options are product or catalog/category. Catalog/
Category Category is a grouping of products. You must configure a product in the Product Console and add it to the
price list before you can apply a discount.

Depending on the type you select, search for and select the Product or Catalog/Category to which this
discount applies.
Active Select Active.
Effective From Enter the start date for the discount item.
Effective Until Enter the end date for the discount item. The end date takes precedence over the duration. If you do not
specify an end date, the discount uses the time specified in duration. If you do not specify an end date or
duration, the discount never expires.
4. Click Save.
5. After you create the discount item, you can edit or delete it at any time.

Define a New Discount Pricing Item


To define a new discount pricing item:

1. Search for and open the discount you created.


2. Click the Discount Pricing facet and click New.

© 2021 Vlocity LLC, a Salesforce


company 579
CME CPQ

3. In the Price List Entry form, enter the required information. All fields marked with a red asterisk are
required.

© 2021 Vlocity LLC, a Salesforce


company 580
CME CPQ

Table 81. Price List Entry Fields and Descriptions


Price List Entry Fields Description
Price List Search for and select the price list to which you want to apply the discount.
Display Text Enter a description for the discount.
Charge Type Select Adjustment.
Sub-Type Select Standard.
4. Click Search and select the pricing element (one time adjustment/percentage or recurring adjustment/
percentage).
5. Select the pricing variable.
6. Enter optional Effectivity information.

Table 82. Effectivity Fields


Effectivity Fields Description
Effective From Enter the start date for the discount items.
Effective Until Enter the end date for the discount items.
Active Select Active to activate the discount items.
7. Click Save.

TIP
After you configure Discount Pricing, confirm that the Adjustment Value in the Pricing
Elements facet for the price list entry is not empty. If you do not specify an Adjustment
Value in the price list entry, the discount will not be applied to eligible products in
Vlocity Cart.

Create an Order-Based Discount


Order-based discounts allow you to identify, create, and apply a discount for items in the same Vlocity Cart
where you created the discount. You can apply the discount towards a specific product or a collection of
products (catalogs or categories) or to all items in Vlocity Cart.

Example 17. Create a Discount for a Single Order or Multiple Order Items
As a product administrator, you determine the need to create a Holiday Season discount for all iPhone
accessories. You apply a 10% discount towards iPhone accessories for 3 months starting from November
through January. The Holiday Season discount is an order-based discount that applies to individual
products and catalogs that are added as part of the same Vlocity Cart.

To create an order-based discount:

1. Log in to Salesforce and click the App Launcher.


2. Search for Vlocity Product Console using the quick find search.
The Vlocity Product Console is displayed.

© 2021 Vlocity LLC, a Salesforce


company 581
CME CPQ

3. Follow the steps listed in Defining a New Discount to create an order-based discount.
4. Select Order for Discount Type.
5. Select the option, Applies to All Items in Cart, for bulk purchases. When you select this option, the New
Discount Item button on the Discount Items facet is disabled.
6. Click Save.
7. Apply and view the order-based discount:
a. Log in to Salesforce and create a new order for your B2C price list.
b. In the order header, click CPQ to launch Vlocity Cart.
c. Select the B2C price list.
When you select the price list, the Products list will display all available, eligible, and qualified
products.
d. Select the product to which you want to apply the discount and click Add to Cart.
e. Click the Discounts tab.
The discount you created appears in the selectables list.
f. Select the discount you want to apply to the product and click Add to Cart.
g. Click Submit Order.
After you submit the order, you can view the discount for the order.

Create an Account-Based Discount


Account-based discounts apply to all employees of a company who use a specific plan or service.

Example 18. Discount for a Loyalty and Retention (LNR) Campaign


As a product administrator, you have been notified that some of the long-time account holders of ABC are
unhappy with the current service plan they use. The irate customers are threatening to switch to a
competitor. To ensure that you do not lose these long-time customer accounts, you define a new loyalty and
retention program (LNR) using account-based discounts. The account-based discounts provide 20% off on
all iPhone accessories to account holders for 12 months.

After you create the account-based discount and submit the order, the request is not approved
automatically. The new discount must be approved by your supervisor. See Approve Discounts.

To create an account-based discount:

1. Log in to Salesforce and click the App Launcher.


2. Search for Vlocity Product Console using the quick search box.
The Vlocity Product Console is displayed.
3. Follow the steps listed in Defining a New Discount to create an account-based discount.
4. Select Account for Discount Type.
5. Click Save.
6. Apply and view the account-based discount:
a. Log in to Salesforce and create a new order for your B2C price list.
b. In the order header, click CPQ to launch Vlocity Cart.
c. Select the B2C price list.

© 2021 Vlocity LLC, a Salesforce


company 582
CME CPQ

A list of qualified discounts for that account is available in the Discounts tab.
d. Select the LNR discount you want to apply for your customer account.
e. Click Submit.

Create a Contract-Based Discount


A contract-based discount applies the discount against a contract. You can use frame agreements to set up
product level, category level, and account level discounts and use them to drive pricing of future sales. By
using frame agreements, you can avoid the need for individual contracts for each new deal because terms
are pre-negotiated by the frame agreement. You must create a frame agreement and activate the contract
for the contract-based discount to be activated.

For more information, see Creating Frame Agreements.

To create a contract-based discount:

1. Log in to Salesforce and click the App Launcher.


2. Search for "Vlocity Product Console" using the quick search box.
The Vlocity Product Console is displayed.
3. Follow the steps listed in Defining a New Discount to create a contract-based discount.
4. Select Contract for Discount Type.
5. Click Save.
6. Follow the steps listed in Creating Frame Agreements and activate the contract.
See Creating a Frame Agreement.

Example 19. Amend a frame agreement with an updated discount.


As an account executive, you negotiate and establish a 5% discount on all accessories for employees of
company ABC who have purchased iPhone products. The 5% discount is part of the agreed-upon frame
agreement. When any new employee joins ABC, the 5% discount is applied automatically when they add
any iPhone accessories to the cart. However, you decide that you want to amend the contract-based
discount to 10%. You can amend the existing contract or frame agreement.

• If a contract-based discount has not been activated, you can edit it in the cart where you created or
edited the discount. When a contract-based discount is activated, it means that the contract has been
activated. If the contract has not been activated, you will see the following error message in Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 583
CME CPQ

• You can edit a contract-based discount that has been activated only through a Contract Amendment
process. See Amending a Discount in a Contract.

Amend a Discount in a Contract


To amend a discount in a contract:

1. Log in to Salesforce.
2. Search for and open an existing contract that is activated to update the discount.
3. Click Amend Frame Agreement.
You will see version 1 of the contract agreement.

© 2021 Vlocity LLC, a Salesforce


company 584
CME CPQ

4. Click CPQ to go to Vlocity Cart.


5. Click the pencil icon to edit the discount in Vlocity Cart.
6. Make your changes to the discount and click Save.
7. Click the drop-down arrow next to the Edit button and select Create Frame Amendment.

© 2021 Vlocity LLC, a Salesforce


company 585
CME CPQ

8. In the Contract Details page, edit the contract start date.


9. Click Submit for Approval.
10. Click Activate Frame Agreement to activate the contract with the updated discount.
This deactivates the prior version of the contract and makes the current version the active one.

© 2021 Vlocity LLC, a Salesforce


company 586
CME CPQ

View the Amended Discount in a Contract


After you have amended the discount in the contract, you can view the changes in the contract.

To view the amended discount:

1. Follow steps 1 through 10 in Amending a Discount in a Contract.


2. Click Manage Contract Terms.
3. Click the Discounts tab.
You will see the updated discounts you applied to this contract.

Edit Discounts in Vlocity Cart


You can edit a discount irrespective of how it was added to Vlocity Cart. You can do so by either clicking the
pencil icon after the discount is in the cart and before it is activated or by using the "New Custom Discount"
button. You can edit specific fields such as the discount percentage, the time plan of recurring discounts,
and the duration of discounts.

NOTE
Editing a discount is distinct from creating custom discounts. See Define Custom
Discounts in Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 587
CME CPQ

• You cannot edit an order-based discount after it has been activated.


• You can edit an account-based discount in any new cart. See Create an Account-Based Discount.
• You can edit contract-based discounts using the Amend Frame Agreement option. See Create a
Contract-Based Discount.

To edit a discount:

1. Go to Vlocity Cart by opening the order record detail page and clicking CPQ.
2. Select a price list.
3. Click the Discounts tab on the right pane in Vlocity Cart.
You will see a list of discounts.
4. Click the pencil icon to edit the discount.
5. Make your changes and click Save.

NOTE
You cannot edit a discount that has been activated in the same cart where you
created or modified it. See Activating and Deactivating Discounts.

Define Custom Discounts in Vlocity Cart


You can view discounts that are eligible for your order, account, or contract in the selectable list of Vlocity
Cart. You can create custom discounts in Vlocity Cart if none of the available discounts match your criteria.
In this scenario, you can create a custom discount for a set of products or catalog and assign a custom
discount amount with a custom time frame (if required).

To create a custom discount:

1. Go to Vlocity Cart by opening the order record detail page and clicking CPQ.
2. Click the Discounts tab on the right pane of Vlocity Cart.
3. Click New Custom Discount.
The Create Custom Discount window is displayed.

© 2021 Vlocity LLC, a Salesforce


company 588
CME CPQ

4. Enter the required information. All fields marked with an asterisk are required.

© 2021 Vlocity LLC, a Salesforce


company 589
CME CPQ

Table 83. Custom Discount, Required Fields and Descriptions


Required Fields Description
Definition
Name Enter the name of the discount.
Applicable
Allocation Select the type of discount. It can be order-based, account-based, or contract-based.
5. Enter optional information.

Table 84. Custom Discount, Optional Information


Optional Fields Description
Definition
Description Enter a brief description for the custom discount.
Discount Amount
One Time Charges Enter the one time custom discount amount to apply in either percentage or an absolute value.
Recurring Charges Enter the recurring monthly custom discount amount to apply in either percentage or an absolute
value.
Applicable
Active Period Enter the time period for the custom discount. Vlocity currently supports the Active Period in months
only. You cannot change this to a different time period.
End Date Enter the end date of the custom discount.
Criteria
Matching criteria below Select this option if you want the custom discount to apply to a specific category and product. Search
for and select the category and product to which you want to apply this custom discount.
All items in cart Select this option if you want the custom discount to apply to all items in the cart.
6. Click Save.
The custom discount is added to the Discounts tab. The status of the discount depends on the CPQ
Custom Setting, "Cart Level Discount Approval Required".

Table 85. Status of Discounts in Vlocity Cart


Status Description
Yellow check mark Indicates that the discount is created or modified as a part of Vlocity Cart.
Green check mark Indicates that the discount is account-based or contract-based.

Approve Discounts
If your business requires you to request an approval for a discount, you can do so by using the Discount
Approval button in Vlocity Cart. By default, discounts are set to be auto-approved.

© 2021 Vlocity LLC, a Salesforce


company 590
CME CPQ

TIP
The Discount Approval button invokes an OmniScript which calls the Vlocity Integration
Procedure (VIP), CPQ/Submit Discounts for Approval. The VIP invokes a remote action
which submits all discounts for approval that have a status of Not Submitted. You can
enable the discount status to require approvals or set it to be approved automatically using
the Vlocity CMT Administration Console.

Enable Discount Approvals


To enable discount approvals:

1. Log in to Salesforce and click the App Launcher.


2. Search for the Vlocity CMT Administration tab using the quick find box and launch it.
The Vlocity CMT Administration dashboard is displayed.
3. Under Custom Settings, click CPQ Configuration Setup.
4. Find the Cart Level Discount Approval Required setting.

TIP
If the setting does not exist, you can add it to the Custom Settings list. Click Add and
specify the Setup Value to be either True or False.

5. Click the pencil icon to edit the status to True or False.

Table 86. Status of Cart Level Discount Approvals


Status Description
True Any discount that you add, modify, or deactivate in Vlocity cart requires an approval step for the discount. The
discount can be Approved or Rejected. If the discount is Approved, the status in Vlocity Cart changes to Activated
when you submit the order.
False No approvals are required. The discount is approved automatically when you apply it to an order, account, or contract.
6. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 591
CME CPQ

Submit Discounts for Approval

NOTE
This section applies only if the Custom Setting, Cart Level Discount Approval Required, is
set to True. The default value is set to False which means that all discounts are auto-
approved. You will not see the Discount Approval button in Vlocity Cart if the value for Cart
Level Discount Approval is set to False. To change the settings, see Enabling Discount
Approvals.

Discounts go through any one of the following states:

• Approved: When a discount is approved, the status changes to Approved and is Pending Activation as
indicated by the tool-tip on the yellow checkmark in Vlocity Cart. When you submit the order, the discount
status changes to Approved. In a different cart, the approved discount appears with a green checkmark.
• You cannot edit the discount in the same cart after it has been Activated. You can create a new cart
and edit the discount. See Edit Discounts in Vlocity Cart.
• You can edit contract-based discounts in the Amend Frame Agreement scenario only.
See Create a Contract-Based Discount.
• Rejected: When you reject a discount, the status changes to Rejected and the Discount Approval button
in Vlocity Cart is not activated. You can edit the discount and re-submit it for approval.
• Not Submitted: If the Cart Level Discount Approval Required value is set to True, the discount has a
status of Not Submitted in Vlocity Cart when you add the discount to cart. It is Pending Activation as
indicated by the tool-tip on the yellow checkmark. Click Discount Approval to submit the discount for
approval. After it has been approved, the status changes to Approved, Pending Activation. You cannot
submit your order, opportunity, or quote till the discounts in Vlocity Cart are approved.
• Pending: The discount is pending approval. It can be approved or rejected.

NOTE
In the Winter '19 release, the Discount Approval button does not appear in Vlocity Cart if
the discount is rejected. Proceed in one of two ways:

• Delete the discount by clicking the x icon in Vlocity Cart.


• Alternatively, edit the discount by clicking the pencil icon. When you edit and save the
discount, the status changes to "Not Submitted". You can then submit the discount for
approval.

To submit discounts for approval:

© 2021 Vlocity LLC, a Salesforce


company 592
CME CPQ

1. Go to Vlocity Cart by opening the order record detail page and clicking CPQ.
2. Click the Discounts tab on the right pane in Vlocity Cart.

TIP
The Discount Approval button only appears if the Cart Level Discount Approval
Required value is set to True. If the value is set to False, the Discount Approval button
will not appear.

3. Click Discount Approval.

The approval status changes. The approver receives a request to approve or reject the discount if the
Cart Level Discount Approval Required setting is set to True. If the setting is False, the discount is
automatically approved and you can submit the order.

See Also
• ApprovalStatusInterface
• DefaultApprovalStatusImplementation

Activating and Deactivating Discounts


You can activate discounts in Vlocity Cart. You can deactivate an account-based discount in Vlocity Cart or
a contract-based discount by clicking Amend for the contract record in the Aloha interface.

© 2021 Vlocity LLC, a Salesforce


company 593
CME CPQ

Activating a Discount
After you activate a discount and go back to Vlocity cart, the original discount appears with a yellow
checkmark and a tooltip that says Activated. You cannot edit the discount after you activate it.

To activate a discount:

• For order and account-based discounts, go to Vlocity Cart and do a checkout by clicking Submit.
• For contract-based discounts, click Create Frame Agreement. This creates a new frame contract. See
Create a Contract-Based Discount.

Deactivating an Account-Based Discount


To deactivate an account-based discount:

1. Go to Vlocity Cart by clicking on any order record detail page and clicking CPQ.
2. Go to the Discounts tab and select the account-based discount you want to deactivate.
3. Click the x button to deactivate the account-based discount and click Submit.
The status changes to Pending Deactivation. The discounted price is no longer available for that
product.

Deactivating a Contract-Based Discount


To deactivate a contract-based discount:

1. Log in to Salesforce.
2. Go to the Contract Details page.
3. Click Amend Frame Agreement. This launches Vlocity Cart.
4. Go to the Discounts tab and select the contract-based discount you want to deactivate.
5. Click X to deactivate the contract-based discount.
6. Click Update Frame Agreement.
7. Click Activate Contract.

WARNING
You must perform this step to deactivate the contract-based discount. If you skip this
step, the previous discount is still valid for the contract.

Products and Discounts in Vlocity Cart


This section provides a matrix of the different options that become available in Vlocity Cart when products
and multiple types of discounts are added to the cart.

© 2021 Vlocity LLC, a Salesforce


company 594
CME CPQ

Table 87. Matrix of Vlocity Cart State with Products and Discounts
Scenario in Vlocity Cart Resulting Action Frame Agreement
Buttons Available
No Products or Discounts in • The checkout button is disabled because there is no product or No
Cart discount.
No products with multiple • You may have an account-based discount or a contract-based discount. Yes
discounts. No products are required in this case.
• Order-based discounts cannot be applied when you do not have any
products in the cart.
Multiple products with multiple • You can apply multiple types of discounts to multiple products. Yes
discounts.

No Products or Discounts in Cart

Example 20. Vlocity Cart is Incomplete


In this example, you must add at least one product or discount to complete your order. Otherwise, the order
remains incomplete.

Table 88. No Products and Discounts in Vlocity Cart


Scenario Before Applying Discounts After Applying Discounts Frame Agreement
Buttons Available
No products or Checkout button is disabled because Checkout button is disabled because No
discounts in cart. there is no product or discount. there is no product or discount.

No Products with Multiple Discount Types

Table 89. Multiple Discount Types in Cart with No Products


Scenario Before Applying After Applying Frame Details
Discounts Discounts Agreement
Buttons
Available
Account-based Checkout button Submit button is Yes Does not copy the discount to the next
discount with no is disabled enabled. cart because the account discount
products in cart. because there is record is created and activated as part
no product. of the account.

When you click "Create Frame


Agreement", no data is copied because
this is not a contract-based discount.

However, a new Frame Agreement is


created.

© 2021 Vlocity LLC, a Salesforce


company 595
CME CPQ

Scenario Before Applying After Applying Frame Details


Discounts Discounts Agreement
Buttons
Available
Contract-based Checkout button Submit button is Yes The contract discount is copied to the
discount with no is disabled disabled until the contract. The contract must be activated
products in cart. because there is Status of the contract- for the discount to appear in future carts.
Contract is not no product. based discount is
active. "Activated". The "Create Frame Agreement" button
creates a new contract.
When the status of the
discount is "Activated",
the Submit button is
enabled and the
checkout can occur.
No products in Checkout button Submit button is Yes If a contract-based discount is present,
cart with two or is disabled enabled with the label then it is created as a contract discount
more discounts because there is "Submit". record. If it is absent, a contract is
of the same type. no product. created, but it will not have any contract
discount records associated with it.

Multiple Products with Multiple Discounts

Table 90. Multiple Products with Multiple Discounts


Scenario Before Applying After Applying Frame Agreement Buttons Available
Discounts Discounts
Two or more discounts Create Quote / Create Create Quote / Create Displayed.
of the same type. Order / Submit Order is Order / Submit Order is
Relevant or irrelevant enabled depending on enabled depending on If a contract-based discount is present, it is
products are added. which cart it is. which cart it is. created as a contract discount record. If it is
absent, a contract is created but it will not
have any contract discount records associated
with it.
Two or more discounts Create Quote / Create Create Quote / Create Displayed.
of different types are Order / Submit Order is Order / Submit Order is
added. Relevant or enabled depending on enabled depending on If a contract-based discount is present, it is
irrelevant products are which cart it is. which cart it is. created as a contract discount record. If it is
added. absent, a contract is created but it will not
have any contract discount records associated
with it.

© 2021 Vlocity LLC, a Salesforce


company 596
CME CPQ

Flow Management

Flows define sequential processing of rules, logic, and custom processing that can be initiated by an
interface implementation, specify calls to Apex, and can access any service.

Vlocity extends Salesforce Flow tools with sequencing logic to support the flow of objects, such as orders,
quotes, and price books. Flows support branching, synching, conditional execution, embedded flows, flow
actions, and entry and exit criteria.

Flows drive pricing steps. Vlocity Communications, Media, and Energy can then compute pricing for an
entire order.

You can create and manage flows and associate them with business processes to provide eligibility,
compatibility, and pricing. You can change the processing order, add new steps, and include branching
logic. Each rule action in a flow can invoke one rule by specifying the rule name and rule type. The
doCommit option specifies the last rule action, which is required.

Sample flow:

1. Preselect product filter.


2. Select product.
3. Check compatibility.
4. Price order.
5. Submit order.
6. Update order status.
7. Asset-based delta order.

Enabling a Flow
You can have several different versions of any flow in your org, but only one version can be active at a time.

To enable a flow:

1. From Setup, in the Quick Find box, enter Flows.


2. Click Flows.

© 2021 Vlocity LLC, a Salesforce


company 597
CME CPQ

3. Click the Flow Name to enable.


4. On the Flow detail record page, in the Flow Versions related list, next to the flow to deactivate, click
Activate.

Deactivating a Flow
You can have several different versions of any flow in your org, but only one version can be active at a time.

To deactivate a flow:

1. From Setup, in the Quick Find box, enter Flows.


2. Click Flows.

© 2021 Vlocity LLC, a Salesforce


company 598
CME CPQ

3. Click the Flow Name to deactivate.

4. On the Flow detail record page, in the Flow Versions related list, next to the flow to deactivate, click
Deactivate.

Add a Rule to the Pricing Flow


A pricing flow defines the sequential processing of rules and logic.

1. From Setup, in the Quick Find box, enter Flows.


2. Click Flows.
3. Click Pricing Rules Flow.

© 2021 Vlocity LLC, a Salesforce


company 599
CME CPQ

4. Open the flow.

If… Then…
An active flow is not present Next to the latest inactive flow, click Open.
An active flow is present Deactivate the latest flow, and then click Open. Save the flow as a new version.
5. In the palette, scroll to the Apex section.

© 2021 Vlocity LLC, a Salesforce


company 600
CME CPQ

6. Select vlocity_cmt__RuleAction and drag it to the flow.


The vlocity_cmt__RuleAction dialog box opens.

© 2021 Vlocity LLC, a Salesforce


company 601
CME CPQ

a. Enter a unique Name for the step.


b. On the Inputs tab, select ruleType. In the Source field, enter Pricing.
c. Click Add Row.
d. Select ruleName. In the Source field, enter the exact name of the pricing Rule. You may want to
copy the Rule name and paste it to avoid errors.
e. Click Add Row.
f. Select doCommit. In the Source field, enter {!GlobalConstant.True}.
g. Click OK.
7. Connect the new step as the last step under the Is Order branch.

© 2021 Vlocity LLC, a Salesforce


company 602
CME CPQ

© 2021 Vlocity LLC, a Salesforce


company 603
CME CPQ

Change of Plans

Customers of service providers can be enabled to change or migrate their services and plans after the
initial purchase.

To ensure that the existing service is not disrupted or discontinued, the Change of Plans feature (also
known as Replace Offers) allows service providers to upgrade or downgrade customer plans during the
lifecycle of the subscription.

NOTE
This feature is supported in Enterprise Product Catalog (EPC) and Configure Price Quote
(CPQ) for the Winter ‘19 release and later.

Key features include:

• Service Continuity
Your customers can migrate from the original plan to the new plan without any disruptions to their existing
services.
• Unchanged Service Identifiers
Service identifiers such as your customer's email address and mobile phone number remain the same
while migrating from one offer to another offer.
• A View into the History of Subscription Updates and Traceability
You can view the history of the asset details for your customers.

Usage Scenarios
Customers can move to new plans from old plans without any interruptions in service. In all cases, you can
move the customer from the source (original plan) to the target (new plan).

Customers can change plans that result in moving from one bundled offer to another bundled offer. A
bundled offer contains plans, devices, and services that are packaged together. Both bundled offers may
have common products that are retained in the process. Some of the existing assets that are not available
in the new bundled offer will be disconnected.

Here are some common use case scenarios that apply to the Change of Plans feature.

Example 21. Upgrading to a New Plan


Let's say your existing customer wants to upgrade their limited phone plan to a new plan with unlimited
data, text, and talk. You want to ensure that their existing phone service is not interrupted and their phone
number remains the same. With Vlocity's Change of Plan feature, you can move this customer to an

© 2021 Vlocity LLC, a Salesforce


company 604
CME CPQ

unlimited plan, guaranteeing continuity of service and retaining the same mobile number and email address
(service identifiers).

Example 22. Moving to Bundled Offers


You have an existing customer who is currently signed up for individual services (phone and internet
service). With Vlocity's Change of Plan feature, you can move the standalone offers (phone and internet
service) to a bundled offer for a specified period of time.

Example 23. Combining Service Plans


You have an existing customer who purchased multiple products at different points in time. The customer
now wants to reduce their overall bill without discontinuing the service. With Vlocity's Change of Plan
feature, you can review the customer's history and recommend a more effective way to combine services
without discontinuing the original service.

Creating a New Offer Migration Plan


This procedure assumes, for example, that you are an agent at ABC Telecom, and you receive a call from
Jane Doe requesting to switch her existing limited data plan to a plan with unlimited data, text, and talk. To
do so, you must ensure that she is eligible for the switch. You create a new migration plan and make sure
that the any-to-any plan path is available. This allows you to switch Jane's limited plan to an unlimited plan.

NOTE
Before you make the switch, make sure to inform her of any available change fees that
may apply.

See Applying Change Fees.

To create a new offer migration plan:

1. Log in to Salesforce and click the App Launcher.


2. Search for Vlocity Product Designer or Vlocity Product Console in the quick find box and open it.
3. Create a new Offer Migration Plan.

Interface Action Example


Vlocity Product Designer 1. Click the button, and select Offer Migration Plans.
2. Click New.

© 2021 Vlocity LLC, a Salesforce


company 605
CME CPQ

Interface Action Example


Vlocity Product Console In the Product Management table, click the Plus sign next to Offer Migration
Plan.

4. Enter the following required information. All fields marked with an asterisk are required.

Table 91. Offer Migration Details: Required Information


Required Description
Fields
Name Enter the name of the offer migration plan.
Code Enter a unique code for the offer migration plan.
Account Select the account to which the offer migration plan applies. Currently, account scope is limited to the same
Scope account only.
Product Select the family of products to which the offer migration plan applies. In Salesforce, a product family provides a
Family way to categorize products.

In telecommunications, a product family can represent the following products and services:

• Internet
• TV
• Wireless Mobile
• Broadband
• Support
• Fixed Line
As a service provider, you can use product families to categorize products one way for internal operations, and
another way for external presentation. It's up to you to determine how to categorize or classify the products.
The root catalog may have several categorizations for presenting products to customers on an eCommerce
website.

The Offer Migration Plan's Product Family field can be a subset or a complete set of the Product2 object's
Product Family field.
Migration Select the migration method. The offer migration plan applies to either Any-to-Any offers or Specific offers.
Method
• For Any-to-Any offers, users can upgrade or downgrade plans without any restrictions. The product
administrator can allow upgrades or downgrades from any-to-any offers, with or without exceptions.
• For Specific offers, users can only migrate to plans that meet the criteria defined in the Offer Migration
Component Mappings section. The product administrator can allow upgrades or downgrades between named
offers.
5. Enter the following optional information:

Table 92. Offer Migration Details: Optional Information


Optional Fields Description
Description Provide a description of the offer migration plan.
Business Reason Enter the business rationale for the offer migration plan.
Effectivity Fields
Active Select this option to activate the offer migration plan.
Effectivity Start Date Enter the start date for the offer migration plan.

© 2021 Vlocity LLC, a Salesforce


company 606
CME CPQ

Optional Fields Description


Effectivity End Date Enter the end date for the offer migration plan.
6. Click Save.

Defining Mappings
You can define exceptions to the any-to-any offer plan. This means that the customer can only migrate to
the new plan if the source and target defined in the exceptions list match the criteria.

NOTE
When you select the 'Specific Offers' migration path option, the mappings are used to
define the allowed migration paths for the offers.

To define mappings:

1. Log in to Salesforce and click the App Launcher.


2. Search for Vlocity Product Designer orVlocity Product Console in the quick find box and launch it.
3. Search for and open the Offer Migration Plan you created.
4. Click the Offer Migration Component Mappings facet on the left navigation pane.
5. Click New Offer Migration Component Mappings.
6. Enter the required information in the General Properties configuration panel.

Table 93. Offer Migration Component Mappings, General Properties


Required Fields Description
Source Product Search for and select the Source Product offer that you will use to migrate to the new offer plan.
Target Product Search for and select the new product offer to which you want to migrate from the original plan.
7. Select Active.
8. Click Save.

Searching for Offer Migration Plans


You can search for existing offer migration plans, view them, and make any modifications to the plan or the
mappings.

To search for an offer migration plan:

1. Log in to Salesforce and click the App Launcher.


2. Search for Vlocity Product Designer or Vlocity Product Console in the quick find box and open it.
3. Enter the name of the plan in the search field and click Search.
You can enter specific keywords to narrow your search results. A list of search results is displayed.

© 2021 Vlocity LLC, a Salesforce


company 607
CME CPQ

Interface Action
Vlocity Product Designer 1. Click the button, and select Offer Migration Plans.
2. Click in the Search this list field.
Vlocity Product Console In the Product Management table, click the search icon next to Offer Migration Plan.
4. Click the migration plan name to view or edit it.
You can view or edit the General Properties and the Offer Migration Component Mappings.

For more information about editing and deleting offer migration plans and exceptions, see:

• Editing and Deleting Offer Migration Plans


• Editing and Deleting Offer Migration Mapping Exceptions

Editing and Deleting Offer Migration Plans


You can edit existing offer migration plans or delete ones that do not apply to your business any longer.

Editing an Offer Migration Plan


To edit an offer migration plan:

1. Log in to Salesforce and go to the App Launcher.


2. Search for Vlocity Product Designer or Vlocity Product Console in the quick find box and open it.
3. Search for the Offer Migration Plan you want to edit.

Interface Action
Vlocity Product Designer 1. Click the button, and select Offer Migration Plans.
2. Click in the Search this list field.
Vlocity Product Console In the Product Management table, click the search icon next to Offer Migration Plan.
4. Click the migration plan name to edit it.
5. Make changes and click Save.

Deleting an Offer Migration Plan


To delete an offer migration plan:

1. Log in to Salesforce and go to the App Launcher.


2. Search for Vlocity Product Designer or Vlocity Product Console in the quick find box and open it.
3. Search for the Offer Migration Plan you want to delete.

Interface Action
Vlocity Product Designer 1. Click the button, and select Offer Migration Plans.
2. Click in the Search this list field.
Vlocity Product Console In the Product Management table, click the search icon next to Offer Migration Plan.
4. Delete the plan.

Interface Action
Vlocity Product Designer Click the action list for the plan and select Delete.

© 2021 Vlocity LLC, a Salesforce


company 608
CME CPQ

Interface Action
Vlocity Product Console Click the trash icon.
5. Click Delete to confirm.

Editing and Deleting Offer Migration Mapping Exceptions


You can edit or delete offer migration plans, which can include migration path exceptions.

Editing an Offer Migration Mapping


When you define any to any migration plan, for example, your customer may have an exception that you
define in the plan. You have defined the exception migration path and notice that there is an error in the
migration path you created. In this case, you can edit the record to fix the error.

To edit an offer migration mapping:

1. Log in to Salesforce and click the App Launcher.


2. Search for Vlocity Product Designer or Vlocity Product Console in the quick find box and open it.
3. Search for the Offer Migration Plan.

Interface Action
Vlocity Product Designer 1. Click the button, and select Offer Migration Plans.
2. Click in the Search this list field.
Vlocity Product Console In the Product Management table, click the search icon next to Offer Migration Plan.
4. Click the migration plan name to edit it.
5. Click the Offer Migration Component Mappings facet.
6. Click the pencil icon for the mapping to change.
7. Make any changes to the Source Product and Target Product properties.
8. Click Save.

Deleting an Offer Migration Mapping


Use the delete option, for example, when you are sure that you added an exception path accidentally and
you want to remove the exception from the record.

To delete an offer migration plan:

1. Log in to Salesforce and click the App Launcher.


2. Search for the Vlocity Product Designer or the Vlocity Product Console in the quick find box and open
it.

Interface Action
Vlocity Product Designer 1. Click the button, and select Offer Migration Plans.
2. Click in the Search this list field.
Vlocity Product Console In the Product Management table, click the search icon next to Offer Migration Plan.
3. Search for the Offer Migration Plan.
4. Click the migration plan name to edit it.

© 2021 Vlocity LLC, a Salesforce


company 609
CME CPQ

5. Click the Offer Migration Component Mappings facet.


6. Select the mapping you want to delete and click the trash icon.
7. Click Delete Mapping.

Replacing and Comparing Plans


Replacing a product works with any eligibility rules that you have defined. You can only replace plans
depending on your customer's eligibility to change plans.

For example, let's say you have a TV Elite product plan that you do not want to offer to east coast
customers. You can define an eligibility rule that prevents all east coast customers from upgrading to the TV
Elite product plan.

The rules API evaluates all the offer migration plans that have been defined for a product within Vlocity
Cart. Next, it checks the valid product families and finds the matching offer migration plans to determine
which products should be displayed. The eligibility rules determine if the plan is eligible or not. If the plan is
not eligible, it is removed.

You can also set up rules to apply change fees during the replacement process. For more information about
change fees, see Applying Change Fees.

Replacing Plans
You can replace an old plan with a new plan.

To replace plans:

1. Go to the Accounts page in Salesforce and select the product to which you want to apply the new plan.
2. Locate the root level asset that contains the plan you want to replace.
3. Click Change to Order or Change to Quote to launch the MACD order process.
4. In the Future Dated Orders window, specify the date and time and click Next.
You will see the line item with an Action type of Existing.
5. In Vlocity Cart, view the plans you want to replace.
6. From the list of qualified products in the selectables list, click Replace.

© 2021 Vlocity LLC, a Salesforce


company 610
CME CPQ

7. Select the plan you want to replace with the new one and click Apply.
The existing asset status changes to "Disconnect" and the new product plan is added to the cart with a
status of "Add".
8. Click Create Order.

Comparing Plans
To compare plans:

1. Follow steps 1 through 7 in Replacing Plans.


2. Click the down arrow next to the Disconnected line item.
You will only see the Compare option for new plans. You will not see this option for existing plans.
3. Click Compare.

© 2021 Vlocity LLC, a Salesforce


company 611
CME CPQ

You can compare the Recurring Total of the old asset with the Recurring Total and One Time Total of the
new asset. You can also compare the action and sub-actions of the old and new assets. You cannot view
the attributes for each asset from this view.

Asset Status After Submitting the Order


After you submit the order, the old asset is disconnected and replaced with the new asset. Items that are
reassigned have a one-time charge of $0.

The following table provides a summary of the fields that are impacted in the old and new records.

Table 94. Asset Status Details


Asset Status Provisioning Status Action Sub-Action
Old Record Deleted Disconnect Replace/Reassign
New Record Active Add Replace/Reassign

Applying Change Fees


Service providers often charge fees for making changes to existing plans to cover their costs. As a service
provider, you can charge change fees.

Consider the following situation:

Example 24. Charging a One-Time Fee When You Downgrade a Plan


Your customer, Jane Doe, decides to downgrade from the unlimited data plan to a limited plan because
she's going on a silent retreat and will not be using her phone service or data plan. In order for her to

© 2021 Vlocity LLC, a Salesforce


company 612
CME CPQ

downgrade, you charge her a one-time change fee of $20 because she's making this change within a
month of upgrading.

Setting Up the Framework to Apply Change Fees


Make the following considerations when you apply change fees:

• First, determine the change fee amount you want to apply when your user decides to change plans.
Determine if this is a one-time fee.
• Next, decide the specific situation to which you will apply the change fee. For example, you may decide
to apply change fees only when users downgrade their plans.
• Then, configure and build rules to trigger the change fees.
• Finally, create the offer migration plan that will apply the change fee based on the configuration rules you
have built.

Follow these steps to set up the change fee process.

1. Set up a product with a relationship type and the related product. The change fee product can be
modeled as part of the bundled offering or a stand-alone fee product. For example, you can set the
relationship type to be auto-add whenever a customer wants to downgrade their plan from unlimited
data to limited data. See Create Products in Vlocity Product Console.
2. Define two filters to be triggered when the condition is true for the quote or order:
• Qualification filters.
• Evaluation filters.
See Entity Filter Types.
3. Define rules to be triggered when the condition is true for the quote or order.
• Configuration rules: make sure to link the product relationship and qualification filters to the rule. See
Context Rules and Advanced Rules Frameworks.

Transforming Multiplay Offers


Communications Service Providers always need to find ways to attract new customers and retain their
existing customers. One of these methods is to introduce new offers for the same services and products
with more attractive prices and marketing. An existing customer who wishes to benefit from new offers and
prices has the choice of migrating their plan to new offers. This involves moving from one product bundle to
another, for example, migrating a mobile plan to a better mobile plan.

Transforming a multiplay offer usually involves reducing the price or improving the service.

A common scenario is upgrading a mobile offer with a better data plan. Initially, the plan may not be
shareable, but you want to change to a family plan with unlimited talk and text, and data plan options, such
as 3 GB, but shared among the members of the plan. The SIM may be shared with up to 10 mobile
numbers, plus roaming and HD streaming. A constraint with a limited plan may be that you need to pay a
higher price when upgrading to 5 GB or 10 GB. With Change of Plan, you can transform the old mobile plan
to the new family plan, with the same or better services and more data.

© 2021 Vlocity LLC, a Salesforce


company 613
CME CPQ

Figure 94. Replace, Upgrade, or Downgrade Offers

Merging Multiple Existing Offers into a Single New Offer


As a service provider, you can merge individual offers that belong to different product families into a new
single multi-play bundle.

For example, a customer already subscribes to individual plans for Internet, VoIP, and TV service. You can
merge individual internet and VoIP plans into a Triple Play Bundle that includes Internet, VoIP, and TV by
adding a TV plan, and you can also upgrade the plan to include more data.

At this point, the customer is eligible to migrate the existing top-level Internet Bundle to the Internet Bundle
in a MultiPlay Offers, such as such as Triple Play. The triple play root-level offer contains Internet, VoIP, and
TV bundled as immediate children.

When migrating plans from a source to target, the transform function compares the two product/service
structures to find a match. When a match is found, the transform function uses an action/sub action
combination. The action may be set as Disconnect for the old product, and the sub action is Replace with
the new product or service. For example, the 2 GB service may be a permanent disconnect, and the 3 GB
service may be a permanent Add. This represents a soft disconnect to Order Management so you do not
actually lose your associated device. So, Change of Plan allows you to move from one product bundle to
another, which gives you more flexibility in terms of features, as opposed to one feature, such as a Internet
service, that would only require a MACD order.

As another example, a customer already has two individual mobile plans that are not sharable. The
customer is eligible to migrate an existing individual mobile bundle to a top-level mobile family bundle.

As a service provider, you can merge individual offers that belong to the same family into a new single
sharable service bundle, for example, you can merge individual mobile plans into new sharable mobile
plan. This could also involve merging several disjointed services, such as Internet, TV, mobile, that may

© 2021 Vlocity LLC, a Salesforce


company 614
CME CPQ

have been purchased at different times, into one service bundle, such as Triple Play. The old customer
assets are marked as inactive and disconnected, and the new assets become active.

Another example of merging disjointed offers may be that you want to disconnect your TV, but the service
provider offers you triple play or a promotion and add VoIP, faster internet, but for $100/mo. The old, lower-
performing package was $60/month.

The old internet gets disconnected and mapped to the new internet. Triple Play, Internet 100MB now
becomes an active asset and increases from $180 per month to $250 per month. New channels are added
for TV. VoIP can be added, but may not be needed.

You can also go back and split the Triple Play into only what you need: Internet and TV (based on price),
but not VoIP, which gets disconnected. There could be a Double-Play offer with TV Plus, for an additional
$5 per month, and Internet for $100 per month.

Splitting a Single Existing Offer into Multiple New Offers


Change of Plan enables you to split a single multi-play bundle into individual offers that belong to different
product families.

For example, a customer has already subscribed to a Triple Play Bundle with Internet, VoIP and TV service.
The customer is eligible to migrate the existing top-level Triple Play Bundle to a standalone Internet Bundle,
VoIP and TV Bundle. The triple play root-level offer contains Internet, VoIP and TV bundled as immediate
children. The customer wants to split the single multi-play bundle into Individual Offers that belong to
different product families. To accomplish this, you can split the Triple Play Bundle (Internet, VoIP, TV) into
new Individual Internet, VoIP and TV plans, or you can split the bundle into new Individual Internet and VoIP
plans, and disconnect the existing VoIP plan.

After splitting the bundle, the subscriber may want to merge and upgrade the two remaining services into a
double-play offer that has higher internet speeds or more channels, but at the same price or a slightly
higher price.

You can also split a single, sharable service bundle into Individual Offers that belong to the same family, for
example, you can split an individual Mobile line from a shared service into separate new individual Mobile
plan.

If you want to disconnect all the components of an offer, go to Vlocity Cart and use the 'Delete' Option
against that line item.

Merging, Splitting, or Transforming a Multiplay Offer


You can merge, split, or transform (which is any combination of merge and split) a multi-play bundle as
follows:

1. From the Accounts page, select a customer account. The account page for that customer appears.
2. In the Asset Management section, select the assets you want to migrate.

© 2021 Vlocity LLC, a Salesforce


company 615
CME CPQ

3. Click Change To Order to initiate the change-order. The Request Datetime dialog appears. Make any
changes, then click Next. The Vlocity Cart appears. You can add new products to the cart at this point.
4. From the Vlocity Cart, click Transform Multiplay Offers.

The Transform Multiplay Offers dialog appears, showing the top-level assets you selected from the
Account page.

© 2021 Vlocity LLC, a Salesforce


company 616
CME CPQ

5. Select existing offers to replace, then click Transform.


Transform decomposes the offer to its main components. The Transform Multiplay Offers page
appears, which shows the top-level product bundle offer and the main components.
The example below assumes you selected only Double Play Basic, so the page shows the
components contained within the Double Play Basic – Internet Basic and TV Basic – and the
replaceable offers, such as ABP Home Hub Modem, for each.

© 2021 Vlocity LLC, a Salesforce


company 617
CME CPQ

6. Select an option from the Action list:


• Keep: No longer shows the Replaceable Offers because you are keeping them, and not replacing
them.
• Replace: Gives you possible options for replacing your current offer.
• Disconnect: No longer shows the Replaceable Offers, because they are being disconnected.
If you select the Replace action, then the next page shows you the possible options for replacing your
current offer.

© 2021 Vlocity LLC, a Salesforce


company 618
CME CPQ

If you selected Disconnect to disconnect the Internet offer, for example, then the next page shows
only the TV offer without the Internet offer.

7. Set the Group number.

© 2021 Vlocity LLC, a Salesforce


company 619
CME CPQ

The group number specifies how you want to group the items in the resulting sets that appear on the
next page after you click Next.
For example, if you have two demo TVs and two demo Internets such that there is one TV and one
Internet in each group, the next screen shows you possible combinations of those two items within that
group. You can take those two items and put them together under one group, and two items under
another group.

8. Click Next.
CPQ performs the following actions.
• Runs eligibility and context rules.
• Filters the Price List.
• Finds all possible MultiPlay Bundles having given components as its children.
The transformation process breaks up the existing bundle/structure. Everything in the source bundle
becomes disconnected, creating a new set of items. The grouping actions determine if the bundle and

© 2021 Vlocity LLC, a Salesforce


company 620
CME CPQ

its items are split, merged, or re-parented. What happens in the target is based on the grouping. For
each group you break up, items will initially be by themselves (unbundled) and the group determines
what gets added. If a child product is pulled out of a bundle, it can be re-parented to a new bundle,
split/made into a top-level item or separate line item, or merged with a new bundle.
For example, you could pull Internet Offer out of a Triple Play bundle. That whole offer becomes
disconnected and the individual offers, such as Internet Offer, become their own line items.
The individual items represent what you have. The group number helps determine what you would like
to upgrade to.
For example, if you put three items into the same group, then the transform function looks for a
multiplay bundle that contains at least all three of the items you have chosen. The resulting page
shows you options of triple play or quad play that contains your three chosen items.
If you have four different groups, then you would have four different options from which to choose.

© 2021 Vlocity LLC, a Salesforce


company 621
CME CPQ

9. Under the Available Multiplay Bundle Choices, select your desired options.
10. Click Done. The Cart appears with your new products and services, which you can expand to see the
child/related components/items displayed as line items. The Action column shows which items have
been added or disconnected.

© 2021 Vlocity LLC, a Salesforce


company 622
CME CPQ

Comparing Offers
While replacing an existing bundled offer (Asset) with a new bundled offer, some of the existing products
may be available in the new bundled offer. In such an event, an API returns line item attributes and values
to display on the Comparison UI the attribute and its value from the existing asset are copied onto the
matching target product. In addition, the action, sub action, and asset relationships between the matching
products are set or created to indicate that the existing assets are retained in context of the target offer.

The comparison feature recursively finds all the related items and dependencies so you are not missing
anything in your comparison and so you get an accurate price. For example, you may have had three
double-plays which were transformed to three triple-plays. There may have been items that came from a
separate bundle on the left side that were not intentionally selected for the comparison, but were included in
the target anyways because, for example, an item may relate to another double-play.

A scenario may be that a customer purchases equipment, such as a STB, in 12 installments as part of a TV
Offer for a fixed monthly price. While upgrading the TV offer, the STB continues to stay in the context of the
new TV Offer along with the agreed monthly price and installments. The installment start date and final end
date in the Account Pricing remain the same.

To see the change in price when you move to a new offer:

1. On the disconnect action for a line item, click the associated action button and select Compare.

© 2021 Vlocity LLC, a Salesforce


company 623
CME CPQ

The Compare Changes screen appears and shows the comparison between the current product and
the replacement quote.

© 2021 Vlocity LLC, a Salesforce


company 624
CME CPQ

2. Select a product in the current bundled Offer. The matching or mapped product in the Replacement
Quote section is highlighted.
Attributes and their values are displayed as read-only for current products and replacement quotes.
You can collapse or expand the attribute section. By default, the section is collapsed. The Asset
Reference identifier appears on the replacement quote that matches the current product.
Compare Changes screen also displays onetime charge and one time total for replacement quotes that
are net new, for example, Action=Add, Subaction != (Reassign, Replace).
If sourceItem has Purchase Date, Start Date, and End Date populated, those would be copied to
targetItem once Order is submitted. Compare view will show these dates if available.

Creating Custom Field Settings


For Change of Plans, the ReplaceOffer API supports additional custom fields to copy during replacements
of offers. You must define a Field Settings record for each field to copy during the Replace process. Custom
Field propagation uses the Field Settings Custom Setting. Each custom setting record defines the following:

• Feature: The feature name is COPFieldsToCopyDuringReplace.


• Object Name: Object Name matching the line item type, for example, OrderItem.
• Field Name: Fully qualified name of the field to copy.

The following is the list of fields to copy from source line item to target line item in an order context and a
quote context:

• ServiceDate, if it is a Reassign. ServiceDate is the standard salesforce date that has a Date label in
daily_jsonv2@vlocity.com.
• vlocity_cmt_BillingAccountId_c, if it is a Reassign or Replace.
• vlocity_cmt_ItemName_c, if it is a Reassign.
• vlocity_cmt_SerialNumber_c, if it is a Reassign.
• vlocity_cmt_ServiceAccountId_c, if it is a Reassign or Replace.
• EndDate (order context only), if it is a Reassign.

To create the custom field settings:

1. Click Setup.
2. In the Quick Find / Search field, type Custom Settings.
3. In the search results, under Develop, click Custom Settings.
4. Search for Field Settings. The Field Settings page appears.
5. Beside Field Settings, click Manage. The Field Settings page appears.

© 2021 Vlocity LLC, a Salesforce


company 625
CME CPQ

6. Click New.
7. Fill the required fields.

The feature name field should match with COPFieldsToCopyDuringCreatingAsset. FieldName is the
custom Field Name of the asset to copy during replacement. In the above figure, CustomField__c of
the Asset object is being copied from the old asset to the new asset.
8. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 626
CME CPQ

To copy additional fields for Asset, create a new Field Setting for each additional field, where the feature
and the object name remain same.

When submitting an order, if you need additional fields to copy from the old asset to the new asset, use the
COPFieldsToCopyDuringCreatingAsset feature.

When replacing an offer in CPQ, if you need additional fields to copy from source LineItem to target
LineItem, use the COPFieldsToCopyDuringReplace feature.

© 2021 Vlocity LLC, a Salesforce


company 627
CME CPQ

Multi-Site Quote and Order Capture

Communications & Media businesses can have thousands of locations, service accounts, or subscribers for
which you need to generate Quotes or Orders. Vlocity provides a solution to group individual locations,
service accounts, or subscribers and to apply the same product configuration to each group member.

You can create either of the following structures:

• Single — Groups map to line items of a single Quote or Order.


• Multiple — Group members map to child Quotes or Orders of a master Quote or Order.

NOTE
The Fall '19 and Winter '20 releases have the following limitations:

• You can generate master Quotes but not Orders


• Groups can only consist of Service Point objects
• Only the master/child Quote or Order structure is supported
• You can only validate, price, and submit in Vlocity Cart

In these older releases, the Multi-Site feature is named Multi-Service Points.

Example 25. Generate a Quote for ABC Hotels in the Netherlands


SitePoint Communications is a supplier of telecom services, focused on the commercial and residential
market. SitePoint has been contacted by ABC Hotels, a large hotel chain, requesting a quote for internet
and cable services.

The ABC Hotels network contains a range of service locations that require internet services for their
commercial operations in multiple cities in the Netherlands. SitePoint must organize the ABC Hotels
service locations into groups so that the appropriate product can be selected for each group. This allows
SitePoint to quote the best overall price to ABC Hotels.

After they receive a list of all the service locations from ABC Hotels, SitePoint can group the service
locations, add the products to the service location groups, add groups to the Vlocity Cart, price and validate
the quote for multiple service locations, convert the quote to an order, and submit the final order.

Multi-Site Workflow
The following steps provide an overview of the Multi-Site workflow. Go to the relevant section to view details
for each task in the process.

© 2021 Vlocity LLC, a Salesforce


company 628
CME CPQ

Before You Begin


Define your products and their prices. See Vlocity Enterprise Product Catalog (EPC) and Vlocity Configure, Price, Quote (CPQ).

1. Define your location objects, such as Service Points, Premises, and Accounts. See Define Multi-Site
Objects.
2. Configure any customizations you need, such as whether users can choose the single or multiple
structure, which objects can be grouped, and which object fields are displayed. See Configure Multi-
Site Customizations.
3. Create an Opportunity, a master Quote or Order with a single or multiple structure, and groups. See
Create the Opportunity, Quote or Order Structure, and Groups.
4. Apply product configurations to groups, validate and price, and submit.
• For a single master Quote or Order, assign groups to line items, validate, price, and submit in the
Cart. See Validate and Price a Single Quote or Order.
• For multiple child Quotes or Orders, you can assign products, validate, price, and submit in the Cart.
See Validate and Price Multiple Quotes or Orders.
• For multiple child Quotes or Orders, you can assign products in the Cart, then validate, price, and
submit on the groups page. See Validate and Price on the Groups Page.
5. View the resulting Orders and related Assets. See View Multi-Site Orders on the Account Record
Page.
6. Optionally view the total quantity and price for each product. See Configure Quantity Rollup Lists.

See Also
• Large Quotes to Contracts Overview

Define Multi-Site Objects


The Fall '19 and Winter '20 releases only supported the use of Service Point objects for Multi-Site locations.
The Fall '20 release supports Service Point, Premises, Subscriber, and Service Account objects out of the
box. You can configure additional objects.

A Service Point is defined as an entry point for services to a Premises. The service provided to each
Service Point is separately measured. This is useful for services such as phone, internet, or TV.

Complete the following tasks in the order shown. You must create an Account and a Premises before you
create a Service Point. After you create a Service Point, you can associate an Asset with an Account or a
Premises and associate a parent Premises to an existing Premises.

Create a Premises
A Premises represents a complex, building, or house together with its land and outbuildings, occupied by
businesses or tenants. A Premises record can optionally represent a location within a Premises, such as a
particular building on a property, a floor of a building, or some other subset of the larger Premises where
equipment might be deployed.

1. Log in to Salesforce.

© 2021 Vlocity LLC, a Salesforce


company 629
CME CPQ

2. Click the + tab to see All Tabs.


3. Click Premises.
4. Click New.
5. Enter the following information.

Table 95. Premises Information


Fields Description
Required Fields
Name Enter the name of the service point.
Street Address Enter a street address.
City Enter the city name.
State Enter the state.
Postal Code Enter the postal code.
Optional Fields
Country Enter the name of the country.
Premises Identifier Enter a unique identifier for the premises.
Parent Premises Enter the parent name of the premises.
Premises Type Enter the premises type. For example, Duplex, Condominium, Commercial Building, Floor, Floor
Section, Apartment Building.
Status Enter the status of the premises. For example, Connected, Vacant, Install in Progress, Planned,
Inactive.
Premises Number Enter a unique number for the premises.
Geolocation (Latitude) Specify a latitude for the premises.
Geolocation (Longitude) Specify a longitude for the premises.
6. Click Save.

Create an Account

1. Log in to Salesforce.
2. Click the + tab to see All Tabs.
3. Click Accounts.
4. Click New.
5. Enter the Account Name.
6. Search for and associate the Premises you created to this Account.
7. Click Save.

NOTE
If the Account has a parent Account, all the service points linked to the parent Account are
retrieved.

© 2021 Vlocity LLC, a Salesforce


company 630
CME CPQ

Create a New Service Point


1. Log in to Salesforce.
2. Click the + tab to see All Tabs.
3. Click Service Points.
4. Click New.
5. Enter the following information.

Table 96. Service Point Fields and Descriptions


Fields Description
Required Fields
Service Point Name Enter a name for the service point.
Premises Search for and select the premise that this service applies to.
Service Type Select the type of service that you want to associate with this service point.
Optional Fields
Market Identifier Enter a unique number for the market identifier.
Meter Search for an select the meter that you want to associate with this service point.
Service Point Number Enter a service point number.
Status Select a status for this service point.

• Connected
• Vacant
• Install in Progress
• Inactive
Activation Date Specify the date by which you want the Service Point to be activated.
6. Click Save.

Associate a New Asset to an Account and Premises


You can link an Asset to an Account and Premises.

1. Log in to Salesforce.
2. Search for and open the Service Point record you created.
3. Click New Asset.
4. Enter the Asset Name.
5. Search for the Account you created and associate it with the Service Point.
6. Search for the Premises you created and associate it with this Service Point.
7. Click Save.

Associate a Parent Premises to an Existing Premises


You can associate a parent Premises to a new or existing Premises.

1. Log in to Salesforce.
2. Search for and open the Premises record to which you want to associate a parent Premises.
3. Click Edit in the Parent Premises field.

© 2021 Vlocity LLC, a Salesforce


company 631
CME CPQ

4. Click Search to associate an existing Premises.


5. Click New to create a new parent Account to associate to the existing Premises.
6. Click Save.

What's Next
After you define your location objects, the next step is to Create the Opportunity, Quote or Order Structure,
and Groups.

Configure Multi-Site Customizations


You can customize some aspects of the Multi-Site feature, such as which objects can be in groups and
which object fields are displayed.

You don't need to customize the Multi-Site feature if all of the following are true. For the Fall '19 and Winter
'20 releases, only the last two items apply.

• You want to limit users to one structure: a master Quote or Order with child Quotes or Orders.
• You don't need to enable the option of invoking Apply to Group, Validate and Price, and Submit on the
group page.
• You plan to use only Service Point objects for grouping.
• You don't need additional display fields or filters on the group page.
• You don't need to change the group pane, page size, or batch size in Vlocity Cart.

If any of these conditions are false, see the following sections.

Configure the Single or Multiple Structure


You can configure which Quote or Order structure users can create:

• multiple — Users can only create a master Quote or Order with multiple child Quotes or Orders. This is
the default.
• single — Users can only create a single Quote or Order with line items.
• select — Users can choose which structure to create.

This task does not apply to the Fall '19 and Winter '20 releases.

To configure the Quote or Order structure:

1. From the App Launcher, go to the Vlocity OmniScript Designer page.


2. Find MultiService/CPQConfiguration in the list and expand it.
3. Click the active version of the MultiServiceCPQConfiguration OmniScript to open it.
4. Click Deactivate Version so you can edit the OmniScript.
5. In the Structure panel, click the SetValues component.
6. In the Element Value Map, change the value of the cartStrategy element to single, multiple, or
select.

© 2021 Vlocity LLC, a Salesforce


company 632
CME CPQ

7. In the Structure panel, click Script Configuration.


8. Click Activate Version.

Enable Apply to Group, Validate and Price, and Submit on the Group Page
You can enable the Apply to Group, Validate and Price, and Submit buttons on the group page. This
saves time and steps by eliminating the need to click these buttons separately for each group in the cart.

This task does not apply to the Winter '20 and Fall '19 releases.

To enable the Apply to Group, Validate and Price, and Submit buttons on the group page:

1. Go to Setup.
• In Lightning Experience, click the gear icon and select Setup from the menu.
• In Salesforce Classic, click the user menu and select Setup from the menu.
2. In the Quick Find field, enter Custom Settings.
3. Click Custom Settings.
4. Click the letter C in the index across the top.
5. To the left of CPQ Configuration Settings, click Manage.
6. Click the letter E in the index across the top.
7. If you don't see EnableMultiSiteBulkAction in the list:
a. Click New.
b. In the Name field, type EnableMultiSiteBulkAction.
c. In the Setup Value field, type true.
8. If you do see EnableMultiSiteBulkAction in the list:
a. To the left of EnableMultiSiteBulkAction, click Edit.
b. Make sure the Setup Value field is set to true.
9. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 633
CME CPQ

Configure Objects for Grouping


By default, only Service Point objects are fully configured for use on the group page. You can include
Service Accounts, Premises, or Subscribers by activating them. Including other objects requires more
configuration.

This task does not apply to the Fall '19 and Winter '20 releases.

To activate the Service Account, Premises, or Subscriber grouping objects:

1. Go to Setup.
2. In the Quick Find box, type meta, and click Custom Metadata Types.
3. Next to CPQ Group Member Type, click Manage Records.
4. Next to the object type you want to activate, click Edit.
5. Click the Active check box.
6. To determine the position of the object's tab on the group page, change the Display Sequence value.
By default, Service Point has a Display Sequence value of 1.
7. Click Save.

To configure a new grouping object:

1. Go to Setup.
2. In the Quick Find box, type meta, and click Custom Metadata Types.
3. Next to CPQ Group Member Type, click Manage Records.
4. Click New.
5. Fill in the following required fields. Using merge fields for the Vlocity namespace is recommended.
Examples are for the Service Account object type.

Field Example Value Description


Label Service Account Tab label on group page
CPQ Group Member ServiceAccount Unique internal name used by the API and managed
Type Name packages
Member Object Account API name of the object
Name
Order Field Name %vlocity_namespace API name of the Order field that stores the Id of the
%__DefaultServiceAccountId__c associated group member record
Order Product Field %vlocity_namespace API name of the OrderItem field that stores the Id of the
Name %__ServiceAccountId__c associated group member record
Order Member Field %vlocity_namespace API name of Order Member field that references the
Name %__ServiceAccountId__c group member record
Quote Field Name %vlocity_namespace API name of the Quote field that stores the Id of the
%__DefaultServiceAccountId__c associated group member record
Quote Product Field %vlocity_namespace API name of the QuoteItem field that stores the Id of the
Name %__ServiceAccountId__c associated group member record
Quote Member Field %vlocity_namespace API name of Quote Member field that references the
Name %__ServiceAccountId__c group member record
6. Fill in the following optional fields if needed. Using merge fields for the Vlocity namespace is
recommended. Examples are for the Service Account object type.

© 2021 Vlocity LLC, a Salesforce


company 634
CME CPQ

Field Example Value Description


Display Sequence 3 Tab position on group page
Active (checked) Determines whether tab appears on group page
Record Filters %vlocity_namespace Query condition to determine which records to include
%__Status__c != 'Inactive'
Record Type Name Service Developer Name of the Record Type to include, leave blank to
include all records
7. Click Save.

Configure Field Settings for Display Columns


For any grouping object, you can configure existing Multi-Site field settings for table columns that are
displayed on the group page by default, or you can add new fields to the table. To configure grouping
objects, see the previous section.

IMPORTANT
When you create a custom field setting, only fields you have defined in the field setting are
displayed. Other fields are not displayed in the column headers.

For example, the default set of fields that appear in the display columns for the Service Points table include:

• ServicePoint.MarketIdentifier
• Premises.StreetAddress
• Premises.PostalCode
• Premises.City
• Service Point.UtilityProvider
• Service Point.LoadProfile
• Service Point.AverageMonthlyUsage
• Service Point.VoltageLevel

Other grouping objects, such as Premises or Service Account, have different default fields.

© 2021 Vlocity LLC, a Salesforce


company 635
CME CPQ

To configure display columns using field settings:

1. Log in to Salesforce.
2. Go to Setup.
3. Search for Custom Settings In the Quick Find box and launch it.
The Custom Settings page is displayed.
4. Go to Field Settings and click Manage to view the field settings.
The Field Settings page is displayed.

5. Click New to add a new field or Edit to modify a field that is displayed by default.
The Field Settings Edit page is displayed.
6. Enter the following information.

Table 97. Field Settings


Field Description
Name Enter the name of the grouping object field you want to add or modify an existing field.
Feature Enter MultiServiceFields for the feature name.
Field Name Enter the API name for the field. For example, the API field name for VoltageLevel field of the Service Point
object is vlocity_cmt__VoltageLevel__c.

You can reference fields of related objects using relationship notation. For example, to reference the City__c
field from the Premises object on the Service Point tab, specify
vlocity_cmt__PremisesId__r.vlocity_cmt__City__c. For details about relationship notation, see
Relationship Notation versus Multiple Extract Steps.
Inclusion When you check this option, the field is included as a column in the table. When you don't check this option, this
field does not appear in the table.
Is Editable This field is not used.

© 2021 Vlocity LLC, a Salesforce


company 636
CME CPQ

Field Description
Object Name Enter the object API name. For example, the name of the Service Point object is
vlocity_cmt__ServicePoint__c.
Sequence Enter the sequence in which you would like the field value to display.
7. Click Save.
The new field is added to the Field Settings list.

Configure Filters
For any grouping object, you can customize filters.

For example, the default set of fields used to filter Service Points include:

• Service Point.LoadProfile
• Service Point.MeterType
• Service Point.UtilityProvider
• Service Point.ServiceType
• Service Point.VoltageLevel

To configure filters:

1. Follow steps 1 through 6 listed in Customizing the Field Settings.


2. For Feature, enter MultiServiceFilterFields. For example, the Voltage Level Filter uses the
MultiServiceFilterFields Feature.

© 2021 Vlocity LLC, a Salesforce


company 637
CME CPQ

3. Click Save.
The new filter is added to the Field Settings list.

Configure the Multi-Site Group Pane in Vlocity Cart


You can modify the multiservice-cpq-group-list card and template to configure the Multi-Site group pane.
The group pane is the pane on the left of Vlocity Cart and includes the group name of the service points,
the market identifier, and the name of the premises. You can modify the appearance of the group pane by
adding new fields, hiding the default fields, or changing the layout depending on your specific business
needs.

To configure the Multi-Site group pane:

1. Log in to Salesforce.
2. Go to the App Launcher.

© 2021 Vlocity LLC, a Salesforce


company 638
CME CPQ

3. Search for and open Vlocity Cards.


4. Search for and open the multiservice-cpq-group-list card.
The multiservice-cpq-group-list card is displayed.

5. Click the Edit Template link to modify the multiservice-cpq-group-list template.


The template appears in HTML view. Modify the code to display Premises instead of Market Identifier
in the Vlocity Cart view. For example, delete the groupedItem for Market Identifier and replace it with
groupedItem for Premises.

<span class = "slds-truncate"


title = "{{groupedItem.Name.value}}"> <a href =
"{{groupedItem.quoteURL}}"> {
{
groupedItem[$root.nsPrefix + 'MarketIdentifier__c'].value
}
} </a>
</span>

© 2021 Vlocity LLC, a Salesforce


company 639
CME CPQ

NOTE
The groupedItem JSON field contains all the default columns that appear in the
service points results list.

6. Click Save.
7. Slide the Activate button to deactivate the multiservice-cpq-group-list card.
8. Add your custom fields in the Input Map section to view the field details from the API.
This is a comma-separated list.
9. Click Activate.

Configure the Page Size for Groups in Vlocity Cart


You can configure the page size for the following items:

• groupPageSize: Page size for groups returns the number of groups you can view. The default is set to
20 for optimum performance. If you create more than 20 groups, you can click the Load More Groups
button to view the longer list.
• groupedServicePageSize: Page size for groups returns the number of items that are grouped together.
The default is set to 20 for optimum performance. If you add more than 20 within a group, the Load More
button is available. Click it to view the longer list within that group.
• ungroupedServicePageSize: Page size returns the number of individual items that are not grouped.
The default is set to 30 for optimum performance. If you have more than 30 items that are not grouped,
the Next and Previous buttons are available so you can view the longer list of ungrouped items.

When you configure the page size for groups, group members, or ungrouped items, it impacts the number
of results for each item that will appear on the managed group page and the Vlocity Group Cart page.

© 2021 Vlocity LLC, a Salesforce


company 640
CME CPQ

NOTE
If your org has more than 2,000 records for any grouping object, Vlocity recommends that
you apply filters to retrieve your search results because the maximum query result is set to
2,000 on the Salesforce platform. Using OFFSET is an efficient way to handle large result
sets.

• For more information about filters, see Manage Multi-Site Groups.


• For more information about OFFSET considerations, see the Salesforce documentation.

To configure the page size:

1. Log in to Salesforce.
2. Go to the App Launcher.
3. Search for and open the Vlocity OmniScript Designer.
4. Search for and open the MultiServiceCPQConfiguration script.
5. Click Deactivate Version.

6. Click SetPageSizeForServicePoints listed in Structure.


7. Change the value for each element name you want to configure.
The default values are set to:
a. groupPageSize = 20
b. groupedServicePageSize = 20
c. unGroupedServicePageSize = 30

© 2021 Vlocity LLC, a Salesforce


company 641
CME CPQ

8. Go to Script Configuration and click Activate Version.

Configure the Batch Size


You can determine the number of group members to process by configuring the batch size for the following
cards in the OmniScript Designer.

TIP
Vlocity recommends that you keep the batch size low to avoid the max SOQL Salesforce
and heap size limit.

Multi-Service/ApplytoGroup

NOTE
For ApplytoGroup, set the Batch Size to 1. This allows you to copy and update one Quote
or Order at a time.

© 2021 Vlocity LLC, a Salesforce


company 642
CME CPQ

MultiService/PriceAndValidate

NOTE
For PriceAndValidate, set the Batch Size to 1. This allows you to process one Quote or
Order at a time and price and validate it using Vlocity CPQ.

MultiService/Checkout

NOTE
For Checkout, set the Batch Size to 1. This allows you to process one Quote at a time,
convert it into an Order, and then create assets using Vlocity CPQ.

To configure the batch size:

1. Log in to Salesforce.
2. From the App Launcher, search for Vlocity OmniScript Designer and launch it.
3. Search for ApplytoGroup. The MultiService/ApplytoGroup card is displayed.
4. Create a copy and click the card to open it.
5. Click SetApplytoGroupIPName.
6. Set the BatchSize, for example, Batch Size = 1.
7. Follow steps 4 through 6 to set the batch size for Price and Validate and the Checkout cards.
8. Click Save.

Create the Opportunity, Quote or Order Structure, and Groups


When you create a master Quote or Order from an Opportunity, it is linked to the Account with which the
Opportunity is associated. You can create Multi-Site groups based on the Service Points, Premises, Service
Accounts, Subscribers, and other objects associated with the Account.

NOTE
In the Fall '19 and Winter '20 releases, you can only create master Quotes with multiple
child Quotes that have Service Points as group members.

© 2021 Vlocity LLC, a Salesforce


company 643
CME CPQ

Create the Opportunity


To create the Opportunity on which the master Quote or Order will be based:

1. Click the App Launcher and search for Opportunities.


2. In the Opportunities tab, click New.
3. Enter the following information.

Table 98. Required and Optional Fields for Opportunities


Fields Description
Required Fields
Opportunity Name Enter the name of the opportunity.
Close Date Specify the closing date for the opportunity.
Stage Select the opportunity stage. For example, Prospecting.
Account Name Search for and select the account that you want to associate with this opportunity.
Optional Fields
Amount Enter the revenue amount for this opportunity.
Next Step Specify any next steps.
Description Enter a brief description.
4. Click Save.
The opportunity record is created.

Create the Master Quote or Order


1. On the Opportunity record page, in the upper right corner, click the drop-down menu.

2. Select Multi-Site Quote or Multi-Site Order.

© 2021 Vlocity LLC, a Salesforce


company 644
CME CPQ

The number of contracted months and the price lists configured at the Opportunity level are
propagated to the master Quote or Order. The pricing totals are stored in the Quote or Order group
object.
In the Fall '19 and Winter '20 releases, the command to create a master Quote is Multi-Service Point.
You cannot create a master Order directly.
3. For a Quote, click Single Quote or Multiple Quotes. For an Order, click Single Order or Multiple
Orders. Then click Next.
In the Fall '19 and Winter '20 releases, you don't see this choice, and the Quote is multiple.

IMPORTANT
If you don't see this choice in Fall '20 or a later release, it means that the choice isn't
configured. See Configure Multi-Site Customizations.

4. To create a new Quote or Order, click New. The master Quote or Order is created without any group
members.
To edit an existing Quote or Order, skip to step 6.

5. Enter a Name for the master Quote or Order. For an Order, enter the Order Start Date in the format
mm/dd/yyyy. Click Save.

NOTE
Master Quote or Order names must be unique.

6. Select the master Quote or Order to which you want to add group members and click Next.

© 2021 Vlocity LLC, a Salesforce


company 645
CME CPQ

Clone a Master Quote or Order


When you clone a master Quote or Order from another master, the underlying group assignments are
copied. Next, you must complete additional steps to configure the group cart, apply the configuration to the
service point quotes in the group, and validate and price the service point quotes manually.

1. Select the master Quote or Order you want to clone and click Clone.
2. Enter a new name for the clone.
3. Click Clone.
The cloned master Quote or Order is displayed.

NOTE
A master Quote or Order that you clone must have a unique name.

4. To create or edit groups for the clone, select it and click Next.

Create Groups
1. Select the tab for the objects to group, for example, Service Points.
Depending on how the Account for the Opportunity is configured, you might see tabs for Service
Accounts, Premises, Subscribers, or other objects.
In the Fall '19 and Winter '20 releases, you only see Service Points.
2. Select the objects to add to a group and click Add to Group.
3. Select an existing group or click Add New Group to create a new group.
a. Enter a Group Name.
b. (Optional) Enter a Group Description.
c. Click Save.
The objects are added to the master Quote or Order within the group you created.

© 2021 Vlocity LLC, a Salesforce


company 646
CME CPQ

For more ways to manage groups and short videos of the steps, see Manage Multi-Site Groups.

What's Next
The next task depends on your single or multiple choice:

• If you chose Single Quote or Single Order, see Validate and Price a Single Quote or Order.
• If you chose Multiple Quote or Multiple Order, see Validate and Price Multiple Quotes or Orders.
In the Fall '19 and Winter '20 releases, this is the only option.

Manage Multi-Site Groups


You can create, add members to, remove members from, delete, search within, and filter groups. You can
also view objects that are not assigned to any group.

To perform any of the following tasks, you must be on the group page of a master Quote or Order. See
Create the Opportunity, Quote or Order Structure, and Groups.

Create a New Group


1. Select the tab for the objects to group, for example, Service Points.

© 2021 Vlocity LLC, a Salesforce


company 647
CME CPQ

Depending on how the Account for the Opportunity is configured, you might see tabs for Accounts,
Premises, Subscribers, or other objects.
In the Fall '19 and Winter '20 releases, you only see Service Points.
2. Select the objects to add to a group and click Add to Group.
3. Click Add New Group.
a. Enter a Group Name.
b. (Optional) Enter a Group Description.
c. Click Save.
The objects are added to the master Quote or Order within the group you created.

TIP
If the new group doesn't appear in the list, click Refresh on your browser window or
click Load More Groups.

4. Next, add members to the group. See Adding Service Points to a Group.

NOTE
You can organize objects into one or more groups. You can't add the same object to
multiple groups in the context of the same Opportunity record.

Add Members to a Group


1. Perform the previous task to create a new group.
2. Select one or more objects to add to the group.
3. Select Add to Group to associate one or more objects to the new group.

© 2021 Vlocity LLC, a Salesforce


company 648
CME CPQ

4. Select the group to which you want to add the objects.


The objects are added to the group.

Remove Members from a Group


1. Perform the previous task to add members to a group. See Adding Service Points to a Group.
2. Select the member you want to remove from the group.
3. Click Remove from Group.
The object is removed from the group and added to the unordered list of objects.

Delete a Group
1. Select one or more groups.
2. Click Delete Group.
3. Click Delete Group in the confirmation window.

Search for Member Objects in a Group


1. Perform the previous task to add members to a group. See Adding Service Points to a Group.
2. Click Filter.
A list of available filters is displayed.

© 2021 Vlocity LLC, a Salesforce


company 649
CME CPQ

NOTE
You can configure the items available in the filters list. The current set of filters is
provided by default.

3. Apply the filters using the available criteria and click Apply Filter.
A list of objects that match your search criteria is displayed.

NOTE
You can also apply filters to grouped objects.

4. (Optional) Slide the Apply Filters on Grouped Items to search for objects that are grouped. A list of
objects that match your search criteria is displayed.
5. Click Clear Filters to start the search again.

Use Filters to View Grouped Members


You can assign objects to groups and configure a Quote or Order for each group.

• Click the Show filter to view objects that are grouped or assigned to a group. Expand each group to view
the members of that group.
• Click the Hide filter to view objects that are ungrouped or not assigned to a group.

View Groups and Ungrouped Objects


The default number of groups or members within groups you can view is set to 20. The default number of
ungrouped service points you can view is set to 30.

• To view more than 20 objects within a group, click Load More.


• To view more than 20 groups, click Load More Groups.
• To view more than 30 ungrouped objects, click Next. To go back to the previous list, click Previous.

© 2021 Vlocity LLC, a Salesforce


company 650
CME CPQ

• To configure the default number of groups, members within groups, or ungrouped objects that display in
Vlocity Cart, see Configure Multi-Site Customizations.

Validate and Price a Single Quote or Order


After you create the master Quote or Order and group the Quote or Order Line Items, you are ready to
select products, validate and price them, and submit the master Quote or Order in Vlocity Cart.

The tasks described here apply if both of the following are true:

• You configured the Apply to Group OmniScript as described in Configure Multi-Site Customizations.
• In the Create the Opportunity, Quote or Order Structure, and Groups task, you chose Single Quote or
Single Order.

These tasks do not apply to the Winter '20 and Fall '19 releases.

Attach Groups to Line Items


To attach groups to line items in the master Quote or Order:

1. From the group page of the master Quote or Order, click Next.
This takes you to Vlocity Cart.
2. Select the Price List for the products.
3. For each product, click Add to Cart next to the product name.

NOTE
You can add more than one product to the cart and configure each product in the cart.

4. Click Previous if you want to go back and reconfigure the groups, then click Next to return to the cart.
5. On each product line item menu, click Attach Group.

© 2021 Vlocity LLC, a Salesforce


company 651
CME CPQ

6. In the Attach Group window, select a group and click Save.


A green bar appears to the left of the line item after the group is successfully attached.

NOTE
If you have a large number of group members, processing may take a while to
complete.

Validate and Price Products


Although there is no explicit validation or pricing step, validation rules run when you attach a group to a line
item. If any validation rules fail, group attachment also fails.

For example, if the maximum quantity for a line item is 10 and the group has 12 members, validation and
group attachment fail.

Submit the Master Quote or Order


To submit the master Quote or Order:

1. For a master Quote, click Create Order. For a master Order, you don't see this step.
2. Click Submit Order.

IMPORTANT
The Create Order and Submit Order buttons are disabled until every line item has an
attached group.

© 2021 Vlocity LLC, a Salesforce


company 652
CME CPQ

3. On the Order Submission Results page, click Next. You are redirected to the Account record page.

What's Next
See View Multi-Site Orders on the Account Record Page for details about viewing the Orders and related
Assets on the Account record page.

Optionally, you can customize the submission process to initiate additional workflows such as, for example,
creating an approval process.

Validate and Price Multiple Quotes or Orders


After you create the master Quote or Order and group the multiple child Quotes or Orders, you can select
products, validate and price them, and submit the Quotes or Orders in the Vlocity Group Cart.

The tasks described here apply if you chose Multiple Quote or Multiple Order in the Create the
Opportunity, Quote or Order Structure, and Groups task.

In the Fall '19 and Winter '20 releases, performing these tasks in the cart is your only option for validation,
pricing, and submission.

Apply Products to Groups


To apply products to groups in the master Quote or Order:

1. From the group page of the master Quote or Order, click Next.
This takes you to the Vlocity Group Cart. The groups you defined are listed in the left pane.
2. Select the group to which to add products.
3. Select the Price List for the products.
4. For each product, click Add to Cart next to the product name.

NOTE
You can add more than one product to the cart and configure each product in the cart.

© 2021 Vlocity LLC, a Salesforce


company 653
CME CPQ

5. Click Apply to Group to copy the products to each group member.


6. Click Apply to Group on the confirmation message window.

NOTE
The products are copied to all the group members. When the processing is complete,
you see individual quotes for each group member. While the batch process is running,
the Price and Validate button in the cart is disabled.

NOTE
If you have a large number of group members, processing may take a while to
complete.

NOTE
Apply to Group is a Vlocity action button that launches the ApplytoGroup OmniScript.
This invokes the MultiServiceApplyToGroupBatch batch processing job, which invokes
the MultiService_ApplyToGroup Integration Procedure.

7. Repeat steps 2 through 6 for each group.

Validate and Price Products


Perform these steps to validate and price the products.

© 2021 Vlocity LLC, a Salesforce


company 654
CME CPQ

1. After applying products to a group, click Validate and Price.


2. Click Validate and Price on the confirmation message window.
This validates and prices each group member.
• A green icon marked Complete appears next to the group when the processing is complete.
• A yellow dash appears on quotes for which the validation and pricing is in progress.
• A red dash appears for quotes with validation errors.

NOTE
Validate and Price is a Vlocity action button that launches the PriceandValidate
OmniScript. This invokes the MultiServicePriceValidateBatch batch processing job
which invokes the following Vlocity Integration Procedure:
MultiService_ApplyToGroup.

3. Repeat these steps for each group.

Submit the Master Quote or Order


Perform these steps to submit the master Quote or Order.

1. After validation and pricing completes for each group, click Create and Submit Orders for Quotes or
Submit Orders for Orders.
2. Click Create and Submit Orders or Submit Orders on the confirmation message window.
After you submit, you are redirected to the Account record page.

IMPORTANT
The Submit button is disabled for the group until the price and validate action is
complete for all members of at least one group.

If you submit before selecting, pricing, and validating products for all groups, only the
completed groups are submitted.

NOTE
The MultiServiceCheckout Action button launches the OmniScript called MultiService/
Checkout. This invokes the Vlocity Batch framework, which invokes the MultiService/
Checkout Integration Procedure. For a master Quote, this creates Orders and
corresponding Assets. For a master Order, this creates only corresponding Assets.

What's Next
See View Multi-Site Orders on the Account Record Page for details about viewing the Orders and related
Assets on the Account record page.

© 2021 Vlocity LLC, a Salesforce


company 655
CME CPQ

Optionally, you can customize the submission process to initiate additional workflows such as, for example,
creating an approval process.

Validate and Price on the Groups Page


After you create the master Quote or Order and group the multiple child Quotes or Orders, you can select
products in the cart, then validate, price, and submit them on the groups page. This saves time and steps
by eliminating the need to validate, price, and submit separately for each group in the cart.

These tasks do not apply to the Winter '20 and Fall '19 releases.

The tasks described here apply if all of the following are true:

• You configured the Apply to Group OmniScript as described in Configure Multi-Site Customizations.
• You set the EnableMultiSiteBulkAction setting to true as described in Configure Multi-Site
Customizations.
• In the Create the Opportunity, Quote or Order Structure, and Groups task, you chose Multiple Quote or
Multiple Order.

Select Products in the Cart


To select products for groups in the master Quote or Order:

1. From the group page of the master Quote or Order, click Next.
This takes you to the Vlocity Group Cart. The groups you defined are listed in the left pane.
2. Select the group to which to add products.
3. Select the Price List for the products.
4. For each product, click Add to Cart next to the product name.

NOTE
You can add more than one product to the cart and configure each product in the cart.

5. Repeat the previous three steps for each group.


6. Click Previous to return to the group page.

Apply Products to Groups


To apply products to groups in the master Quote or Order:

1. On the groups page, click Apply to Group to copy the selected products for each group to each
member of that group.
2. Click Apply to Group on the confirmation message window.

© 2021 Vlocity LLC, a Salesforce


company 656
CME CPQ

NOTE
The products are copied to all the group members. When the processing is complete,
you see individual quotes for each group member. While the batch process is running,
the Validate and Price button in the cart is disabled.

TIP
If you have a large number of groups or members, processing may take a while to
complete.

NOTE
Apply to Group is a Vlocity action button that launches the ApplytoGroup OmniScript.
This invokes the MultiServiceApplyToGroupBatch batch processing job, which invokes
the MultiService_ApplyToGroup Integration Procedure.

Validate and Price Products


To validate and price the products:

1. Click Validate and Price.


2. Click Validate and Price on the confirmation message window.
This validates and prices each group member.
• A green icon marked Complete appears next to the group when the processing is complete.
• A yellow dash appears on quotes for which the validation and pricing is in progress.
• A red dash appears for quotes with validation errors.

NOTE
Validate and Price is a Vlocity action button that launches the PriceandValidate
OmniScript. This invokes the MultiServicePriceValidateBatch batch processing job
which invokes the following Vlocity Integration Procedure:
MultiService_ApplyToGroup.

Submit the Master Quote or Order


To submit the master Quote or Order:

1. After validation and pricing completes for each group, click Create Orders for Quotes or Submit Orders
for Orders.

© 2021 Vlocity LLC, a Salesforce


company 657
CME CPQ

2. Click Create Orders or Submit Orders on the confirmation message window.


After you check out, you are redirected to the Account record page.

IMPORTANT
The Submit button is disabled for the group until the validate and price action is
complete for all members of each group.

NOTE
The MultiServiceCheckout Action button launches the OmniScript called MultiService/
Checkout. This invokes the Vlocity Batch framework, which invokes the MultiService/
Checkout Integration Procedure. For a master Quote, this creates Orders and
corresponding Assets. For a master Order, this creates only corresponding Assets.

What's Next
See View Multi-Site Orders on the Account Record Page for details about viewing the Orders and related
Assets on the Account record page.

Optionally, you can customize the check-out process to initiate additional workflows such as, for example,
creating an approval process.

View Multi-Site Orders on the Account Record Page


After you create and submit a master Order, you can view the Orders and related Assets on the record
page of the Account associated with the original Opportunity.

To view the Orders:

1. In the Account record page, scroll to the Orders section to view a list of new Orders generated in the
Multi-Site process.
You will see either a single master Order or a list of Orders that includes the master and children.
2. Scroll to the Asset Management section to view a list of related Assets that are generated after the
Orders are created.

View Record Types


The record types for an Order indicate whether it's a Multi-Site master, group, or child:

• If the Order Record Type is Standard Order, it's a single Order with no children
• If the Order Record Type is Group Cart, it's a Multi-Site group Cart
• If the Order Record Type is Master Order, it's a Multi-Site master
• If the Order Record Type is Sub Order, it's a Multi-Site child

Likewise, the Quote Record Type indicates whether a Quote is a standard, group, master, or child Quote.

© 2021 Vlocity LLC, a Salesforce


company 658
CME CPQ

Add an Order Record Type Column to the Order Related List for Accounts
1. In Lightning Experience, go to Setup, then click Object Manager.
2. In the Quick Find box, type account, then click Account in the object list.
3. Click Page Layouts. Select Edit for the layout for which you want to edit the Order Related List.
4. In the upper-left box, click Related Lists.
5. Scroll to Orders under Related Lists, and click the wrench icon to edit the Related List Properties.
The Related List Properties window appears.
6. In the Available Fields list, select Order Record Type, then click the Add button.

7. Click OK to close the Related List Properties window.


8. In the upper-left corner of the layout editor, click Save.
9. Refresh the Account record page and look at the Orders section. The Order Record Type column is
included.

© 2021 Vlocity LLC, a Salesforce


company 659
CME CPQ

Configure Quantity Rollup Lists


If the page layout for the Quote or Order object includes the Quote Product Rollups or Order Product
Rollups related list, you can view the total quantity and price for each product on the master Quote or Order
record page.

To edit the Quote or Order page layout:

1. In Lightning Experience, go to Setup, then click Object Manager.


2. In the Quick Find box, type quote or order, then click Quote or Order in the object list.
3. Click Page Layouts. Select Edit for the layout to which you want to add the Product Rollups list.
4. In the upper-left box, click Related Lists.
5. Drag the Quote Product Rollups or Order Product Rollups item from the field list at the top to the
Related Lists section in the page if it isn't already there.

© 2021 Vlocity LLC, a Salesforce


company 660
CME CPQ

6. Click Save.
7. Click Page Layouts again.
8. Click Page Layout Assignment, then click Edit Assignment.
9. Select the rows for the profiles to which to assign the layout you just edited.
10. Select the layout you just edited from the Page Layout to Use drop-down.

© 2021 Vlocity LLC, a Salesforce


company 661
CME CPQ

11. Click Save.

Results
When you view a master Quote or Order record page, the Quote Product Rollups or Order Product Rollups
related list looks something like this:

© 2021 Vlocity LLC, a Salesforce


company 662
CME CPQ

Order Management Integration

You can configure how Vlocity CPQ interacts with external (non-Vlocity OM) order management systems.

Sample payloads and known responses such as notification payloads, reason codes, state values, and so
on, are included. Also described is how you can extend or inject and define your own implementation for
integrations in the event the Vlocity default payload formats are not sufficient or you must build different
transport methods for integration.

The Order Management Integration Layer exposes an interface that can accept notifications from order
management systems.

Invoking the Order Management Integration Layer


You can invoke the Order Management Integration Layer in either of two ways: through APEX code or
through a REST API call.

Invoking Using APEX


Use the Apex global class to invoke Order Management Integration Layer:

vlocity_cmt.OdinService.notify(List<Object> notificationList)

Invoking Using REST API


REST Endpoint to invoke Order Management Integration Layer for OM+ and other third-party order
management systems

POST
/odin/v1/notifications

Notification Types
Order Management Integration Layer accepts the following notification types:

• Submit Order Notifications:


• Submit Order Accepted
• Submit Order Provisionally Accepted
• Order Rejected
• Order-Level Notifications:
• Order Accepted
• Order Activated
• Order In Progress
• Order Queued
• Order Rejected
• Order Item-Level Notifications:
• OrderItem Accepted

© 2021 Vlocity LLC, a Salesforce


company 663
CME CPQ

• OrderItem Activated
• OrderItem Assetized
• OrderItem In Progress
• OrderItem Rejected

DataRaptor Setup for Order Management Integration Layer


Order Management Integration Layer requires the OrderBackSync and OrderItemBackSync DataRaptors to
update order records.

These DataRaptors:

• Map fields from incoming messages to order record or order item record fields.
• Support custom field names and dot notation.
Dot-notation example: Account.PrimaryContactId__r.IsPartner__c will allow you to update a
contact's field from an order.

TIP
DataRaptors can negatively impact performance because of additional DML and SOQL
transactions. If you know the field names that need to be updated and those fields are not
a lookup to a related record, then you can send the field names and their values in the
fields and specify the updateMethod to be directfieldupdate. This slightly improves
performance by avoiding DataRaptor-related DML and SOQL transactions.

Order-Level Notification
Order-level notification messages contain sections that update order record fields. To perform updates,
Order Management Integration Layer requires a DataRaptor named OrderBackSync, which will map the
fields in the incoming notification messages to the corresponding order record fields.

OrderBackSync is invoked by the following types of order-level notifications:

• Order Accepted
• Order Activated
• Order In Progress
• Order Queued
• Order Rejected

Order Item-Level Notification


OrderItem-level notification messages contain sections that update fields and attributes. For field updates,
Order Management Integration Layer requires a DataRaptor named OrderItemBackSync, which will map
the fields in the incoming notification message to the corresponding order item record fields.

© 2021 Vlocity LLC, a Salesforce


company 664
CME CPQ

OrderItemBackSync is invoked by the following types of order item-level notifications:

• OrderItem Accepted
• OrderItem Activated
• OrderItem Assetized
• OrderItem In Progress
• OrderItem Rejected

Notification Examples
Order Management Integration Layer can send field updates for the following notifications. When the fields
container is included in a notification, the corresponding DataRaptor is invoked: OrderBackSync or
OrderItemBackSync.

Order Activated
Order Management Integration Layer sends this notification when the order management system fulfills
orders that are an original order or a supplemental order. The order management system sends this
notification to CPQ when the order is activated. The optional fields parameter can contain any data that
must be set in order fields.

For example, the following Order Activated notification includes a fields section that contains a list of fields
to update in the order record. It will call the OrderBackSync DataRaptor by default.

[
{
"orderId": "8011U000000Tq5l",
"state": "Activated",
"fields": {
"vlocity_cmt__JeopardyStatus__c": "Green"
}
}
]

Order Activated notification including the meta parameter and updateMethod:

[
{
"orderId": "8011U000000Tq5l",
"state": "Activated",
"fields": {
"meta": {
"updateMethod": "directfieldupdate"
},
"vlocity_cmt__JeopardyStatus__c": "Green"
}
}
]

© 2021 Vlocity LLC, a Salesforce


company 665
CME CPQ

The fields parameter supports the meta parameter and its updateMethod, which can have the
following values:

• dataraptor (the default): Order Management Integration Layer calls the DataRaptor for the object.
• directfieldupdate: Order Management Integration Layer collects the values of all the fields in the
fields section and sets them in the the SObject for which the notification is sent. If the field name that
comes in the notification does not exist on the sObject (Order or OrderItem), then that field is skipped.
Order Management Integration Layer also skips field names with dot notations. This will set the field
names and values exactly as they appear in the notification. The directfieldupdate value supports
field names with and without a specified namespace.

NOTICE
All Order Management Integration Layer notifications support updateMethod and its
directfieldupdate value, including order-level and order-item-level notifications.

You can use Apex code for invoking the Order Activated notification, as shown in the following sample:

Map<String, Object> orderInputMap =


(Map<String, Object>)
JSON.deserializeUntyped('{\"orderId\": \"8013i000000qvWhAAI\",
\"state\": \"Activated\",\"fields\": {\"JeopardyStatus__c\": \"Green\"}}');
OdinService.notify(new List<Object> { orderInputMap });

OrderItem Activated
Order Management Integration Layer sends the OrderItem Activated notification when the order
management system fulfills order items that are part of either an original order or a supplemental order. The
order management system sends this notification to CPQ when the order item is activated.

The optional fields parameter in the notification message can contain any data that must be set in the order
item fields.

The optional describedBy container can contain any data that must be set to attributes of an order item.
Any attribute that is set is copied to the asset.

[
{
"orderItemId": "8021U000000hv6T",
"state": "Activated",
"fields": {
"vlocity_cmt__DueDate__c": "2019-10-01T10:00:23+10:00",
"vlocity_cmt__JeopardyStatus__c": "Green"
},

© 2021 Vlocity LLC, a Salesforce


company 666
CME CPQ

"describedBy": {
"IMSI": "00000000",
"MSISDN": "61456273222"
}
}
]

Sample Apex code example for invoking the OrderItem Activated notification:

Map<String, Object> orderItem1InputMap = (Map<String, Object>)


JSON.deserializeUntyped('{\"orderItemId\": \"8023i000000qpqn\",\"state":
\"Activated\",\"fields\": {\"DueDate__c\":
\"2019-10-01T10:00:23+10:00\",\"JeopardyStatus__c\": \"Green\"},\"describedBy
\": {\"IMSI\": \"00000000\",\"MSISDN\": \"61456273222\"}}');
OdinService.notify(new List<Object> { orderItem1InputMap });

IMPORTANT
When the OrderItem Activated notification is received, Order Management Integration
Layer updates the fields and attributes for the order item for which the notification is sent. It
also marks the order item and its children (if any) as Activated. This notification does not
create an asset.

Submit Order Rejected


An Order Rejected response is returned when a submitted order cannot be fulfilled by an order
management system. The response may or may not contain a fields section, as shown in the following
examples.

With fields:

[
// Supplemental Order Item rejected
{
"orderItemId": "8021U000000hv6T",
"state": "Rejected",
"reasonCode": "PONR",
"reasonDescription": "Point of Non Return is reached"
"fields" :
{
"CustomName__c": "IphoneX125",
"Memory__c": "125GB"
}
},

© 2021 Vlocity LLC, a Salesforce


company 667
CME CPQ

// Supplemental Order rejected


{
"orderId": "8011U000000Tq5l",
"state": "Rejected",
"reasonCode": "PONR",
"reasonDescription": "Point of Non Return is reached"
"fields" :
{
"DueDate__c": "2020-08-28T02:42:19.861Z",
"ThorJeopardyStatus__c": "Green"
}
}
]

Without fields:

[
// Supplemental Order Item rejected
{
"orderItemId": "8021U000000hv6T",
"state": "Rejected",
"reasonCode": "PONR",
"reasonDescription": "Point of Non Return is reached"
},
// Supplemental Order rejected
{
"orderId": "8011U000000Tq5l",
"state": "Rejected",
"reasonCode": "PONR",
"reasonDescription": "Point of Non Return is reached"
}
]

Order Rejected
This notification is sent when a supplemental order is created and submitted. The order management
system processes the fulfillment of the supplemental order.

During fulfillment, the order management system might determine that it cannot proceed with the
supplemental order. In such cases, it sends a notification message to CPQ that the supplemental order is
Rejected.

Similar to the Order Activated notification message, an optional fields container is included allowing the
order management system to pass any values for any of the Order fields.

[
{
"orderId": "8011U000000Tq5l",

© 2021 Vlocity LLC, a Salesforce


company 668
CME CPQ

"state": "Rejected",
"reasonCode": "PONR",
"reasonDescription": "Point of Non Return is reached"
}
]

The following Apex code example shows how to invoke the Order Rejected notification:

Map<String, Object> orderInputMap = (Map<String, Object>)


JSON.deserializeUntyped('{\"orderId\": \"8013i000000qvWhAAI\",\"state\":
\"Rejected\",\"fields\": {\"JeopardyStatus__c\": \"Green\"}}');
OdinService.notify(new List<Object> { orderInputMap });

OrderItem Rejected
This notification is sent when a supplemental order is created and submitted and the order management
system processes the fulfillment of the supplemental order. During fulfillment, the order management
system might determine that a certain order item in the supplemental order cannot be processed. In such
cases, it sends a notification message to CPQ that the order item in the supplemental order is rejected.

You can optionally include the OrderItem Rejected notification in the Order Rejected payload.

The response can contain optional fields and a describedBy container.

[
{
"orderItemId": "8021U000000hv6T",
"state": "Rejected",
"reasonCode": "PONR",
"reasonDescription": "Point of Non Return is reached"
}
]

The following Apex code example shows how to invoke the OrderItem Rejected notification:

Map<String, Object> orderItem1InputMap = (Map<String, Object>)


JSON.deserializeUntyped('{\"orderItemId\": \"8023i000000qpqn\",\"state":
\"Rejected\",\"fields\": {\"DueDate__c\":
\"2019-10-01T10:00:23+10:00\",\"JeopardyStatus__c\": \"Green\"},\"describedBy
\": {\"IMSI\": \"00000000\",\"MSISDN\": \"61456273222\"}}');
OdinService.notify(new List<Object> { orderItem1InputMap });

Submit Order Accepted


A Submit Order Accepted response occurs when a submitted order can be fulfilled by an order
management system. The response may or may not contain a fields section, as shown in the following
examples.

With fields:

© 2021 Vlocity LLC, a Salesforce


company 669
CME CPQ

[
{
"orderId": "8011U000000Tq5l",
"state": "Accepted",
"fields" :
{
"DueDate__c": "2020-08-28T02:42:19.861Z",
"ThorJeopardyStatus__c": "Green"
}
}
]

Without fields:

[
{
"orderId": "8011U000000Tq5l",
"state": "Accepted",
}
]

Submit Order Provisionally Accepted


A Submit Order Provisionally Accepted response typically occurs when a supplemental order is submitted
to an order management system and that system needs time to determine if the changes requested in a
supplemental order can be fulfilled. The response may or may not contain a fields section, as shown in
the following examples.

With fields:

[
// Supplemental Order Item accepted
{
"orderItemId": "8021U000000hv6T",
"state": "Provisionally Accepted",
"fields" :
{
"CustomName__c": "IphoneX125",
"Memory__c": "125GB"
}
},
// Supplemental Order accepted
{
"orderId": "8011U000000Tq5l",
"state": "Provisionally Accepted",
"fields" :
{
"DueDate__c": "2020-08-28T02:42:19.861Z",

© 2021 Vlocity LLC, a Salesforce


company 670
CME CPQ

"ThorJeopardyStatus__c":"Green"
}
}
]

Without fields:

[
// Supplemental Order Item accepted
{
"orderItemId": "8021U000000hv6T",
"state": "Provisionally Accepted",
},
// Supplemental Order accepted
{
"orderId": "8011U000000Tq5l",
"state": "Provisionally Accepted",
}
]

Order Accepted
This notification is sent when a supplemental order is created and submitted, and the order management
system processes the fulfillment of the supplemental order. During fulfillment, the order management
system might determine that the supplemental order can be successfully processed The previous order
was successfully frozen and the supplemental order is now being fulfilled. In such cases, the order
management system sends an Order Accepted notification message.

The optional fields container stores any data that must be updated to the Order record.

[
{
"orderId": "8011U000000Tq0H",
"state": "Accepted"
}
]

The following Apex code example shows how to invoke the Order Accepted notification:

Map<String, Object> orderInputMap = (Map<String, Object>)


JSON.deserializeUntyped('{\"orderId\": \"8013i000000qvWhAAI\",\"state\":
\"Accepted\",\"fields\": {\"JeopardyStatus__c\": \"Green\"}}');
OdinService.notify(new List<Object> { orderInputMap });

OrderItem Accepted
This notification is sent when a supplemental order is created and submitted, and the order management
system processes the fulfillment of the supplemental order. During fulfillment, the order management
system might determine that a particular order item can successfully supersede an order item from a
previous order. In such cases, the order management system sends the OrderItem Accepted notification.

© 2021 Vlocity LLC, a Salesforce


company 671
CME CPQ

You can optionally include the OrderItem Accepted notification in the Order Accepted payload.

The notification message may optionally contain fields and describedBy containers. The fields container
contains any data that must be updated in the OrderItem record.

The describedBy container stores any data that must be updated in the OrderItem.

[
{
"orderItemId": "8011U000000Tq0H",
"state": "Accepted"
}
]

Sample Apex code for invoking the OrderItem Accepted notification:

Map<String, Object> orderItem1InputMap = (Map<String, Object>)


JSON.deserializeUntyped('{\"orderItemId\": \"8023i000000qpqn\",\"state":
\"Accepted\",\"fields\": {\"DueDate__c\":
\"2019-10-01T10:00:23+10:00\",\"JeopardyStatus__c\": \"Green\"},\"describedBy
\": {\"IMSI\": \"00000000\",\"MSISDN\": \"61456273222\"}}');
OdinService.notify(new List<Object> { orderItem1InputMap });

Order In Progress
This notification is sent when an order is created and submitted to the order management system. The
order management system might send the Order In Progress notification message when processing the
order. It can also send the fields container in the notification message, which contains any data that must
be updated in the order record.

[
{
"orderId": "8021U000000hv6T",
"state": "In Progress",
"PONR": true,
"fields": {
"meta": {
"updateMethod": "directfieldupdate"
},
"vlocity_cmt__JeopardyStatus__c": "Green"
}
}
]

Sample Apex code for invoking the Order In Progress notification:

Map<String, Object> orderInputMap = (Map<String, Object>)


JSON.deserializeUntyped('{\"orderId\": \"8013i000000qvWhAAI\",\"state\":

© 2021 Vlocity LLC, a Salesforce


company 672
CME CPQ

\"Rejected\",\"fields\": {\"JeopardyStatus__c\": \"Green\"}}');


OdinService.notify(new List<Object> { orderInputMap });

OrderItem In Progress
This notification is sent when an order is created and submitted to the order management system. During
the processing of the order, the order management system might send the OrderItem In Progress
notification message. It can send fields or describedBy container in the notification message. The fields
container can contain any data that must be updated in the order item record. The describedBy container
may contain data that must be updated to attributes of the order item.

[
{
"orderItemId": "8021U000000hv6T",
"state": "In Progress",
"PONR": true,
"fields": {
"meta": {
"updateMethod": "dataraptor"
},
"vlocity_cmt__DueDate__c": "2019-10-01T10:00:23+10:00",
"vlocity_cmt__JeopardyStatus__c": "Green"
},
"describedBy": {
"IMSI": "00000000",
"MSISDN": "61456273222"
}
}
]

Sample Apex code for invoking the OrderItem In Progress notification:

Map<String, Object> orderItem1InputMap = (Map<String, Object>)


JSON.deserializeUntyped('{\"orderItemId\": \"8023i000000qpqn\",\"state": \"In
Progress\",\"fields\": {\"DueDate__c\":
\"2019-10-01T10:00:23+10:00\",\"JeopardyStatus__c\": \"Green\"},\"describedBy
\": {\"IMSI\": \"00000000\",\"MSISDN\": \"61456273222\"}}');
OdinService.notify(new List<Object> { orderItem1InputMap });

OrderItem Assetized
When the order management system is instructed to create an asset before the order item is fulfilled, the
OrderItem Asset notification is called. The notification can send fields or describedBy container in the
notification message. The fields container may contain any data that must be updated in the OrderItem
record. The describedBy container may contain data that muat be updated to attributes of the order item.

[
{
"orderItemId": "8021U000000hv6T",

© 2021 Vlocity LLC, a Salesforce


company 673
CME CPQ

"state": "Assetize",
"fields": {
"vlocity_cmt__DueDate__c": "2019-10-01T10:00:23+10:00",
"vlocity_cmt__JeopardyStatus__c": "Green"
},
"describedBy": {
"IMSI": "00000000",
"MSISDN": "61456273222"
}
}
]

Sample Apex code for invoking the Order Assetized notification:

Map<String, Object> orderItem1InputMap = (Map<String, Object>)


JSON.deserializeUntyped('{\"orderItemId\": \"8023i000000qpqn\",\"state":
\"Assetize\",\"fields\": {\"DueDate__c\":
\"2019-10-01T10:00:23+10:00\",\"JeopardyStatus__c\": \"Green\"},\"describedBy
\": {\"IMSI\": \"00000000\",\"MSISDN\":
\"61456273222\"}}'); OdinService.notify(new List<Object> {orderItem1InputMap});

Order Queued
The order management system sends this notification when the order is queued. The notification message
can optionally contain the fields container. The fields container contains any data that must be updated in
the order record.

[
{
"orderId": "8111U000000Tq6G",
"state": "Queued"
}
]

Sample Apex code for invoking the Order Queued notification:

Map<String, Object> orderInputMap = (Map<String, Object>)


JSON.deserializeUntyped('{\"orderId\": \"8111U000000Tq6G\",\"state\": \"Queued
\",\"fields\": {\"JeopardyStatus__c\": \"Green\"}}');
OdinService.notify(new List<Object> { orderInputMap });

See Also
DataRaptor Setup for Order Management Integration Layer

Order Management Integration Layer Messages Initiated by CPQ


Order Management Integration Layer responds to certain messages sent by Vlocity CPQ to the order
management system.

© 2021 Vlocity LLC, a Salesforce


company 674
CME CPQ

• Submit Order Request


• Freeze Order Request
• Unfreeze Order Request

These are synchronous requests and responses.

Submit Order Request


If the order management system requires more details than those available in the order, Order
Management Integration Layer provides a way to query for details such as the order header record and
order product records.

Sample Submit Order Request


{
"orders": [
{
"supplementalAction": null,
"supersededOrderId": null,
"orderStatus": "Ready To Submit",
"orderReferenceNumber": null,
"orderPricings": [
{
"subAction": null,
"source": "Promotion",
"sequence": 2001,
"requestDate": null,
"pricingVariable": {
"code": "OT_STD_PRC_ADJ_PCT"
},
"pricingElement": {
"globalKey": "1eacf022-0648-1dd3-272e-986a120c58ea"
},
"orderItemId": "8024R000000p73zQAA",
"orderAppliedPromotionId": "a364R000001lEPIQA2",
"name": "a3D4R000000rNUh",
"fulfilmentStatus": null,
"fields": null,
"estimatedStartDate": null,
"estimatedEndDate": null,
"appliesTo": null,
"amount": null,
"adjustmentValue": -20.00,
"action": "Add"
},
{
"subAction": null,

© 2021 Vlocity LLC, a Salesforce


company 675
CME CPQ

"source": "Promotion",
"sequence": 2001,
"requestDate": null,
"pricingVariable": {
"code": "REC_MNTH_STD_PRC_ADJ_PCT"
},
"pricingElement": {
"globalKey": "fbef14ff-6f91-bfc8-6eb7-eac71b0af37b"
},
"orderItemId": "8024R000000p73zQAA",
"orderAppliedPromotionId": "a364R000001lEPIQA2",
"name": "a3D4R000000rNUi",
"fulfilmentStatus": null,
"fields": null,
"estimatedStartDate": null,
"estimatedEndDate": null,
"appliesTo": null,
"amount": null,
"adjustmentValue": -20.00,
"action": "Add"
},
{
"subAction": null,
"source": "Discount",
"sequence": 4001,
"requestDate": null,
"pricingVariable": {
"code": "REC_MNTH_STD_PRC_ADJ_PCT"
},
"pricingElement": null,
"orderItemId": "8024R000000p73uQAA",
"orderAppliedPromotionId": "a364R000001lEPNQA2",
"name": "edbcc744-67c4-d775-842e-60e384aa4eb1",
"fulfilmentStatus": null,
"fields": null,
"estimatedStartDate": null,
"estimatedEndDate": null,
"appliesTo": null,
"amount": null,
"adjustmentValue": -10.00,
"action": "Add"
},
{
"subAction": null,
"source": "Discount",
"sequence": 4001,

© 2021 Vlocity LLC, a Salesforce


company 676
CME CPQ

"requestDate": null,
"pricingVariable": {
"code": "OT_STD_PRC_ADJ_PCT"
},
"pricingElement": null,
"orderItemId": "8024R000000p73uQAA",
"orderAppliedPromotionId": "a364R000001lEPNQA2",
"name": "edbcc744-67c4-d775-842e-60e384aa4eb1",
"fulfilmentStatus": null,
"fields": null,
"estimatedStartDate": null,
"estimatedEndDate": null,
"appliesTo": null,
"amount": null,
"adjustmentValue": -10.00,
"action": "Add"
},
{
"subAction": null,
"source": "Agent",
"sequence": 3001,
"requestDate": null,
"pricingVariable": {
"code": "REC_MNTH_STD_PRC_ADJ_ABS"
},
"pricingElement": null,
"orderItemId": "8024R000000p73vQAA",
"orderAppliedPromotionId": null,
"name": "a3D4R000000rNUr",
"fulfilmentStatus": null,
"fields": null,
"estimatedStartDate": null,
"estimatedEndDate": null,
"appliesTo": null,
"amount": null,
"adjustmentValue": -2.00,
"action": "Add"
}
],
"orderItems": [
{
"supplementalAction": null,
"supersededOrderItemId": null,
"subAction": "Reassign",
"specifiedBy": {
"productName": "OdinTel Broadband Connection",

© 2021 Vlocity LLC, a Salesforce


company 677
CME CPQ

"globalKey": "d2f3674e-4fa3-ebb3-a2e3-fe23f596ac44"
},
"serviceAccountName": "OdinCustomer",
"serviceAccountId": "0014R00002gbHwTQAU",
"quantity": 1.00,
"previousSupplementalAction": null,
"orderItemId": "8024R000000p73qQAA",
"orderId": "8014R000000AQGrQAO",
"lineNumber": "0001.0001",
"isFreshCancellation": false,
"fulfilmentStatus": null,
"firstVersionOrderItemId": null,
"fields": {
"Order.Account.Name": "OdinCustomer"
},
"describedBy": null,
"billingAccountName": "OdinCustomer",
"billingAccountId": "0014R00002gbHwTQAU",
"assetReferenceId": "9da4740e-2cd8-321b-e03f-79845954ed5b",
"action": "Disconnect"
},
{
"supplementalAction": null,
"supersededOrderItemId": null,
"subAction": "Reassign",
"specifiedBy": {
"productName": "OdinTel provided NetGear Wifi Router",
"globalKey": "7352c8a7-24c5-6a1c-c3ed-806cffa59367"
},
"serviceAccountName": "OdinCustomer",
"serviceAccountId": "0014R00002gbHwTQAU",
"quantity": 1.00,
"previousSupplementalAction": null,
"orderItemId": "8024R000000p73rQAA",
"orderId": "8014R000000AQGrQAO",
"lineNumber": "0001.0002",
"isFreshCancellation": false,
"fulfilmentStatus": null,
"firstVersionOrderItemId": null,
"fields": {
"Order.Account.Name": "OdinCustomer"
},
"describedBy": null,
"billingAccountName": "OdinCustomer",
"billingAccountId": "0014R00002gbHwTQAU",
"assetReferenceId": "4381eba6-e5f5-55a9-3d56-36ce3eded59f",

© 2021 Vlocity LLC, a Salesforce


company 678
CME CPQ

"action": "Disconnect"
},
{
"supplementalAction": null,
"supersededOrderItemId": null,
"subAction": "Replace",
"specifiedBy": {
"productName": "OdinTel Student Internet Offer",
"globalKey": "447e4627-925d-5279-6973-1532a8a01cc4"
},
"serviceAccountName": "OdinCustomer",
"serviceAccountId": "0014R00002gbHwTQAU",
"quantity": 1.00,
"previousSupplementalAction": null,
"orderItemId": "8024R000000p73pQAA",
"orderId": "8014R000000AQGrQAO",
"lineNumber": "0001",
"isFreshCancellation": false,
"fulfilmentStatus": null,
"firstVersionOrderItemId": null,
"fields": {
"Order.Account.Name": "OdinCustomer"
},
"describedBy": null,
"billingAccountName": "OdinCustomer",
"billingAccountId": "0014R00002gbHwTQAU",
"assetReferenceId": "41b97b5c-2382-1a45-563c-409e08b4402a",
"action": "Disconnect"
},
{
"supplementalAction": null,
"supersededOrderItemId": null,
"subAction": "Replace",
"specifiedBy": {
"productName": "OdinTel Internet Offer",
"globalKey": "afb2cc8b-d89b-50d3-6c5d-b08924f0aee0"
},
"serviceAccountName": "OdinCustomer",
"serviceAccountId": "0014R00002gbHwTQAU",
"quantity": 1.00,
"previousSupplementalAction": null,
"orderItemId": "8024R000000p73uQAA",
"orderId": "8014R000000AQGrQAO",
"lineNumber": "0002",
"isFreshCancellation": false,
"fulfilmentStatus": null,

© 2021 Vlocity LLC, a Salesforce


company 679
CME CPQ

"firstVersionOrderItemId": null,
"fields": {
"Order.Account.Name": "OdinCustomer"
},
"describedBy": null,
"billingAccountName": "OdinCustomer",
"billingAccountId": "0014R00002gbHwTQAU",
"assetReferenceId": "ba32e205-ed5c-3a81-7262-b5e865fa9475",
"action": "Add"
},
{
"supplementalAction": null,
"supersededOrderItemId": null,
"subAction": "Reassign",
"specifiedBy": {
"productName": "OdinTel Broadband Connection",
"globalKey": "d2f3674e-4fa3-ebb3-a2e3-fe23f596ac44"
},
"serviceAccountName": "OdinCustomer",
"serviceAccountId": "0014R00002gbHwTQAU",
"quantity": 1.00,
"previousSupplementalAction": null,
"orderItemId": "8024R000000p73vQAA",
"orderId": "8014R000000AQGrQAO",
"lineNumber": "0002.0001",
"isFreshCancellation": false,
"fulfilmentStatus": null,
"firstVersionOrderItemId": null,
"fields": {
"Order.Account.Name": "OdinCustomer"
},
"describedBy": null,
"billingAccountName": "OdinCustomer",
"billingAccountId": "0014R00002gbHwTQAU",
"assetReferenceId": "0d31567b-68eb-e244-52b0-e5fbd87cf086",
"action": "Add"
},
{
"supplementalAction": null,
"supersededOrderItemId": null,
"subAction": "Reassign",
"specifiedBy": {
"productName": "OdinTel provided NetGear Wifi Router",
"globalKey": "7352c8a7-24c5-6a1c-c3ed-806cffa59367"
},
"serviceAccountName": "OdinCustomer",

© 2021 Vlocity LLC, a Salesforce


company 680
CME CPQ

"serviceAccountId": "0014R00002gbHwTQAU",
"quantity": 1.00,
"previousSupplementalAction": null,
"orderItemId": "8024R000000p73wQAA",
"orderId": "8014R000000AQGrQAO",
"lineNumber": "0002.0002",
"isFreshCancellation": false,
"fulfilmentStatus": null,
"firstVersionOrderItemId": null,
"fields": {
"Order.Account.Name": "OdinCustomer"
},
"describedBy": null,
"billingAccountName": "OdinCustomer",
"billingAccountId": "0014R00002gbHwTQAU",
"assetReferenceId": "a15fa8bd-9793-9c03-ff09-0f7544498247",
"action": "Add"
},
{
"supplementalAction": null,
"supersededOrderItemId": null,
"subAction": null,
"specifiedBy": {
"productName": "OdinTel 4g Data",
"globalKey": "5de352ac-8764-2666-7cb9-bdf234421b6a"
},
"serviceAccountName": "OdinCustomer",
"serviceAccountId": "0014R00002gbHwTQAU",
"quantity": 1.00,
"previousSupplementalAction": null,
"orderItemId": "8024R000000p73zQAA",
"orderId": "8014R000000AQGrQAO",
"lineNumber": "0003",
"isFreshCancellation": false,
"fulfilmentStatus": null,
"firstVersionOrderItemId": null,
"fields": {
"Order.Account.Name": "OdinCustomer"
},
"describedBy": null,
"billingAccountName": "OdinCustomer",
"billingAccountId": "0014R00002gbHwTQAU",
"assetReferenceId": "674e2819-89f3-218a-215c-604b823142c7",
"action": "Add"
}
],

© 2021 Vlocity LLC, a Salesforce


company 681
CME CPQ

"orderItemRelationships": [
{
"relationshipType": "Replacement",
"relatedOrderItemId": "8024R000000p73pQAA",
"relatedAssetReferenceId": null,
"productRelationshipIdentifier": null,
"orderItemId": "8024R000000p73uQAA",
"orderId": "8014R000000AQGrQAO",
"action": null
},
{
"relationshipType": "Reassignment",
"relatedOrderItemId": "8024R000000p73qQAA",
"relatedAssetReferenceId": null,
"productRelationshipIdentifier": null,
"orderItemId": "8024R000000p73vQAA",
"orderId": "8014R000000AQGrQAO",
"action": null
},
{
"relationshipType": "Reassignment",
"relatedOrderItemId": "8024R000000p73rQAA",
"relatedAssetReferenceId": null,
"productRelationshipIdentifier": null,
"orderItemId": "8024R000000p73wQAA",
"orderId": "8014R000000AQGrQAO",
"action": null
}
],
"orderId": "8014R000000AQGrQAO",
"orderAppliedPromotions": [
{
"subAction": null,
"sequence": null,
"requestDate": null,
"reasonForCancellation": null,
"promotionDefinition": {
"globalKey": "b657f2d7-0c35-6ea5-730c-6cce9ed2b809"
},
"pricingStartDate": null,
"pricingEndDate": null,
"name": "a364R000001lEPI",
"fulfilmentStatus": null,
"fields": null,
"discount": {

© 2021 Vlocity LLC, a Salesforce


company 682
CME CPQ

},
"commitmentStartDate": null,
"commitmentEndDate": null,
"appliesTo": null,
"action": "Add"
},
{
"subAction": null,
"sequence": null,
"requestDate": null,
"reasonForCancellation": null,
"promotionDefinition": null,
"pricingStartDate": null,
"pricingEndDate": null,
"name": "edbcc744-67c4-d775-842e-60e384aa4eb1",
"fulfilmentStatus": null,
"fields": null,
"discount": {
"id": "a394R000000rcVlQAI",
"source": "OrderDiscount__c",
"referenceNumber": "edbcc744-67c4-d775-842e-60e384aa4eb1"
},
"commitmentStartDate": null,
"commitmentEndDate": null,
"appliesTo": null,
"action": "Add"
}
],
"isActiveOrderVersion": false,
"fulfilmentStatus": null,
"firstVersionOrderId": null,
"fields": {
"Account.Name": "OdinCustomer"
},
"accountName": "OdinCustomer",
"accountId": "0014R00002gbHwTQAU"
}
]
}

Sample Order Request


String methodName = 'queryOrders';
Id orderId = '8014R000000AQGrQAO';

Map<String, List<String>> additionalFieldsList = new Map <String,

© 2021 Vlocity LLC, a Salesforce


company 683
CME CPQ

List<String>> {
'Order' => new List<String> {
'Account.Name'
},
'OrderItem' => new List<String> {
'Order.Account.Name'
}
};

Map<String, Object> inputs = new Map<String, Object> {


'orderIdList' => new List<Id> {
orderId
},
'sObjTypeToAdditionalFieldsMap' => additionalFieldsList
};

Map<String, Object> output = new Map<String, Object> ();


Map<String, Object> options = new Map<String, Object> ();

vlocity_cmt.OdinAppHandler handler = new vlocity_cmt.OdinAppHandler();


handler.invokeMethod(methodName, inputs, output, options);
vlocity_cmt.VlocitySubmitOrderRequest orderRequest =
(vlocity_cmt.VlocitySubmitOrderRequest) output.get('orderRequest');

System.debug(orderRequest.serialize());

Order Request Fields

Table 99. Order Request Fields


Field Name Name in Interface Datatype Values
Account.Name accountName String String
AccountId accountId ID Salesforce ID
EffectiveDate effectiveDate Date
Name name String The name of the object
Pricebook2Id pricebookId ID Salesforce ID
RecordType.Name recordTypeName String Names of Order's Record Types
RecordTypeId recordTypeId ID Salesforce ID
Salesforce fields required for the order fields The These fields are defined in Salesforce,
management system's order processing. datatype not by Vlocity.
Example: depends
You can implement a hook for such fields. fields.key1: value1 on the
field being
fields.key2: value2 queried.
vlocity_cmt__DefaultServiceAccountId__c serviceAccountId ID Salesforce ID

© 2021 Vlocity LLC, a Salesforce


company 684
CME CPQ

Field Name Name in Interface Datatype Values


vlocity_cmt__FirstVersionOrderIdentifier__c firstVersionOrderId String The value of the
FirstVersionOrderIdentifier__c field

If the value is null or equal to the ID field,


it is an original order.

For CME Winter '20 and later releases,


the Supplemental Action field will have a
value of null for Follow-On.

If it is a supplemental order, it will have


the ID of the original order. In this case,
the Supplemental Action field will have a
value of Cancel or Amend.
vlocity_cmt__OrderStatus__c orderStatus String • Ready To Submit: Not yet submitted
to OM
• Activated: The order has been
fulfilled and assets are created in
Salesforce.
• Amend Requested: Order's fulfillment is
requested to be frozen in OM. CPQ
allows you to create and submit a
supplemental order when the order is
in this state.
• Amended: The order fulfillment step is
complete. Assets have been created.
• Cancelled: The order fulfillment step
is complete. Assets have been created.
vlocity_cmt__SupersededOrderId__c supersededOrderId ID Salesforce ID

Trimmed to 15 characters

Table 100. Order Product Fields


Field Name in Salesforce Name on Interface DataType Values
Decimal decimal Decimal
UnitPrice unitPrice Double
vlocity_cmt__Action__c action String • Add
• Existing
• Change
• Disconnect
• Suspend
• Resume
vlocity_cmt__AssetReferenceId__c billingAccountName assetReferenceId
vlocity_cmt__BillingAccountId__c billingAccountId ID
vlocity_cmt__BillingAccountId__r.Name billingAccountName ID
vlocity_cmt__LineNumber__c lineNumber String
vlocity_cmt__RootItemId__r.vlocity_cmt__LineNumber__c topOILineNumber String
vlocity_cmt__ServiceAccountId__c serviceAccountId ID
vlocity_cmt__ServiceAccountId__r.Name serviceAccountName String

© 2021 Vlocity LLC, a Salesforce


company 685
CME CPQ

Field Name in Salesforce Name on Interface DataType Values


vlocity_cmt__SubAction__c subAction String • Move
• Replace
• Reassign
• Cancel

These are
related to
Change of
Plan.
vlocity_cmt__SupplementalAction__c supplementalAction String
Does not exist in salesforce. This value is computed while the order request is isFreshCancellation Boolean
generated.
Does not exist in the record. This value is retrieved using dot notation from previousSupplementalAction String • null
vlocity_cmt__SupersededOrderItemId__r.vlocity_cmt__SupplementalAction__c • No
Change
• Amend
• Cancel
• Create

Table 101. Promotion Fields


Field Name in Salesforce Name in Interface Datatype Values
Name name String
vlocity_cmt__AccountId__c BillingAccountId String (ID) Salesforce ID

Trimmed to 15 characters
vlocity_cmt__AccountDiscountId__c AccountDiscountid String (ID) Salesforce ID

Trimmed to 15 characters
vlocity_cmt__Action__c Action String • Add
• Change
• Disconnect
vlocity_cmt__AppliesTo__c AppliesTo String • Account
• Asset
• Contract
• Multiple Assets
vlocity_cmt__AssetId__c AssetId String (ID) Salesforce ID

Trimmed to 15 characters
vlocity_cmt__PricingEndDate__c BenefitEndDate DateTime yyyy-MM-ddTHH:mm:ss.SSS+/-HHmm
or yyyy-MM-ddTHH:mm:ss.SSSZ
vlocity_cmt__PricingStartDate__c BenefitStartDate DateTime yyyy-MM-ddTHH:mm:ss.SSS+/-HHmm
or yyyy-MM-ddTHH:mm:ss.SSSZ
vlocity_cmt__CommitmentEndDate__c CommitmentEndDate DateTime yyyy-MM-ddTHH:mm:ss.SSS+/-HHmm
or yyyy-MM-ddTHH:mm:ss.SSSZ
vlocity_cmt__CommitmentStartDate__c CommitmentStartDate DateTime yyyy-MM-ddTHH:mm:ss.SSS+/-HHmm
or yyyy-MM-ddTHH:mm:ss.SSSZ
vlocity_cmt__ContractId__c ContractId String (ID) Salesforce ID
vlocity_cmt__ContractDiscountId__c ContractDiscountId String (ID) Salesforce ID

© 2021 Vlocity LLC, a Salesforce


company 686
CME CPQ

Field Name in Salesforce Name in Interface Datatype Values


vlocity_cmt__FulfilmentStatus__c FulfilmentStatus String • Draft
• In Progress
• Activated
• Superseded
• Cancelled
• PONR
• Pending
vlocity_cmt__OrderDiscountId__c OrderDiscountId String (ID) Salesforce ID
vlocity_cmt__PromotionId__c PromotionId String (ID) Salesforce ID
vlocity_cmt__ReasonForCancellation__c ReasonForCancellation String Free form text field. Any reason
vlocity_cmt__RequestDate__c RequestDate DateTime yyyy-MM-ddTHH:mm:ss.SSS+/-HHmm
or yyyy-MM-ddTHH:mm:ss.SSSZ
vlocity_cmt__Sequence__c Sequence Number (18,0)
vlocity_cmt__SubAction__c SubAction String • Move
• Cancel

Table 102. Order Pricing Fields


Field Name in Salesforce Name in Interface Datatype Values
Name ReferenceNumber String
vlocity_cmt__Action__c Action String • Add
• Change
• Disconnect
vlocity_cmt__AdjustmentValue__c AdjustmentValue Decimal
(or
Double)
vlocity_cmt__Amount__c Amount Decimal
(or
Double)
vlocity_cmt__OrderAppliedPromotionId__c AppliedPromotionId String Salesforce ID
(ID)
vlocity_cmt__AppliesTo__c Applies To String • Account
• Asset
• Multiple Assets
• Contract
vlocity_cmt__EstimatedEndDate__c EstimatedEndDate DateTime yyyy-MM-
ddTHH:mm:ss.SSS+/-
HHmm or yyyy-MM-
ddTHH:mm:ss.SSSZ
vlocity_cmt__EstimatedStartDate__c EstimatedStartDate DateTime yyyy-MM-
ddTHH:mm:ss.SSS+/-
HHmm or yyyy-MM-
ddTHH:mm:ss.SSSZ

© 2021 Vlocity LLC, a Salesforce


company 687
CME CPQ

Field Name in Salesforce Name in Interface Datatype Values


vlocity_cmt__FulfilmentStatus__c FulfilmentStatus String • Draft
• In Progress
• Activated
• Superseded
• Cancelled
• PONR
• Pending
vlocity_cmt__OverrideDefinitionId__r.vlocity_cmt__GlobalKey__c OverrideDefinitionId String(Id) Salesforce ID
vlocity_cmt__PriceListEntryId__r.vlocity_cmt__GlobalKey__c PriceListEntryId String(Id) Salesforce ID
vlocity_cmt__PricingElementGlobalKey__c PricingElementGlobalKey String Salesforce ID
vlocity_cmt__PricingElementVersionId__c PricingElementVersionId String Salesforce ID
(ID)
vlocity_cmt__PricingVariableId__r.vlocity_cmt__GlobalKey__c PricingVariableId String Salesforce ID
(ID)
vlocity_cmt__PromotionId__r.vlocity_cmt__GlobalKey__c PromotionId String Salesforce ID
(ID)
vlocity_cmt__RequestDate__c RequestDate DateTime • yyyy-MM-
ddTHH:mm:ss.SSS
+/-HHmm
• yyyy-MM-
ddTHH:mm:ss.SSSZ
vlocity_cmt__Sequence__c Sequence Integer
vlocity_cmt__Source__c Source String • Agent
• Promotion
• Offer
• Policy Action
• ABP
• Base
vlocity_cmt__SubAction__c SubAction String • Move
• Cancel
vlocity_cmt__TimePlanId__r.vlocity_cmt__GlobalKey__c TimePlanId String
vlocity_cmt__TimePolicyId__r.vlocity_cmt__GlobalKey__c TimePolicyId String

Table 103. Order Product Relationship


Field Name in Salesforce Name in Interface Datatype Values
Action__c action String • Add
• Delete
• Existing
OrderItemId__c sourceOrderItemId ID Salesforce ID
ProductRelationshipIdentifier__c relationshipIdentifier String GUID
RelatedAssetReferenceId__c relatedAssetRefId String GUID
RelatedOrderItemId__c relatedOrderItemId ID Salesforce ID
RelationshipType__c relationshipType String • Movement
• Replacement
• Reassignment
• ReliesOn

© 2021 Vlocity LLC, a Salesforce


company 688
CME CPQ

IMPORTANT
Field values that include Salesforce IDs are truncated if they 15 characters.

Freeze Order Request and Response


If a user chooses to freeze a submitted order or stop it from proceeding, Order Management Integration
Layer sends a Freeze Order request.

Example of a Freeze Order request sent from Order Management Integration Layer to the order
management system:

{
"orders": [{
"orderId": "8016g000000LD9RAAW"
}]
}

In response to the Freeze Order request, the following response might be provided by the order
management system indicating that the freeze request has been accepted by the order management
system:

[{
"orderId": "8011U000000Tq5l",
"state": "Accepted",
}]

In the above example, the orderId field is mandatory and should contain the Salesforce ID of the order
that is frozen. The state is also mandatory and should contain either Accepted or Rejected. No other
values are recognized by Order Management Integration Layer.

Example response if the freeze order is rejected:

[
// Supplemental Order Item rejected
{
"orderItemId": "8021U000000hv6T",
"state": "Rejected",
"reasonCode": "PONR",
"reasonDescription": "Point of Non Return is reached"
},
// Supplemental Order rejected
{
"orderId": "8011U000000Tq5l",
"state": "Rejected",

© 2021 Vlocity LLC, a Salesforce


company 689
CME CPQ

"reasonCode": "PONR",
"reasonDescription": "Point of Non Return is reached"
},
]

In the previous example, orderId is mandatory and should contain the Salesforce ID of the order that is
frozen. State is mandatory and should contain the either Accepted or Rejected. No other values are
recognized by Order Management Integration Layer.

The reasonCode field is mandatory if state = Rejected. The valid value for reasonCode is: PONR (point
of no return).

The reasonDescription field is optional. It should contain text that describes the reason for the
rejection.

Invoking CPQ Response Handler


The following code samples illustrate how to invoke the CPQ response handler.

To invoke the CPQ response handler:


1. Create the response as shown previously on this page.
2. Invoke the following method:

Map<String, Object> responseMap = new Map<String, Object>


{
'orderId' => ordId,
'state' => 'Accepted'
};
String responseString = JSON.serialize(responseMap);
OdinHelper.processFreezeResponse(responseString);

The following code sample shows a freeze order rejected scenario:

Map<String, Object> responseMap = new Map<String, Object>


{
'orderId' => ordId,
'state' => 'Rejected',
'reasonCode' => 'PONR',
'reasonDecription' => 'Point of Non Return is reached'
};
String responseString = JSON.serialize(responseMap);
OdinHelper.processFreezeResponse(responseString);

Unfreeze Order Request and Response


When order fulfillment is frozen (or paused) the user can unfreeze the order by issuing a request to
unfreeze (or resume) the order.

© 2021 Vlocity LLC, a Salesforce


company 690
CME CPQ

Example Unfeeze Order request sent from Order Management Integration Layer to the order management
system:

{
"orders": [{
"orderId": "8016g000000LD9RAAW"
}]
}

The order management system might provide the following response indicating that the Unfreeze Order
request has been accepted by the order management system:

[{
"orderId": "8011U000000Tq5l",
"state": "Accepted",
}]

The orderId field is mandatory and should contain the Salesforce ID of the order that is frozen. The state
is also mandatory and should contain Accepted. No other values are recognized by Order Management
Integration Layer.

Invoking the CPQ Response Handler


The following code samples illustrate how to invoke the CPQ response handler.

To invoke the CPQ response handler:


1. Create the response as illustrated above.
2. Invoke the following method:

Map<String, Object> responseMap = new Map<String, Object>{


'orderId' => ordId,
'state' => 'Accepted'
};
String responseString = JSON.serialize(responseMap);
OdinHelper.processUnfreezeResponse(responseString);

See Also
Unfreeze Order

Create Hooks for Odin Notification Handlers


Odin Notification Handler APIs provide an option to let you write custom pre and post-hooks for each API to
implement custom logic.

Pre-hooks execute before the actual handler API executes. Post-hooks execute after the actual handler API
executes.

Here is an example of how to write a hook for an Order Item Assetize Notification:

© 2021 Vlocity LLC, a Salesforce


company 691
CME CPQ

1. Write the custom class to implement the pre and post-hook.


Here is sample code for an Order Item Assetize hook:

global with sharing class OdinOIAssetizeHandlerHookImplementation


implements vlocity_cmt.VlocityOpenInterface
{
global Boolean invokeMethod(String methodName, Map<String, Object>
input, Map<String, Object> output, Map<String, Object> options)
{

if( methodName.equalsIgnoreCase('processNotifications.PreInvoke'))
{
processNotifications_PreInvoke(methodName, input,
output,options);
return true;
}

if( methodName.equalsIgnoreCase('processNotifications.PostInvoke')) {
processNotifications_PostInvoke(methodName, input,
output,options);
return true;
}

return false;

private void processNotifications_PreInvoke(String methodName,


Map<String, Object> input, Map<String, Object> output, Map<String, Object>
options) {
//This method gets called before processNotifications
List<Object> notificationList = (List<Object>)
input.get('notificationList');
List<Map<String, Object>> notifMapList =
convertToListOfMap(notificationList);
for (Map<String, Object> oneNotifMap : notifMapList)
{
//Write your logic here
}
}

private void processNotifications_PostInvoke(String methodName,


Map<String, Object> input, Map<String, Object> output, Map<String, Object>

© 2021 Vlocity LLC, a Salesforce


company 692
CME CPQ

options) {
//This method gets called after processNotifications
List<Object> notificationList = (List<Object>)
input.get('notificationList');
List<Map<String, Object>> notifMapList =
convertToListOfMap(notificationList);
for (Map<String, Object> oneNotifMap : notifMapList)
{
//Write your logic here
}
}

private List<Map<String, Object>> convertToListOfMap(List<Object>


notificationList) {
List<Map<String, Object>> notificationMapList = null;
if (notificationList != null) {
notificationMapList = new List<Map<String, Object>>();
for (Object oneNotifObj : notificationList) {
notificationMapList.add((Map<String, Object>) oneNotifObj);
}
}
return notificationMapList;
}
}
2. Create the interface implementation:
a. From the App Launcher, click Interface Implementations.
b. Click New.
c. In the New Interface Implementation dialog, enter the following:
• Interface Name: OdinOrderItemAssetizeHandlerHookInterface
• Active Implementation Class: OdinOIAssetizeHandlerHookImplementation
d. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 693
CME CPQ

3. Create the interface implementation detail:


a. Click the Related tab for your newly created OdinOrderItemAssetizeHandlerHookInterface
interface implementation.
b. Beside Interface Implementation Detail, click New.
c. In the New Interface Implementation Detail dialog, enter OdinOIAssetizeHandlerHookImpl
for the Available Implementation.
d. Click Active to make this implementation the active implementation.
e. Click Save.

© 2021 Vlocity LLC, a Salesforce


company 694
CME CPQ

Cart-Based APIs

Vlocity CPQ's Cart-Based APIs enable client application users to shop for and order products and services.

The Cart-Based APIs provide a layer of abstraction between client application development and the
configuration of the underlying CPQ logic.

Cart-Based APIs and their remote methods include:

• Add Items to Cart (postCartsItems)


• Add Promotion to Cart (postCartsPromoItems)
• Apply Adjustment (applyAdjustment)
• Cancel Order (cancelCart)
• Checkout Items in Cart (checkout)
• Create Cart (assetToOrder)
• Check Status of the Cart (getCarts)
• Clone Line Items in Cart (cloneItems)
• Create Cart (createCart)
• Create New Account for Current Site (newSite)
• Create String Translations (createStringTranslations)
• Create Supplemental Order (createSupplementalOrder)
• Delete Adjustment (deleteAdjustment)
• Delete Applied Promo Items (deletePromotionItems)
• Delete String Translations (deleteStringTranslations)
• Discard Supplemental Order (discardOrder)
• Expand Items (getExpandedItems)
• Freeze Order (preValidate)
• Get Account Details (getAccounts)
• Get Asset Pricing (getAssetPriceDetail)
• Get Assets for Account (getAssetsByAccount)
• Get Assets for Contract (getAssetsByContract)
• Get Available Sites (getAvailableSites)
• Get Cart Summary (getCarts)
• Get Cart Promotions (getCartsPromotions)
• Get Catalog Information (getCatalogHierarchy)
• Get Contracts for Account (getContracts)
• Get Filterable Attributes (getCartsAttributes)
• Get Cart Items (getCartsItems)
• Get Line Items by ID (getCartsItemsById)
• Get Lists of Values (getListsOfValues)
• Get Price Waterfall for Price (getPriceDetail)

© 2021 Vlocity LLC, a Salesforce


company 695
CME CPQ

• Get Price Lists for Cart (getPriceLists)


• Get List of Products (getCartsProducts)
• Get Products by ID (getCartsProductsById)
• Get Applied or Available Promotions for Cart (getPromotionList)
• Get Promotions Applied to Cart (getPromotionsAppliedToCart)
• Get Applied Promotions for Account (getAppliedPromotionsByAccount)
• Get Details of Product (getRuleMessages)
• Get String Translations (getStringTranslations)
• Get String Translation Dictionary (getDictionary)
• Post Cart Promotion Items (postCartsPromoItems)
• Remove Items from Cart (deleteCartsItems)
• Run Pricing for Items to Cart (priceCart)
• Price Items in Cart (Query) (getCartLineItemPrices)
• Submit a Cancel Order Request (submitCancelOrder)
• Unfreeze Order (unfreezeOrder)
• Update Item Attributes (putItemAttributes)
• Update Items in Cart (putCartsItems)
• Update String Translations (updateStringTranslations)
• Validate Cart Action (runCartValidation)

For Cart-based Swagger reference information, see Cart-Based API Swagger Reference.

Base URI Structure and Namespaces


All Cart-Based API requests use the following base URI:

https://{instance}.salesforce.com/services/apexrest/{namespace}

Where:

• instance identifies the Salesforce instance that hosts your Salesforce organization (org)
• namespace identifies the Vlocity app package, such as vlocity_cmt

API Authentication and Security


Apex REST supports two authentication mechanisms: OAuth 2.0 or Session ID. Usually, you will use
Session ID authentication only for testing purposes during development. OAuth 2.0 is recommended. For
more information, see the following topics in the Force.com REST API Developer Guide:

• Step Two: Set Up Authorization


• Understanding Authentication

API Limits
To maintain optimum performance and ensure that the Force.com API is available to all customers,
Salesforce imposes two types of API limits: concurrent API request limits and total API request limits. When
a call exceeds a request limit, an error is returned. The actual limit depends on the type of Salesforce

© 2021 Vlocity LLC, a Salesforce


company 696
CME CPQ

edition org you are using, the number of user licenses you have purchased, and the number of additional
API calls you may have purchased.

Total API request limits govern the total API requests (or calls) per 24-hour period for an org. Vlocity
Omnichannel Web APIs are designed to provide more functionality and data with each request to minimize
the number of calls required per user per hour. However, the client application determines the number of
API calls.

Concurrent API request limits govern the number of concurrent inbound requests (or calls) with a duration
of 20 seconds or longer. Vlocity Omnichannel Web APIs are designed to complete calls much faster than
20 seconds, with the possible exception of a POST of bulk data to Salesforce using a DataRaptor API.
Therefore, this limit does not usually apply.

For more information about API limits, see API Limits in the Salesforce Developer Limits Quick
Reference.

Other limits apply. Vlocity Omnichannel Web APIs are based on Apex REST. Calls to these APIs count
against the deploying company’s API governor limits. All standard Apex governor limits apply to Apex
REST classes. For example, the maximum request or response size is 6 MB for synchronous Apex or 12
MB for asynchronous Apex. For more information, see Execution Governors and Limits in the Force.com
Apex Code Developer Guide.

API Response Status Codes


Vlocity Apex REST APIs return the standard HTTP response status codes. For more information, see Apex
Rest Methods, “Response Status Codes,” in the Force.com Apex Code Developer Guide.

Non-Alphanumeric Characters
Ensure that API input expressions containing non-alphanumeric characters are preceded with var:. For
example, to use an input expression of "DIMENSION-33269", specify var:"DIMENSION-33269"
instead.

See Also
Omnichannel Web APIs

Guest User Security Restrictions


Beginning with the Winter '21 Salesforce release, Guest Users, also called anonymous users, cannot
access any records by default. This affects all Salesforce orgs.

For more about Vlocity's guest user implementation, see Guest User Enhancements Overview.

Beginning with CME Spring '20 Minor Release, Vlocity does not allow guest users to create and update
records by default with the exception of Cart-Based and Digital Commerce APIs listed in this topic.

Cart-Based APIs
The following URIs and their corresponding Cart-Based REST APIs, remote actions, and CpqAppHandler
calls allow guest users to create and update records.

© 2021 Vlocity LLC, a Salesforce


company 697
CME CPQ

/carts
Create Cart

POST /carts

/cpq/carts/*

• Get Cart Summary


GET /cpq/carts/{encrypted_cart_ID}
• Update Cart Summary
PUT /cpq/carts/{encrypted_cart_ID}

/cpq/carts/*/attributes
Get Filterable Attributes

GET /cpq/carts/{encrypted_cart_ID}/attributes

/cpq/carts/*/cancel

• Cancel Order
POST /cpq/carts/{encrypted_cart_ID}/cancel
• Create Supplemental Order
POST /cpq/carts/{encrypted_order_ID}/cancel
• Send Updates on Cancellations
PUT /cpq/carts/{encrypted_cart_ID}/cancel
• Submit a Cancel Order Request
POST /v2/cpq/carts/{encrypted_order_ID}/cancel

/cpq/carts/*/items

• Add Items to Cart


POST /cpq/carts/{encrypted_cart_ID}/items
• Add to Cart
POST /cpq/carts/{encrypted_cart_ID}/items
• Get Cart Items
GET /cpq/carts/{encrypted_cart_ID}/items
• Get Line Items by ID
GET /cpq/carts/{encrypted_cart_ID}/items
• Remove Items from Cart
DELETE /cpq/carts/{encrypted_cart_ID}/items
• Update Items in Cart
PUT /cpq/carts/{encrypted_cart_ID}/items

© 2021 Vlocity LLC, a Salesforce


company 698
CME CPQ

/cpq/carts/*/items/checkout
• Checkout Items in Cart
POST /cpq/carts/{encrypted_cart_ID}/items/checkout
• Check Status of the Cart
GET /cpq/carts/{encrypted_cart_ID}/items/checkout

/cpq/carts/*/items/*/itemattributes
Update Item Attributes

PUT /cpq/carts/{encrypted_cart_ID}/items/{itemId}/itemattributes)

/cpq/carts/*/items/*/pricing
• Apply Adjustment
POST /cpq/carts/{encrypted_cart_ID}/items/{itemId}/pricing
• Applies an Adjustment (Discount, Markup, or Override to a Price)
PUT /cpq/carts/{encrypted_cart_ID}/items/{itemId}/pricing
• Delete Adjustment
DELETE /cpq/carts/{encrypted_cart_ID}/items/{itemId}/pricing
• Get Price Waterfall for Price
GET /cpq/carts/{encrypted_cart_ID}/items/{itemId}/pricing

/cpq/carts/*/price
• Price Items in Cart (Query)
GET /cpq/carts/{encrypted_cart_ID}/price
• Run Pricing for Items to Cart
POST /cpq/carts/{encrypted_cart_ID}/price

/cpq/carts/*/pricelists
Get Price Lists for Cart

GET /cpq/carts/{encrypted_cart_ID}/pricelists

/cpq/carts/*/products
• Get Details of Product
GET /cpq/carts/{encrypted_cart_ID}/products/{pricebookEntryId}
• Get List of Products
GET /cpq/carts/{encrypted_cart_ID}/products
• Get Products by ID
GET /v2/cpq/carts/{encrypted_cart_ID}/products?{id}&includeAttachment=[true|
false]

© 2021 Vlocity LLC, a Salesforce


company 699
CME CPQ

/cpq/carts/*/promotions
• Add Promotion to Cart
POST /cpq/carts/{encrypted_cart_ID}/promotions
• Delete Applied Promo Items
DELETE /cpq/carts/{encrypted_cart_ID}/promotions
• Get Applied or Available Promotions for Cart
GET /cpq/carts/{encrypted_cart_ID}/promotions
• Get Cart Promotions
GET /cpq/carts/{encrypted_cart_ID}/promotions
• Post Cart Promotion Items
POST /cpq/carts/{encrypted_cart_ID}/promotions

/cpq/catalogs/*
Get Catalog Information

GET /cpq/catalogs

Digital Commerce APIs


The following URIs and their corresponding Digital Commerce APIs allow guest users to use the basket
and offer operations. The Create Basket with BasketAction API creates and updates records for guest
users.

Digital Commerce APIs that use a context key must encrypt them.

/carts
Create Cart from Basket

POST /carts

/catalogs/*/basket/*
• Create Basket with BasketAction
POST /catalogs/{catalogcode}/basket
• Get Basket Details API
GET /catalogs/{catalogcode}/basket/{basketkey}
• Update Basket Contents API
POST /catalogs/{catalogcode}/basket/{basketkey}

/catalogs/*/offers/*
• Get Offers by Catalog API
GET /catalogs/{catalogcode}/offers
• Get Offer Details API
GET /catalogs/{catalogcode}/offers/{offercode}

© 2021 Vlocity LLC, a Salesforce


company 700
CME CPQ

• Post Offer Details with Configuration API


POST /catalogs/{catalogcode}/offers/{offercode}

See Also
• Salesforce's Guest User Record Access Development Best Practices
• Salesforce's Guest User Security Policies and Timelines
• Give Secure Access to Unauthenticated Users with the Guest User Profile
• Salesforce Guest User - How to Test and Update Sharing Settings

Cart-Based API Swagger Reference

NOTE
If Swagger does not render, refresh this page.

https://docs.vlocity.com/api/cme/v2/swagger-cpqapi.yaml

API Response Format


This topic describes the structure of any Cart-Based API response.

API responses permit a structured interaction between the requesting entities and back-end operations and
are composed of objects wrapped in a result object. The wrapper object used is represented by a
JSONResult class while most result records are represented by the JSONRecord base class.

Based on every specific API, the records construct or JSONRecord can represent a different physical
database record or a unit of information. The JSONRecord construct supports a hierarchical representation
of the data when required, which is accomplished through the use of the nameResult property of the
JSONRecord class.

The following table lists the wrapper classes. Note that not all listed properties are used by each vertical.

© 2021 Vlocity LLC, a Salesforce


company 701
CME CPQ

Table 104. Wrapper Classes


Apex Class Name Parent Class Description Properties
JSONAttribute JSONRecord Represents a • dataType: The data type of the attribute to indicate which
single product native type this attribute accept: Integer, Boolean, String,
attribute and its Date, Datetime and so on.
properties • inputType: The UI display of the attribute. This indicates
whether an attribute should be rendered as a radio,
checkbox or input box and so on.
• multiselect: Flag to indicate if this is a multiselection.
• values: List of possible values.
• required: Specifies the required flag.
• readonly: Specifies the read-only flag.
• placeholder: Specifies the placeholder.
• maxlength: Specifies the maxlength.
• minlength: Specifies the minlength.
• min: Specifies the min.
• max: Specifies the max.
• pattern: Specifies the pattern.
• autocomplete: Specifies the autocomplete flag.
• step: Specifies the step.
• attributeId: Specifies the attributeId.
• label: Specifies the label.
• formatMask: Specifies the formatMask.
• hasRules: Specifies the hasRules flag.
• customTemplate: For custom rendering of the Attribute
(such as Buttons)
• disabled: Same as readonly.
• hidden: Specifies the hidden flag.
• filterable: Specifies the filterable flag.
• cloneable: Specifies the cloneable flag.
• description: Specifies the value description.
• userValues: Specifies selected values.
• isRatingAttribute: Specifies the isRatingAttribute flag.
• code: Specifies the code.
• rules: Specifies the list rules.
• isNotTranslatable: Specifies the isNotTranslatable flag.
JSONCategory JSONRecord Represents a • id: The ID of the record.
single product • name: The name of the record.
attribute • childCategories: The list of the child categories.
category and its
properties.

© 2021 Vlocity LLC, a Salesforce


company 702
CME CPQ

Apex Class Name Parent Class Description Properties


JSONRecord N/A A value object • messages: Informational, warning, or error message
that represents associated with this result.
a record. A • actions: Remote action or API that are associated with this
record can be result. For example, the action for attributes filtering will be
an attribute, search product.
product, order, • fields: A map of name and value for fields. For example:
quote, CategoryCode__c:"Installation",
opportunity or CategoryCodeId:"801360000000oQ9"
line item. • nameResult: A map that contains the child JSONResult. For
example, the root product JSONResult will contain a list of
product records. Each record will contain a nameResult of
child product result.
• promotion: Promotion child products results
• displaySequence: The display sequence of that record.
JSONAttribute.JSONValue N/A Represents a • name: Unique name of the value.
single Product • label: Display label of the value that could be used in
Attribute Value. dropdown, checkbox or radio button.
• value: The value that will be stored.
• defaultValue: Default value.
• selected: Flag to indicate if this is selected or not.
• defaultSelected: Default selection of the value.
• readonly: Specifies the read only flag.
• disabled: Specifies the disabled flag.
• displaySequence: Specifies the displaySequence.
JSONResult N/A The main value • totalSize: The size of the records. This is the total number,
object that not necessary the same of records.size(). For example, if
encapsulates there are 200 attributes and the number of records being
API responses. return is 20. The totalSize will be 200. It serves as an
indicator to fetch more records.
• messages: Informational, warning, or error message
associated with this result.
• actions: Remote action or API that are associated with this
result. For example, the action for attributes filtering will be
search product.
• records: List of records.

CPQ APIs to Replace OmniCPQServiceWrapper


The OmniCPQServiceWrapper implementation is a class for OmniScripts that supports named methods
used in guided selling.

NOTE
As of the CME Spring '17 release, OmniCPQServiceWrapper is deprecated. Vlocity
recommends using the Omnichannel CPQ REST APIs instead of
OmniCPQServiceWrapper.

© 2021 Vlocity LLC, a Salesforce


company 703
CME CPQ

OmniCPQServiceWrapper Method Name CPQ API Method Name CPQ API Name
addProducts postCartsItems Add Items to Cart
createOpportunity createCart Create Cart
createOrder createCart Create Cart
createQuote createCart Create Cart
deleteItem deleteCartsItems Remove Items from Cart
getProducts getCartsProducts Get List of Products
submitOpportunity checkout Checkout Items in Cart
submitOrder checkout Checkout Items in Cart
submitQuote checkout Checkout Items in Cart
updateItem putCartsItems Update Items in Cart

Add Items to Cart


Add items to the cart along with any required child products that are specified in the request body.
Compatibility and pricing rules are run against the cart.

You must use the fieldsToUpdate parameter to update any default line item value.

Add line items to cart replaces the OmniCPQServiceWrapper addProducts method.

POST /v2/cpq/carts/{cart_ID}/items

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method

postCartsItems

NOTE
In releases prior to CME Spring '20, the postCartsItems method supports the addition
of one item at a time. If you must add multiple items, make multiple postCartsItems
calls.

With CME Spring '20 and later releases, the itemId parameter supports multiple comma-
separated values when adding root and child items via postCartsItems method calls if
UOWMode is set to true.

© 2021 Vlocity LLC, a Salesforce


company 704
CME CPQ

REST Handler
APIItemsCartsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName: postCartsItems,
cartId: 801360000008 eNU,
items: [{
itemId: 01 t36000000pfcKAAQ,
parentId: 01 t36000000pfcKAAZ "fieldsToUpdate": {
"Quantity": 6,
"vlocity_cmt__RecurringManualDiscount__c": 10
}
}
}]
}
itemId = pricebookEntryId
parentId = OrderItem.Id

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items

Example Request
POST
{
"items": [
{
"itemId": "01uf4000000gmRTAAY",
"parentId": "802f4000000PZ1VAAW",
"parentRecord": {
"records": [

© 2021 Vlocity LLC, a Salesforce


company 705
CME CPQ

{
"messages": [],
"displaySequence": -1,
"Id": {
"messages": [],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"value": "802f4000000PZ1VAAW"
},
"UnitPrice": {
"messages": [],
"label": "Unit Price",
"hidden": true,
"fieldName": "UnitPrice",
"editable": false,
"dataType": "CURRENCY",
"value": 358.95
},
"productId": "01tf4000000Kd0uAAC",
"defaultQuantity": 1,
"minQuantity": 0,
"maxQuantity": 99999,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1,
"productHierarchyPath": "01tf4000000Kd0uAAC",
"itemType": "lineItem",
"childProducts": {
"records": [
{
"Name": {
"label": "Product Name",
"value": "PRODUCT-77151"
},
"UnitPrice": {
"label": "List Price",
"value": 0
},
"vlocity_cmt__RecurringPrice__c": {
"label": "Recurring Price",
"value": 0
},
"Product2Id": {

© 2021 Vlocity LLC, a Salesforce


company 706
CME CPQ

"label": "Product ID",


"value": "01tf4000000Kd0zAAC"
},
"Pricebook2Id": {
"label": "Price Book ID",
"value": "01sf4000003LYn3AAG"
},
"Id": {
"label": "Price Book Entry ID",
"value": "01uf4000000gmRTAAY"
},
"defaultQuantity": 0,
"productId": "01tf4000000Kd0zAAC",
"Product2": {
"Name": "PRODUCT-77151",
"RecordTypeId": "012f40000004zEOAAY",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__SubType__c": "None",
"vlocity_cmt__Type__c": "None"
},
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"items": [
{
"parentId": "802f4000000PZ1VAAW",
"quantity": 0,
"itemId": "01uf4000000gmRTAAY"
}
],
"cartId": "801f4000000ChZjAAK"
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
801f4000000ChZjAAK/items"
},
"remote": {
"params": {
"price": true,
"validate": true,

© 2021 Vlocity LLC, a Salesforce


company 707
CME CPQ

"includeAttachment": false,
"pagesize": 20,
"items": [
{
"parentId": "802f4000000PZ1VAAW",
"quantity": 0,
"itemId": "01uf4000000gmRTAAY"
}
],
"cartId": "801f4000000ChZjAAK",
"methodName": "postCartsItems"
}
},
"client": {
"params": {
"pagesize": 0,
}
}
}
}
}
]
},
"vlocity_cmt__RecurringPrice__c": 527.96,
"name": "PRODUCT-39982",
"provisioningStatus": "New",
"Product2Id": "01tf4000000Kd0uAAC",
"PricebookEntryId": {
"messages": [],
"label": "Price Book Entry ID",
"hidden": false,
"fieldName": "PricebookEntryId",
"editable": false,
"dataType": "REFERENCE",
"value": "01uf4000000gmRJAAY"
},
"Quantity": {
"messages": [],
"label": "Quantity",
"hidden": false,
"fieldName": "Quantity",
"editable": true,
"dataType": "DOUBLE",
"value": 1
},
"vlocity_cmt__OneTimeTotal__c": {

© 2021 Vlocity LLC, a Salesforce


company 708
CME CPQ

"messages": [],
"label": "One Time Total",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeTotal__c",
"editable": false,
"dataType": "CURRENCY",
"value": 358.95
},
"vlocity_cmt__RecurringTotal__c": {
"messages": [],
"label": "Recurring Total",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringTotal__c",
"editable": false,
"dataType": "CURRENCY",
"value": 527.96
},
"vlocity_cmt__ProvisioningStatus__c": {
"messages": [],
"label": "Provisioning Status",
"hidden": true,
"fieldName": "vlocity_cmt__ProvisioningStatus__c",
"editable": false,
"dataType": "STRING",
"value": "New"
},
"vlocity_cmt__ProductHierarchyPath__c": {
"messages": [],
"label": "Product Hierarchy Path",
"hidden": true,
"fieldName": "vlocity_cmt__ProductHierarchyPath__c",
"editable": false,
"dataType": "STRING",
"value": "01tf4000000Kd0uAAC"
},
"vlocity_cmt__LineNumber__c": {
"messages": [],
"label": "LineNumber",
"hidden": true,
"fieldName": "vlocity_cmt__LineNumber__c",
"editable": false,
"dataType": "STRING",
"value": "0001"
},
"vlocity_cmt__RootItemId__c": {
"messages": [],

© 2021 Vlocity LLC, a Salesforce


company 709
CME CPQ

"label": "RootItemId",
"hidden": true,
"fieldName": "vlocity_cmt__RootItemId__c",
"editable": false,
"dataType": "STRING",
"value": "802f4000000PZ1VAAW"
},
"ListPrice": {
"messages": [],
"label": "List Price",
"hidden": true,
"fieldName": "ListPrice",
"editable": false,
"dataType": "CURRENCY",
"value": 358.95
},
"vlocity_cmt__OneTimeCharge__c": {
"messages": [],
"label": "One Time Charge",
"hidden": true,
"fieldName": "vlocity_cmt__OneTimeCharge__c",
"editable": false,
"dataType": "CURRENCY",
"value": 358.95
},
"vlocity_cmt__RecurringCharge__c": {
"messages": [],
"label": "Recurring Charge",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringCharge__c",
"editable": false,
"dataType": "CURRENCY",
"value": 527.96
},
"vlocity_cmt__RecurringManualDiscount__c": {
"messages": [],
"label": "Recurring Manual Discount",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringManualDiscount__c",
"editable": true,
"dataType": "PERCENT",
"value": 0
},
"vlocity_cmt__OneTimeManualDiscount__c": {
"messages": [],
"label": "One Time Manual Discount",

© 2021 Vlocity LLC, a Salesforce


company 710
CME CPQ

"hidden": false,
"fieldName": "vlocity_cmt__OneTimeManualDiscount__c",
"editable": true,
"dataType": "PERCENT",
"value": 0
},
"vlocity_cmt__ParentItemId__c": {
"messages": [],
"label": "ParentItemId",
"hidden": true,
"fieldName": "vlocity_cmt__ParentItemId__c",
"editable": false,
"dataType": "STRING"
},
"PricebookEntry": {
"Product2Id": "01tf4000000Kd0uAAC",
"Pricebook2Id": "01sf4000003LYn3AAG",
"Id": "01uf4000000gmRJAAY",
"Product2": {
"Name": "PRODUCT-39982",
"Id": "01tf4000000Kd0uAAC",
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__IsConfigurable__c": "false"
}
},
"Product2": {
"Name": "PRODUCT-39982",
"RecordTypeId": "012f40000004zEOAAY",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__SubType__c": "None",
"vlocity_cmt__Type__c": "None"
},
"vlocity_cmt__ItemName__c": {
"messages": [],
"label": "Item Name",
"hidden": false,
"fieldName": "vlocity_cmt__ItemName__c",
"editable": true,
"dataType": "STRING"
},
"actions": {
"addtocart": {
"rest": {
"params": {
"price": true,
"validate": true,

© 2021 Vlocity LLC, a Salesforce


company 711
CME CPQ

"includeAttachment": false,
"pagesize": 20,
"items": [
{
"parentId": "802f4000000PZ1VAAW",
"quantity": 1,
"itemId": "01uf4000000gmRJAAY"
}
],
"cartId": "801f4000000ChZjAAK"
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
801f4000000ChZjAAK/items"
},
"remote": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"items": [
{
"parentId": "802f4000000PZ1VAAW",
"quantity": 1,
"itemId": "01uf4000000gmRJAAY"
}
],
"cartId": "801f4000000ChZjAAK",
"methodName": "postCartsItems"
}
},
"client": {
"params": {
"pagesize": 0,
}
}
},
"cloneitem": {
"rest": {
"params": {
"pagesize": 0,
"items": [
{
"quantity": 0,
"itemId": "802f4000000PZ1VAAW"

© 2021 Vlocity LLC, a Salesforce


company 712
CME CPQ

}
],
"cartId": "801f4000000ChZjAAK"
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
801f4000000ChZjAAK/items/clone"
},
"remote": {
"params": {
"pagesize": 0,
"items": [
{
"quantity": 0,
"itemId": "802f4000000PZ1VAAW"
}
],
"cartId": "801f4000000ChZjAAK",
"methodName": "cloneItems"
}
},
"client": {
"params": {
"pagesize": 0,
}
}
}
},
"isVirtualItem": false
}
]
}
}
],
"pagesize": 0,
"levelBasedApproach": false
}

NOTE
For more information about levelBasedApproach, see Configuring Cart Item Refresh
Levels.

© 2021 Vlocity LLC, a Salesforce


company 713
CME CPQ

Example Result
{
"totalSize": 1,
"messages": [{
"severity": "INFO",
"messageId": null,
"message": "Successfully added.",
"code": "150",
"actions": {}
}],
"records": [{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null,
"items": [{
"parentId": "80241000000HalXAAS",
"quantity": 1,
"itemId": "01u41000001QPs5AAG"
}]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null,
"items": [{
"parentId": "80241000000HalXAAS",
"quantity": 1,
"itemId": "01u41000001QPs5AAG"
}],
"cartId": "80141000000Cg8HAAS",
"methodName": "postCartsItems"

© 2021 Vlocity LLC, a Salesforce


company 714
CME CPQ

}
},
"client": {
"params": {}
}
},
"updateitems": {
"rest": {
"params": {
"fields": null,
"price": true,
"validate": true,
"filters": null,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null,
"items": [{
"itemId": "80241000000HalXAAS"
}]
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"fields": null,
"price": true,
"validate": true,
"filters": null,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null,
"items": [{
"itemId": "80241000000HalXAAS"
}],
"cartId": "80141000000Cg8HAAS",
"methodName": "putCartsItems"
}
},
"client": {
"params": {}
}
},

© 2021 Vlocity LLC, a Salesforce


company 715
CME CPQ

"deleteitem": {
"rest": {
"params": {},
"method": "DELETE",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items/80241000000HalXAAS?
pagesize=20&amp;includeAttachment=false&amp;validate=true&amp;price=true"
},
"remote": {
"params": {
"price": true,
"validate": true,
"filters": null,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null,
"id": "80241000000HalXAAS",
"cartId": "80141000000Cg8HAAS",
"methodName": "deleteCartsItems"
}
},
"client": {
"params": {}
}
},
"cloneitem": {
"rest": {
"params": {
"items": [{
"itemId": "80241000000HalXAAS"
}]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items/clone"
},
"remote": {
"params": {
"id": "80241000000HalXAAS",
"cartId": "80141000000Cg8HAAS",
"methodName": "cloneItems"
}
},
"client": {
"params": {}

© 2021 Vlocity LLC, a Salesforce


company 716
CME CPQ

}
},
"modifyattributes": {
"rest": {
"params": {
"fields": null,
"items": [{
"itemId": "80241000000HalXAAS"
}]
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items/80241000000HalXAAS/itemattributes"
},
"remote": {
"params": {
"fields": null,
"items": [{
"itemId": "80241000000HalXAAS"
}],
"itemId": "80241000000HalXAAS",
"cartId": "80141000000Cg8HAAS",
"methodName": "putItemAttributes"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"value": "80241000000HalXAAS",
"messages": [],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"Pricebook2Id": "01s41000005dPYQAA2",
"Product2Id": "01t41000000sYZVAA2",
"UnitPrice": {
"value": 2.00,
"messages": [],

© 2021 Vlocity LLC, a Salesforce


company 717
CME CPQ

"label": "Unit Price",


"hidden": false,
"fieldName": "UnitPrice",
"editable": true,
"dataType": "CURRENCY",
"actions": {}
},
"Name": "Parent 1",
"IsActive": true,
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/
Product2/01t41000000sYZVAA2"
},
"Id": "01t41000000sYZVAA2",
"Name": "Parent 1",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "012410000006OWUAA2",
"vlocity_cmt__JSONAttribute__c": null
},
"productId": "01t41000000sYZVAA2",
"defaultQuantity": 1.0,
"minQuantity": 0.0,
"maxQuantity": 99999.0,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1.00,
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v38.0/sobjects/
vlocity_cmt__ProductChildItem__c/a2541000000G0A1AAK"
},
"Id": "a2541000000G0A1AAK",
"Name": "Root PCI",
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01t41000000sYZVAA2",

© 2021 Vlocity LLC, a Salesforce


company 718
CME CPQ

"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1.00,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__IsRootProductChildItem__c": true,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/
Product2/01t41000000sYZVAA2"
},
"Id": "01t41000000sYZVAA2",
"Name": "Parent 1"
}
},
"productHierarchyPath": "01t41000000sYZVAA2",
"name": "Parent 1",
"isVirtualItem": false,
"itemType": "lineItem",
"PricebookEntryId": {
"value": "01u41000001QPs5AAG",
"messages": [],
"label": "Price Book Entry ID",
"hidden": false,
"fieldName": "PricebookEntryId",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
...

NOTE
An entire result can be thousands of lines long. This example has been truncated.

Add Promotion to Cart


Add a promotion to the specified cart. If an optional child product belongs to a promotion, the promotion is
applied to the newly added product when that product is added to the cart.

POST /v2/cpq/carts/{cart_ID}/promotions

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User

© 2021 Vlocity LLC, a Salesforce


company 719
CME CPQ

Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
postCartsPromoItems

REST Handler
APIPromotionsCartsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName:"postCartsPromoItems",
cartId:801360000008eNU,
items:[ { itemId:01t36000000pfcKAAQ }]
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/promotions

Example Request
POST
{
"items": [
{
"itemId": "a30460000001vbgAAA"
}
],
"price": false,
"validate": false
}

© 2021 Vlocity LLC, a Salesforce


company 720
CME CPQ

Example Response
{
"messages": [
{
"severity": "string",
"messageId": "string",
"code": 0,
"message": "Successfully completed"
}
],
"records": [
{
"messages": [
{
"severity": "string",
"messageId": "string",
"code": 0,
"message": "Successfully completed"
}
],
"displaySequence": -1,
"Id": "8016A000000bwElQAI",
"Name": "New customer order",
"EffectiveDate": "2017-12-25",
"AccountId": "0016A0000053kHN",
"Account.Name": "Acme Inc.",
"EffectiveRecurringTotal__c": 0,
"EffectiveOneTimeTotal__c": 0,
"EffectiveOrderTotal__c": 0,
"OrderNumber": "00000141",
"Status": "Draft"
}
]
}

Add to Cart
Add a product to the cart.

POST /v2/cpq/carts/{cart_ID}/items

© 2021 Vlocity LLC, a Salesforce


company 721
CME CPQ

NOTE
By default, items deleted from a cart are not evaluated for Vlocity Rules. To enable
evaluation of deleted items, set the ShouldConsiderDeletedItems configuration setting to
true.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
postCartsItems

NOTE
The postCartsItems method supports the addition of one item at a time. If you must
add multiple items, make multiple postCartsItems calls.

REST Handler
APIItemsCartsCpqV2

Apex Remote Service


Class: vlocity_cmt.CardCanvasController
Method: global static Object doGenericInvoke(String sClassName, String
sMethodName, String input, String options)

Apex Remote Input Map


"sClassName": "vlocity_cmt.CpqAppHandler"
"sMethodName": "postCartsItems"
"input": SAME AS SAMPLE REQUEST BODY
"options": {"vlcClass":"vlocity_cmt.CpqAppHandler"}

The following example illustrates how to call this API from Apex code.

Map<String, Object> inputMap = new Map<String, Object>();


Map<String, Object> outputMap = new Map<String, Object>();

© 2021 Vlocity LLC, a Salesforce


company 722
CME CPQ

Map<String, Object> optionsMap = new Map<String, Object>();


Map<String, Object> itemsMap = new Map<String, Object>();
List<Object> items = new List<Object>();
Id priceBookEntryId = Id.valueOf('Replace with the pricebook entry id of the
product to be added');
Id cartId = Id.valueOf('replace with the id of the cart');
itemsMap.put('itemId', priceBookEntryId);
items.add(itemsMap);
inputMap.put('items', items);
inputMap.put('cartId', cartId);
inputMap.put('validate', true); // set to false if validation is not required
inputMap.put('price', true); // set to false if pricing is not required
vlocity_cmt.CpqAppHandler cpqAppHandlerService = new
vlocity_cmt.CpqAppHandler();
cpqAppHandlerService.invokeMethod('postCartsItems', inputMap, outputMap,
optionsMap);
System.debug('outputMap:' + outputMap);

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /v2/cpq/carts/*/items

Example: /services/apexrest/{namespace}/v2/cpq/carts/801360000000oQ9/items

Example Request
{
"methodName": "postCartsItems",
"items": [
{
"parentId": "8021N000006wtTTQAY",
"parentHierarchyPath": "01to000000Am1FGAAZ",
"itemId": "01u1N00000DPpdFQAT",
"parentRecord": {
"records": [
{
"displaySequence": -1,
"Id": {
"value": "8021N000006wtTTQAY",

© 2021 Vlocity LLC, a Salesforce


company 723
CME CPQ

"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"Pricebook2Id": "01so0000000jvwiAAA",
"Product2Id": "01to000000Am1FGAAZ",
"UnitPrice": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Unit Price",
"hidden": true,
"fieldName": "UnitPrice",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"Name": "Product Hier 3",
"vlocity_cmt__RecurringPrice__c": 0,
"IsActive": true,
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/
Product2/01to000000Am1FGAAZ"
},
"Name": "Product Hier 3",
"vlocity_cmt__IsConfigurable__c": false,
"RecordTypeId": "012o0000000pDXFAA2",
"Id": "01to000000Am1FGAAZ",
"vlocity_cmt__JSONAttribute__c": null
},
"productId": "01to000000Am1FGAAZ",
"defaultQuantity": 1,
"minQuantity": 0,
"maxQuantity": 1000,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1,

© 2021 Vlocity LLC, a Salesforce


company 724
CME CPQ

"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v41.0/sobjects/
vlocity_cmt__ProductChildItem__c/a0ro00000050PjxAAE"
},
"Id": "a0ro00000050PjxAAE",
"Name": "Root PCI",
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01to000000Am1FGAAZ",
"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__IsRootProductChildItem__c": true,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/
Product2/01to000000Am1FGAAZ"
},
"Name": "Product Hier 3",
"Id": "01to000000Am1FGAAZ",
"RecordTypeId": "012o0000000pDXFAA2"
}
},
"productHierarchyPath": "01to000000Am1FGAAZ",
"name": "Product Hier 3",
"isVirtualItem": false,
"provisioningStatus": "New",
"hasChildren": true,
"itemType": "lineItem",
"PricebookEntryId": {
"value": "01uo000000Bz2qbAAB",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Price Book Entry ID",
"hidden": false,
"fieldName": "PricebookEntryId",
"editable": false,

© 2021 Vlocity LLC, a Salesforce


company 725
CME CPQ

"dataType": "REFERENCE",
"actions": {}
},
"Quantity": {
"value": 1,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Quantity",
"hidden": false,
"fieldName": "Quantity",
"editable": true,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__OneTimeTotal__c": {
"value": 300,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "One Time Total",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeTotal__c",
"editable": false,
"dataType": "CURRENCY",
[EXAMPLE TRUNCATED FOR BREVITY]

Example Response
{
"totalSize": 1,
"messages": [
{
"severity": "INFO",
"messageId": null,
"message": "Successfully added.",
"code": "150",
"bundleId": null,
"actions": {}
}
],
"actions": {
"addtocart": {
"rest": {
"params": {
"cartId": "8011N00000157LkQAI",

© 2021 Vlocity LLC, a Salesforce


company 726
CME CPQ

"items": [
{
"isPartialPromo": true,
"itemId": "a2w1N000001F9TiQAK"
}
]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011N00000157LkQAI/promotions"
},
"remote": {
"params": {
"items": [
{
"isPartialPromo": true,
"itemId": "a2w1N000001F9TiQAK"
}
],
"cartId": "8011N00000157LkQAI",
"methodName": "postCartsPromoItems"
}
},
"client": {
"params": {
"methodName": "postCartsPromoItems",
"items": [
{
"isPartialPromo": true,
"itemId": "a2w1N000001F9TiQAK"
}
]
}
}
},
"itempricesupdated": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011N00000157LkQAI/price"
},
"remote": {
"params": {
"cartId": "8011N00000157LkQAI",
"methodName": "getCartLineItemPrices"

© 2021 Vlocity LLC, a Salesforce


company 727
CME CPQ

}
},
"client": {
"params": {}
}
}
},
"records": [
{
"messages": [],
"displaySequence": -1,
"vlocity_cmt__InCartQuantityMap__c": {
"value": {
"01t1N00000AptOXQAZ": 1,
"01t1N00000AptOcQAJ": 1,
"01t1N00000ApqNdQAJ": 1,
"01t1N00000ByiiDQAR": 1
},
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "InCartQuantityMap",
"hidden": true,
"fieldName": "vlocity_cmt__InCartQuantityMap__c",
"editable": false,
"dataType": "TEXTAREA",
"actions": {}
},
"Id": {
"value": "8021N000006wtTTQAY",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"isVirtualItem": false,
"lineItems": {
"totalSize": 0,
"messages": [],
"records": [
{

© 2021 Vlocity LLC, a Salesforce


company 728
CME CPQ

"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"items": [
{
"quantity": 1,
"parentId": "8021N000006wtTTQAY",
"parentHierarchyPath": "01to000000Am1FGAAZ",
"itemId": "01u1N00000DPpdFQAT"
}
],
"cartId": "8011N00000157LkQAI",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 10,
"lastRecordId": null,
"query": null
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011N00000157LkQAI/items"
},
"remote": {
"params": {
"methodName": "postCartsItems",
"items": [
{
"quantity": 1,
"parentId": "8021N000006wtTTQAY",
"parentHierarchyPath": "01to000000Am1FGAAZ",
"itemId": "01u1N00000DPpdFQAT"
}
],
"cartId": "8011N00000157LkQAI",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 10,
"lastRecordId": null,
"query": null
}
},
"client": {

© 2021 Vlocity LLC, a Salesforce


company 729
CME CPQ

"params": {}
}
},
"updateitems": {
"rest": {
"params": {
"items": [
{
"itemId": "8021N000006wtUMQAY"
}
],
"filters": null,
"fields": null,
"cartId": "8011N00000157LkQAI",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 10,
"lastRecordId": null,
"query": null
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011N00000157LkQAI/items"
},
"remote": {
"params": {
"methodName": "putCartsItems",
"items": [
{
"itemId": "8021N000006wtUMQAY"
}
],
"filters": null,
"fields": null,
"cartId": "8011N00000157LkQAI",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 10,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}

© 2021 Vlocity LLC, a Salesforce


company 730
CME CPQ

}
},
[EXAMPLE TRUNCATED FOR BREVITY]

Apply Adjustment
Apply an adjustment (such as a discount, markup, or override) to a price for a cart and line item, which are
specified by the cartId and id parameters.

The PricingElementServiceImplementation supports this API.

POST /v2/cpq/carts/{cart_ID}/items/{ID}/pricing

NOTE
Prior to the Fall '20 release, the applyAdjustment API included a call to getCartsItems.
However, from the Fall '20 release, this API no longer calls getCartsItems. If you call this
API directly in custom code, ensure that you add a call to getCartLineItemPrices in your
code, after calling the applyAdjustment API. The response from this API has been updated
to include the itempricesupdated action to make a call to the next API.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method

applyAdjustment

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information

Response Format JSON


Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items/{ID}/pricing

© 2021 Vlocity LLC, a Salesforce


company 731
CME CPQ

Example Request
POST /services/apexrest/vlocity_cmt/v2/cpq/carts/80146000000gmxY/items/
80246000000gXh2/pricing
{
"adjustments": [
{
"AdjustmentValue": -10,
"AdjustmentMethod": "Absolute",
"DetailType": "ADJUSTMENT",
"Field": "nv_cmt_dev__OneTimeCharge__c"
}
]
}

Example Result
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"items": [
{
"quantity": 1,
"parentId": "80246000000hhNzAAI",
"itemId": "01u46000001Z8aCAAS"
}
],
"cartId": "80146000000h5jmAAA",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80146000000h5jmAAA/items"
},

© 2021 Vlocity LLC, a Salesforce


company 732
CME CPQ

"remote": {
"params": {
"methodName": "postCartsItems",
"items": [
{
"quantity": 1,
"parentId": "80246000000hhNzAAI",
"itemId": "01u46000001Z8aCAAS"
}
],
"cartId": "80146000000h5jmAAA",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"updateitems": {
"rest": {
"params": {
"items": [
{
"itemId": "80246000000hhNzAAI"
}
],
"filters": null,
"fields": null,
"cartId": "80146000000h5jmAAA",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80146000000h5jmAAA/items"
},
"remote": {

© 2021 Vlocity LLC, a Salesforce


company 733
CME CPQ

"params": {
"methodName": "putCartsItems",
"items": [
{
"itemId": "80246000000hhNzAAI"
}
],
"filters": null,
"fields": null,
"cartId": "80146000000h5jmAAA",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"deleteitem": {
"rest": {
"params": {},
"method": "DELETE",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80146000000h5jmAAA/items/80246000000hhNzAAI?
pagesize=20&includeAttachment=false&validate=true&price=true&cartId=80146000000
h5jmAAA&id=80246000000hhNzAAI"
},
"remote": {
"params": {
"methodName": "deleteCartsItems",
"id": "80246000000hhNzAAI",
"filters": null,
"fields": null,
"cartId": "80146000000h5jmAAA",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},

© 2021 Vlocity LLC, a Salesforce


company 734
CME CPQ

"client": {
"params": {}
}
},
"cloneitem": {
"rest": {
"params": {
"items": [
{
"itemId": "80246000000hhNzAAI"
}
],
"id": "80246000000hhNzAAI",
"cartId": "80146000000h5jmAAA"
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80146000000h5jmAAA/items/clone"
},
"remote": {
"params": {
"methodName": "cloneItems",
"items": [
{
"itemId": "80246000000hhNzAAI"
}
],
"id": "80246000000hhNzAAI",
"cartId": "80146000000h5jmAAA"
}
},
"client": {
"params": {}
}
},

NOTE
An entire result can be thousands of lines long. This example has been truncated.

© 2021 Vlocity LLC, a Salesforce


company 735
CME CPQ

Cancel Order
Cancel an order. Calling this API creates a supplemental order and submits it to Order Management
(XOM). After XOM processes the supplemental order, the original order is updated to canceled status.

POST /v2/cpq/carts/{cart_ID}/cancel

The Cancel Order API uses the Supplemental and Cancel Order interface implementations that predate the
CME Winter '20 release, including SupplementalOrderService and XOMSupplementalOrderLifeCycle. See
In-Flight Order Cancellation and Setting Up Supplemental Order Support for OM and OM Plus Fall ‘19 (or
the instructions for your pre-CME Winter '20 release). This API does not use Order Management
Integration Layer features.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method

cancelCart

REST Handler

APICancelCartsCPQV2

Apex Remote Service

CpqAppHandler

Apex Remote Input Map

{"methodName":"cancelCart", "cartId":"80146000000iwCx"}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information

Response Format JSON


Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/cancel

© 2021 Vlocity LLC, a Salesforce


company 736
CME CPQ

Example Request
POST /services/apexrest/v2/cpq/carts/{cart_ID}/cancel
{}

Example Request Body


{
"totalSize": 1,
"messages": [
{
"code": "305",
"severity": "INFO",
"message": "Your order has been cancelled."
}
],
"records": [
{
"displaySequence": -1,
"vlocity_cmt__OrderStatus__c": "Cancelled",
"vlocity_cmt__IsChangesAllowed__c": false
}
]
}

See Also

Check Status of the Cart


Return a summary of the cart status including pricing, account, multi-site, and additional action information.

• Pricing information, such as total one-time charges and total recurring charges
• Account information associated with the cart
• If the cart includes a multi-site order and available sites
• Links to further actions, such as checkout

GET /v2/cpq/carts/{cart_ID}/items/checkout

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
getCarts

© 2021 Vlocity LLC, a Salesforce


company 737
CME CPQ

REST Handler
CpqCreateCartActionV2

Apex Remote Service


Class: vlocity_cmt.CpqAppHandler
method: global Object invokeMethod(String methodName, Map<String,Object>
inputs, Map<String,Object> output, Map<String,Object> options)

Apex Remote Input Map


String methodName: checkout
Map<String,Object>
inputs: SAME AS SAMPLE REQUEST Body

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items/checkout

Example Request Body


{
"methodName": "checkout",
"cartId": "8012800000004GFAAY",
"ContextId": "8012800000004GFAAY",
"objectTypeToIdsToClone": "OrderItem:8021N000008NG5t",
"validateSubmittedXLI": false,
"checkOrderStatus": true,
"provisioningStatus": "Active"
}

The checkOrderStatus parameter indicates whether a set of status fields should be checked prior to
allowing an order to be checked out. If checkOrderStatus is set to true (the default):

• Any order that is active cannot be submitted.


• If any of the following is true, the order is determined to be active:
• Status has a value of Activated
• OrderStatus_c has any of the following values:
• In Progress
• Cancelled

© 2021 Vlocity LLC, a Salesforce


company 738
CME CPQ

• Cancel Requested
• Complete
• SupersededOrderId_c is not null

If checkOrderStatus is set to false, the order can be processed even if the order is active.

The validateSubmittedXLI parameter controls the pre-submit validation for the checkout API. If true, it
will validate whether the user has submitted complete bundles and if all the line items have the field
FulfilmentStatus__c value set to Activated. If either or both of those conditions are not met, the
transaction will fail.

Example Responses
The following example shows a response to a successful submit.

{
"totalSize": 1,
"messages": [
{
"code": "SUBMIT-1008",
"severity": "INFO",
"message": "Order 8012M000007mAQIQA2 was successfully assetized and
activated"
}
],
"records": [
{
"messages": [

],
"displaySequence": -1,
"id": "0012M00002GchG1QAJ",
"objectType": "Account",
"clonedObjectIds": [
"02i2M00000Q8FZNQA3",
"02i2M00000Q8FZOQA3"
]
}
]
}

The following example shows a response to a failed submit if validate is true and some or all the line items
are not activated.

{
"totalSize": 0,
"messages": [
{

© 2021 Vlocity LLC, a Salesforce


company 739
CME CPQ

"code": "214",
"severity": "ERROR",
"message": "The following line items are not activated:
8021N00000BS6TFQA1,8021N00000BS6VPQA1,8021N00000BS6VQQA1,8021N00000BS6TGQA1,802
1N00000BS6THQA1,8021N00000BS6TKQA1,8021N00000BS6TLQA1,8021N00000BS6TMQA1,8021N0
0000BS6TNQA1"
}
]
}

The following example shows a response to a failed submit if validate is true, some bundles are incomplete,
and some or all line items are not activated.

{
"totalSize": 0,
"messages": [
{
"code": "214",
"severity": "ERROR",
"message": "The following line items are not activated
8021N00000BS6VQQA1 | Please submit the full bundle for the following line
item(s) 8021N00000BS6VQQA1"
}
]
}

Message Codes
Code Description
SUBMIT-1001 Order submission is accepted by OM.
SUBMIT-1002 Order submission is provisionally accepted.
SUBMIT-1003 Order submission was rejected for PONR.
SUBMIT-1004 Order submission was rejected because queue is full.
SUBMIT-1005 Order submission is done without a required parameter. This will be used only during integration.
SUBMIT-1006 Order Management responded with an unknown response code.
SUBMIT-1007 Order Management responded with "rejected" and without a reason code.
SUBMIT-1008 Auto-assetization is successful, which happens if OdinAPIAutoAssetizeHandler is configured for OdinAPIHandler.
SUBMIT-1009 Order submission ran into an exception that may not be reproducible.

Checkout Items in Cart


Based on the header object, submit the object to create the quote, order, or assets.

• If the header object is Opportunity, submit the opportunity to create a quote.


• If the header object is Quote, submit the quote to create an order.
• If the header object is Order, submit the order to create assets.

© 2021 Vlocity LLC, a Salesforce


company 740
CME CPQ

POST /v2/cpq/carts/{cart_ID}/items/checkout

These APIs replace the following methods in OmniCPQServiceWrapper:

• Submit Opportunity replaces OmniCPQServceWrapper submitOpportunity.


• Submit Order replaces OmniCPQServiceWrapper submitOrder.
• Submit Quote replaces OmniCPQServiceWrapper submitQuote.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
checkout

REST Handler
APICheckoutItemsCartsCPQV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName:"checkout"
cartId:801360000008eNU
ContextId:801360000008eNU
}

ContextId is required for the Checkout Items in Cart remote action, which is used in the Guided Selling
OmniScript.

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/namespace/v2/cpq/carts/{cart_ID}/items/checkout

© 2021 Vlocity LLC, a Salesforce


company 741
CME CPQ

Example Request
POST
/v2/cpq/carts/{cart_ID}/items/checkout

Example Responses
Example 26. Submit Opportunity
{
"totalSize":1,
"messages":[],
"records":
[
{
"messages":[],
"displaySequence":-1,
"id":"0Q01I000000TvNmSAK",
"objectType":"Quote"
}
]
}

Example 27. Submit Order


"records": [
{
"messages": [],
"displaySequence": -1,
"id": "00146000004DeR9AAK",
"objectType": "Account"
}
]

Example 28. Submit Quote


{
"totalSize":1,
"messages":[],
"records":
[
{
"messages":[],
"displaySequence":-1,
"id":"8011I000000KZW3QAO",
"objectType":"Order"

© 2021 Vlocity LLC, a Salesforce


company 742
CME CPQ

}
]
}

Clone Line Items in Cart


Clone the line items within the current cart.

POST /v2/cpq/carts/{cart_ID}/items/clone

Remote Method
cloneItems

REST Handler
CpqCloneCartItemActionV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
"methodName": "cloneItems",
"cartId": "801360000008eNU",
"items":[ {"itemId":"01t36000000pfcKAAQ"}]
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items/clone

Example Request
POST
{
"items": [
{

© 2021 Vlocity LLC, a Salesforce


company 743
CME CPQ

"itemId": "item_ID"
}
]
}

Example Result
{
"totalSize" => 1, "messages" => [{
"severity" => "INFO",
"messageId" => nil,
"message" => "Clone Successful.",
"code" => "153",
"bundleId" => nil,
"actions" => {}
}], "actions" => {
"itempricesupdated" => {
"rest" => {
"params" => {}, "method" => "GET", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/price"
}, "remote" => {
"params" => {
"cartId" => "8016A000000bwDJQAY", "methodName" =>
"getCartLineItemPrices"
}
}, "client" => {
"params" => {}
}
}
}, "records" => [{
"messages" => [],
"actions" => {
"addtocart" => {
"rest" => {
"params" => {
"items" => [{
"quantity" => 1,
"parentId" => "8026A000000cCaQQAU",
"itemId" => "01u6A00000135XeQAI"
}], "cartId" => "8016A000000bwDJQAY", "price" => true,
"validate" => true, "includeAttachment" => false, "pagesize" => 20,
"lastRecordId" => nil, "query" => nil
}, "method" => "POST", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items"
}, "remote" => {
"params" => {

© 2021 Vlocity LLC, a Salesforce


company 744
CME CPQ

"methodName" => "postCartsItems", "items" => [{


"quantity" => 1,
"parentId" => "8026A000000cCaQQAU",
"itemId" => "01u6A00000135XeQAI"
}], "cartId" => "8016A000000bwDJQAY", "price" => true,
"validate" => true, "includeAttachment" => false, "pagesize" => 20,
"lastRecordId" => nil, "query" => nil
}
}, "client" => {
"params" => {}
}
}, "updateitems" => {
"rest" => {
"params" => {
"items" => [{
"itemId" => "8026A000000cCaQQAU"
}], "filters" => nil, "fields" => nil, "cartId" =>
"8016A000000bwDJQAY", "price" => true, "validate" => true, "includeAttachment"
=> false, "pagesize" => 20, "lastRecordId" => nil, "query" => nil
}, "method" => "PUT", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items"
}, "remote" => {
"params" => {
"methodName" => "putCartsItems", "items" => [{
"itemId" => "8026A000000cCaQQAU"
}], "filters" => nil, "fields" => nil, "cartId" =>
"8016A000000bwDJQAY", "price" => true, "validate" => true, "includeAttachment"
=> false, "pagesize" => 20, "lastRecordId" => nil, "query" => nil
}
}, "client" => {
"params" => {}
}
}, "deleteitem" => {
"rest" => {
"params" => {}, "method" => "DELETE", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items/8026A000000cCaQQAU?
pagesize=20&includeAttachment=false&validate=true&price=true&cartId=8016A000000
bwDJQAY&id=8026A000000cCaQQAU"
}, "remote" => {
"params" => {
"methodName" => "deleteCartsItems", "id" => "8026A000000cCaQQAU",
"filters" => nil, "fields" => nil, "cartId" => "8016A000000bwDJQAY", "price"
=> true, "validate" => true, "includeAttachment" => false, "pagesize" => 20,
"lastRecordId" => nil, "query" => nil
}
}, "client" => {

© 2021 Vlocity LLC, a Salesforce


company 745
CME CPQ

"params" => {}
}
}, "cloneitem" => {
"rest" => {
"params" => {
"items" => [{
"itemId" => "8026A000000cCaQQAU"
}], "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY"
}, "method" => "POST", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items/clone"
}, "remote" => {
"params" => {
"methodName" => "cloneItems", "items" => [{
"itemId" => "8026A000000cCaQQAU"
}], "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY"
}
}, "client" => {
"params" => {}
}
}, "modifyattributes" => {
"rest" => {
"params" => {
"items" => [{
"itemId" => "8026A000000cCaQQAU"
}], "filters" => nil, "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY"
}, "method" => "PUT", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items/8026A000000cCaQQAU/
itemAttributes"
}, "remote" => {
"params" => {
"methodName" => "putItemAttributes", "items" => [{
"itemId" => "8026A000000cCaQQAU"
}], "filters" => nil, "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY"
}
}, "client" => {
"params" => {}
}
}
},
"displaySequence" => -1,
"Id" => {
"value" => "8026A000000cCaQQAU", "previousValue" => nil, "originalValue"

© 2021 Vlocity LLC, a Salesforce


company 746
CME CPQ

=> nil, "messages" => [], "label" => "Order Product ID", "hidden" => false,
"fieldName" => "Id", "editable" => false, "dataType" => "ID", "actions" => {}
},
"Pricebook2Id" => "01s6A0000037JCtQAM",
"Product2Id" => "01t6A000000fd0AQAQ",
"ProductCode" => "IRKPL",
"UnitPrice" => {
"value" => 0.0, "previousValue" => nil, "originalValue" => nil,
"messages" => [], "label" => "Unit Price", "hidden" => true, "fieldName" =>
"UnitPrice", "editable" => false, "dataType" => "CURRENCY", "actions" => {}
},
"Name" => "IRKPL",
"vlocity_cmt__RecurringPrice__c" => 0.0,
"IsActive" => true,
"Product2" => {
"attributes" => {
"type" => "Product2", "url" => "/services/data/v40.0/sobjects/
Product2/01t6A000000fd0AQAQ"
}, "Name" => "IRKPL", "vlocity_cmt__IsConfigurable__c" => false,
"vlocity_cmt__Type__c" => "None", "vlocity_cmt__SubType__c" => "None",
"RecordTypeId" => "0126A000000gwBfQAI", "Id" => "01t6A000000fd0AQAQ",
"vlocity_cmt__JSONAttribute__c" => nil
},
"productId" => "01t6A000000fd0AQAQ",
"defaultQuantity" => 1.0,
"minQuantity" => 0.0,
"maxQuantity" => 99999.0,
"groupMinQuantity" => 0,
"groupMaxQuantity" => 99999,
"sequenceNumber" => 1.0,
"productChildItemDefinition" => {
"attributes" => {
"type" => "vlocity_cmt__ProductChildItem__c", "url" => "/services/
data/v40.0/sobjects/vlocity_cmt__ProductChildItem__c/a2a6A000000wm6XQAQ"
}, "vlocity_cmt__MinQuantity__c" => 0, "vlocity_cmt__SeqNumber__c" =>
1.0, "Name" => "Root PCI", "Id" => "a2a6A000000wm6XQAQ",
"vlocity_cmt__Quantity__c" => 1, "vlocity_cmt__MaximumChildItemQuantity__c" =>
99999, "vlocity_cmt__MaxQuantity__c" => 99999,
"vlocity_cmt__ParentProductId__r" => {
"attributes" => {
"type" => "Product2", "url" => "/services/data/v40.0/sobjects/
Product2/01t6A000000fd0AQAQ"
}, "Name" => "IRKPL", "Id" => "01t6A000000fd0AQAQ", "RecordTypeId"
=> "0126A000000gwBfQAI"
}, "vlocity_cmt__MinimumChildItemQuantity__c" => 0,
"vlocity_cmt__CollapseHierarchy__c" => false, "vlocity_cmt__IsOverride__c" =>

© 2021 Vlocity LLC, a Salesforce


company 747
CME CPQ

false, "vlocity_cmt__IsVirtualItem__c" => false,


"vlocity_cmt__ChildLineNumber__c" => "1",
"vlocity_cmt__IsRootProductChildItem__c" => true,
"vlocity_cmt__ParentProductId__c" => "01t6A000000fd0AQAQ"
},
"productHierarchyPath" => "01t6A000000fd0AQAQ",
"name" => "IRKPL",
"isVirtualItem" => false,
"provisioningStatus" => "New",
"hasChildren" => false,
"itemType" => "lineItem",
"PricebookEntryId" => {
"value" => "01u6A00000135XeQAI", "previousValue" => nil,
"originalValue" => nil, "messages" => [], "label" => "Price Book Entry ID",
"hidden" => false, "fieldName" => "PricebookEntryId", "editable" => false,
"dataType" => "REFERENCE", "actions" => {}
},
"Quantity" => {
"value" => 1.0, "previousValue" => nil, "originalValue" => nil,
"messages" => [], "label" => "Quantity", "hidden" => false, "fieldName" =>
"Quantity", "editable" => true, "dataType" => "DOUBLE", "actions" => {}
},
"vlocity_cmt__OneTimeTotal__c" => {
"value" => 10.0, "previousValue" => nil, "originalValue" => nil,
"messages" => [], "label" => "One Time Total", "hidden" => false, "fieldName"
=> "vlocity_cmt__OneTimeTotal__c", "editable" => false, "dataType" =>
"CURRENCY", "actions" => {
"adjustmentcodes" => {
"rest" => {
"params" => {}, "method" => "GET", "link" => "/services/
apexrest/vlocity_cmt/v2/listsofvalues?
listkeys=AdjustmentCodes&cartId=8016A000000bwDJQAY&id=8026A000000cCaQQAU&fields
=vlocity_cmt__OneTimeTotal__c&PricingVariableCode=OT_STD_PRC_TOTAL"
}, "remote" => {
"params" => {
"methodName" => "getListsOfValues",
"PricingVariableCode" => "OT_STD_PRC_TOTAL", "fields" =>
"vlocity_cmt__OneTimeTotal__c", "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY", "listkeys" => "AdjustmentCodes"
}
}, "client" => {
"records" => [], "params" => {}
}
}, "applyadjustment" => {
"rest" => {
"params" => {

© 2021 Vlocity LLC, a Salesforce


company 748
CME CPQ

"adjustments" => [{
"PricingVariableCode" => "OT_STD_PRC_TOTAL",
"AdjustmentCode" => "",
"AdjustmentValue" => 0,
"AdjustmentMethod" => "Percent",
"DetailType" => "ADJUSTMENT",
"Field" => "vlocity_cmt__OneTimeTotal__c"
}], "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY"
}, "method" => "POST", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items/8026A000000cCaQQAU/pricing"
}, "remote" => {
"params" => {
"methodName" => "applyAdjustment", "adjustments" => [{
"PricingVariableCode" => "OT_STD_PRC_TOTAL",
"AdjustmentCode" => "",
"AdjustmentValue" => 0,
"AdjustmentMethod" => "Percent",
"DetailType" => "ADJUSTMENT",
"Field" => "vlocity_cmt__OneTimeTotal__c"
}], "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY"
}
}, "client" => {
"records" => [], "params" => {}
}
}, "pricedetail" => {
"rest" => {
"params" => {}, "method" => "GET", "link" => "/services/
apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items/8026A000000cCaQQAU/
pricing?
cartId=8016A000000bwDJQAY&id=8026A000000cCaQQAU&fields=vlocity_cmt__OneTimeTota
l__c"
}, "remote" => {
"params" => {
"methodName" => "getPriceDetail", "fields" =>
"vlocity_cmt__OneTimeTotal__c", "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY"
}
}, "client" => {
"records" => [], "params" => {}
}
}
}
},
"vlocity_cmt__RecurringTotal__c" => {

© 2021 Vlocity LLC, a Salesforce


company 749
CME CPQ

"value" => 0.0, "previousValue" => nil, "originalValue" => nil,


"messages" => [], "label" => "Recurring Total", "hidden" => false, "fieldName"
=> "vlocity_cmt__RecurringTotal__c", "editable" => false, "dataType" =>
"CURRENCY", "actions" => {
"adjustmentcodes" => {
"rest" => {
"params" => {}, "method" => "GET", "link" => "/services/
apexrest/vlocity_cmt/v2/listsofvalues?
listkeys=AdjustmentCodes&cartId=8016A000000bwDJQAY&id=8026A000000cCaQQAU&fields
=vlocity_cmt__RecurringTotal__c&PricingVariableCode=REC_MNTH_STD_PRC_TOTAL"
}, "remote" => {
"params" => {
"methodName" => "getListsOfValues", "PricingVariableCode" =>
"REC_MNTH_STD_PRC_TOTAL", "fields" => "vlocity_cmt__RecurringTotal__c", "id"
=> "8026A000000cCaQQAU", "cartId" => "8016A000000bwDJQAY", "listkeys" =>
"AdjustmentCodes"
}
}, "client" => {
"records" => [], "params" => {}
}
}, "applyadjustment" => {
"rest" => {
"params" => {
"adjustments" => [{
"PricingVariableCode" => "REC_MNTH_STD_PRC_TOTAL",
"AdjustmentCode" => "",
"AdjustmentValue" => 0,
"AdjustmentMethod" => "Percent",
"DetailType" => "ADJUSTMENT",
"Field" => "vlocity_cmt__RecurringTotal__c"
}], "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY"
}, "method" => "POST", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items/8026A000000cCaQQAU/pricing"
}, "remote" => {
"params" => {
"methodName" => "applyAdjustment", "adjustments" => [{
"PricingVariableCode" => "REC_MNTH_STD_PRC_TOTAL",
"AdjustmentCode" => "",
"AdjustmentValue" => 0,
"AdjustmentMethod" => "Percent",
"DetailType" => "ADJUSTMENT",
"Field" => "vlocity_cmt__RecurringTotal__c"
}], "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY"
}

© 2021 Vlocity LLC, a Salesforce


company 750
CME CPQ

}, "client" => {
"records" => [], "params" => {}
}
}, "pricedetail" => {
"rest" => {
"params" => {}, "method" => "GET", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/items/8026A000000cCaQQAU/pricing?
cartId=8016A000000bwDJQAY&id=8026A000000cCaQQAU&fields=vlocity_cmt__RecurringTo
tal__c"
}, "remote" => {
"params" => {
"methodName" => "getPriceDetail", "fields" =>
"vlocity_cmt__RecurringTotal__c", "id" => "8026A000000cCaQQAU", "cartId" =>
"8016A000000bwDJQAY"
}
}, "client" => {
"records" => [], "params" => {}
}
}
}
},

NOTE
This example result has been truncated.

Create Cart
Create an opportunity, order, or quote based on the header object.

POST /v2/carts

Remote Method
createCart

REST Handler
CpqCreateCartActionV2

Apex Remote Service


CpqAppHandler

© 2021 Vlocity LLC, a Salesforce


company 751
CME CPQ

Apex Remote Input Maps


Example 29. Opportunity
{
"methodName": "createCart",
"objectType": "Opportunity"
"inputFields": [{
"Name": "TestOpportunity"
}, {
"StageName": "Prospecting"
}, {
"CloseDate": "3/19/2020"
}, {
"AccountId": "00141000009erCBAAY"
}],
"subaction": "createOppty",
"fields": "Id,Name,StageName"
}

Example 30. Order


{
"methodName": "createCart",
"objectType": "Order",
"inputFields": [{
"effectivedate": "12/7/2019"
}, {
"status": "Draft"
}, {
"Name": "Telco"
}, {
"AccountId": "00141000009erCBAAY"
}],
"subaction": "createOrder",
"fields": "Id,Name,EffectiveDate"
}

Example 31. Quote


{
"methodName": "createCart",
"objectType": "Quote",
"inputFields": [{
"OpportunityId": "6DG678HD234"
}, {

© 2021 Vlocity LLC, a Salesforce


company 752
CME CPQ

"Name": "Telco"
}, {
"AccountId": "00141000009erCBAAY"
}],
"subaction": "createQuote",
"fields": "Id,Name"
}

Package
Communication (vlocity_cmt)

API Parameters and response format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/carts

Example Requests

Example 32. Opportunity

POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
"inputFields": [
{
"Name": "Headless CPQ Oppty"
},
{
"StageName": "Prospecting"
},
{
"CloseDate": "6/19/2020"
},
{
"AccountId": "0011U00000W6H9p"
}
],
"filters": "Account.vlocity_cmt__Status__c:Inactive_Active",
"subaction": "createOppty",
"fields": "Id,Name,StageName"
}

© 2021 Vlocity LLC, a Salesforce


company 753
CME CPQ

Example 33. Order


POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
"methodName": "createCart",
"objectType": "Order",
"inputFields": [
{
"effectivedate": "12/03/2019"
},
{
"status": "Draft"
},
{
"Name": "Headless CPQ Order"
},
{
"AccountId": "0011U00000W6GvB"
}
],
"subaction": "createOrder",
"fields": "Id,Name,EffectiveDate"
}

Example 34. Quote


POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
"methodName": "createCart",
"objectType": "Quote",
"inputFields": [
{
"OpportunityId": "0061U000008fIUK"
},
{
"Name": "Headless CPQ Quote"
}
],
"subaction": "createQuote",
"fields": "Id,Name"
}

© 2021 Vlocity LLC, a Salesforce


company 754
CME CPQ

Example 35. Asset to Order

POST /services/apexrest/vlocity_cmt/v2/carts
Body:
{
"subaction":"assetToOrder",
"id":"01t36000000pfcKAAQ,02i6A000000YEXN",
"accountId":"0016A0000072D3y",
"requestDate":"2019-12-01"
}

See Also

• Create Cart (assetToOrder)

Create Cart (assetToOrder)


Create orders from existing assets by performing move, add, change, and delete (MACD) actions. Use
assetToOrder only for Future Dated Orders.

POST /v2/carts

Remote Method

assetToOrder

REST Handler

APICreateCartsCpqV2

Apex Remote Service

CpqAppHandler

Apex Remote Input Map

{
"methodName":"assetToOrder",
"id":"01t36000000pfcKAAQ,01t36000000pfcKAAR",
"accountId":"801360000008eNU",
"requestDateTime":"2021-10-7"
}

Package
Communication (vlocity_cmt)

© 2021 Vlocity LLC, a Salesforce


company 755
CME CPQ

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/carts

Example Request
To raise a Change Order for a specific time and date:

{
"subaction": "assetToOrder",
"id": "02i3O000006PrKSQA0",
"accountId": "0013O00000N6TEN",
"requestDateTime": "2021-11-10 10:24:04"
}

To raise a Change Order on the current time and date:

{
"subaction": "assetToOrder",
"id": "02i3O000006PrKSQA0",
"accountId": "0013O00000N6TEN",
"requestDateTime": "=NOW()"
}

Example Response
{
"totalSize": 0,
"messages": [],
"records": [
{
"messages": [],
"displaySequence": -1,
"cartId": "8014T000000MF5EQAW"
}
]
}

Create New Account for Current Site


Create a new account for the current site.

POST /v2/cpq/carts/{cart_ID}/sites

© 2021 Vlocity LLC, a Salesforce


company 756
CME CPQ

Remote Method

newSite

REST Handler

APISitesCartsCpqV2

Apex Remote Service

CpqAppHandler

Apex Remote Input Map

{
"methodName": "newSite",
"cartId": "801360000008eNU",
"objectType":"Account"
"inputFields":[{"value":"Test1234","fieldName":"name"}],
"fields":"Name,vlocity_cmt__Active__c"
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/sites

Example Request

POST
{
"objectType": "Account",
"inputFields": [{
"value": "Test1234",
"fieldName": "name"
}],
"fields": "Name,vlocity_cmt__Active__c"
}

© 2021 Vlocity LLC, a Salesforce


company 757
CME CPQ

Example Response
{
"totalSize" => 1,
"messages" => [],
"records" => [{
"messages" => [],
"displaySequence" => -1,
"Name" => "Test1234"
}]
}

Create String Translations


Add translations for strings.

POST /v2/stringtranslations/

Apex Remote Service


APIHandler

Handles the API request and finds the implementation for the request.

Remote Method
createStringTranslations

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Example POST Body


[
{
"vlocity_cmt_promotion__Translation__c": "addon-child2-24540_fr",
"vlocity_cmt_promotion__StringId__c": "a4E41000000TqVy",
"vlocity_cmt_promotion__LocaleCode__c": "fr"
},
{
"vlocity_cmt_promotion__Translation__c": "addon-child2-24540_de",
"vlocity_cmt_promotion__StringId__c": "a4E41000000TqVy",
"vlocity_cmt_promotion__LocaleCode__c": "de"
}
]

© 2021 Vlocity LLC, a Salesforce


company 758
CME CPQ

Example Response
{
"totalSize": 0,
"messages": [{
"code": "904",
"severity": "INFO",
"message": "Saved successfully."
}]
}

Create Supplemental Order


For CME Winter '20 and later releases, a supplemental order can be created to amend or cancel the
previous order.

For releases prior to CME Winter '20, any supplemental order is treated as an order cancellation. See In-
Flight Order Cancellation.

POST /v2/cpq/carts/{order_ID}/cancel

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
createSupplementalOrder

Apex Method
Use this CpqAppHandler method with the following inputs to create a supplemental order for an order that
is already in a frozen state.

• currentOrdId: The ID of the current order


• intentForSupplement: A string indicating the reason for creating the supplemental order, which can be
Cancel (the default) or Amend. If the intent is not specified, Cancel is used.

public static Id createSupplementalOrder(Id currentOrdId, String


intentForSupplement)
{
final String methodName = 'createSupplementalOrder';
Map<String, Object> inputMap = new Map<String, Object>
{
'cartId' => currentOrdId,
'intent' => intentForSupplement,
'methodName' => methodName
};

© 2021 Vlocity LLC, a Salesforce


company 759
CME CPQ

Map<String, Object> outputMap = new Map<String, Object>();


Map<String, Object> optionsMap = new Map<String, Object>();
vlocity_cmt.CpqAppHandler handler = new vlocity_cmt.CpqAppHandler();
handler.invokeMethod(methodName, inputMap, outputMap, optionsMap);

// traverse the result that was returned, to find the supplemental order
id.
vlocity_cmt.JSONResult result = (vlocity_cmt.JSONResult)
outputMap.get('result');
vlocity_cmt.JSONRecord record = result.records[0];
Id supplementalOrderId = (Id) record.fields.get('supplementalOrderId');
return supplementalOrderId;
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{order_ID}/cancel

Example Request
POST
/services/apexrest/v2/cpq/carts/{order_ID}/cancel

Example Request Body


{
"cartId": "order_ID",
"subaction": "createSupplementalOrder",
"intent": "Amend"
}

Message Codes
Code Description
SUPPLEMENT-1101 The createSupplementalOrder API accepts the intent parameter and its valid values: Amend and Cancel
(the default). If no value is passed, it is defaulted to Cancel. If an invalid value is passed, this error code is
returned.
SUPPLEMENT-1102 An internal error occurred during the createSupplementalOrder API call.

© 2021 Vlocity LLC, a Salesforce


company 760
CME CPQ

Code Description
SUPPLEMENT-1103 When the createSupplementalOrder API is invoked on an original order and the IsChangesAllowed flag is set
to false, this code is returned.
SUPPLEMENT-1104 When the createSupplementalOrder API is invoked on an order that is in a state other than In Progress, this
error code is returned.
SUPPLEMENT-1105 When the createSupplementalOrder API is invoked on an order that requires pricing and pricing
implementation errors out, then this code is returned.
SUPPLEMENT-1106 When the createSupplementalOrder API is invoked on an original order that already has a supplemental order,
this code is returned.

See Also
Cancel Order

Delete Adjustment
Delete an applied price adjustment for a line item in the cart, such as a discount, mark up, or override.

The PricingElementServiceImplementation supports this API.

POST /v2/cpq/carts/{cart_ID}/items/{ID}/pricing/{adjustment_ID}

NOTE
Prior to the Fall '20 release, the deleteAjustment API included a call to getCartsItems.
However, from the Fall '20 release, this API no longer calls getCartsItems. If you call this
API directly in custom code, ensure that you add a call to getCartLineItemPrices in your
code, after calling the deleteAdjustment API. The response from this API has been
updated to include the itempricesupdated action to make a call to the next API.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
deleteAdjustment

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

© 2021 Vlocity LLC, a Salesforce


company 761
CME CPQ

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cartId}/items/{id}/pricing/{adjustmentId}

Example Request
POST
/services/apexrest/vlocity_cmt/v2/cpq/carts/80146000000iJIZAA2/items/
80246000000iuDbAAI/pricing/a2H46000000hj2ZEAQ
{
"adjustments": [
{
"AdjustmentValue": -10,
"AdjustmentMethod": "Absolute",
"DetailType": "ADJUSTMENT",
"Field": "nv_cmt_dev__OneTimeCharge__c"
}
]
}

Example result
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"items": [
{
"quantity": 1,
"parentId": "80246000000hhNzAAI",
"itemId": "01u46000001Z8aCAAS"
}
],
"cartId": "80146000000h5jmAAA",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,

© 2021 Vlocity LLC, a Salesforce


company 762
CME CPQ

"lastRecordId": null,
"query": null
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80146000000h5jmAAA/items"
},
"remote": {
"params": {
"methodName": "postCartsItems",
"items": [
{
"quantity": 1,
"parentId": "80246000000hhNzAAI",
"itemId": "01u46000001Z8aCAAS"
}
],
"cartId": "80146000000h5jmAAA",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"updateitems": {
"rest": {
"params": {
"items": [
{
"itemId": "80246000000hhNzAAI"
}
],
"filters": null,
"fields": null,
"cartId": "80146000000h5jmAAA",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,

© 2021 Vlocity LLC, a Salesforce


company 763
CME CPQ

"query": null
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80146000000h5jmAAA/items"
},
"remote": {
"params": {
"methodName": "putCartsItems",
"items": [
{
"itemId": "80246000000hhNzAAI"
}
],
"filters": null,
"fields": null,
"cartId": "80146000000h5jmAAA",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"deleteitem": {
"rest": {
"params": {},
"method": "DELETE",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80146000000h5jmAAA/items/80246000000hhNzAAI?
pagesize=20&includeAttachment=false&validate=true&price=true&cartId=80146000000
h5jmAAA&id=80246000000hhNzAAI"
},
"remote": {
"params": {
"methodName": "deleteCartsItems",
"id": "80246000000hhNzAAI",
"filters": null,
"fields": null,
"cartId": "80146000000h5jmAAA",
"price": true,

© 2021 Vlocity LLC, a Salesforce


company 764
CME CPQ

"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"cloneitem": {
"rest": {
"params": {
"items": [
{
"itemId": "80246000000hhNzAAI"
}
],
"id": "80246000000hhNzAAI",
"cartId": "80146000000h5jmAAA"
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80146000000h5jmAAA/items/clone"
},
"remote": {
"params": {
"methodName": "cloneItems",
"items": [
{
"itemId": "80246000000hhNzAAI"
}
],
"id": "80246000000hhNzAAI",
"cartId": "80146000000h5jmAAA"
}
},
"client": {
"params": {}
}
},
"modifyattributes": {
"rest": {
"params": {
"items": [

© 2021 Vlocity LLC, a Salesforce


company 765
CME CPQ

{
"itemId": "80246000000hhNzAAI"
}
],
"filters": null,
"id": "80246000000hhNzAAI",
"cartId": "80146000000h5jmAAA"
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80146000000h5jmAAA/items/80246000000hhNzAAI/itemAttributes"
},
"remote": {
"params": {
"methodName": "putItemAttributes",
"items": [
{
"itemId": "80246000000hhNzAAI"
}
],
"filters": null,
"id": "80246000000hhNzAAI",
"cartId": "80146000000h5jmAAA"
}
},
"client": {
"params": {}
}
},
"getpromodetails": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80146000000h5jmAAA/promotions?
cartId=80146000000h5jmAAA&id=80246000000hhNzAAI&promotionIds=a2F46000000kmtNEAQ
&subaction=promodetails"
},
"remote": {
"params": {
"methodName": "getPromotionDetails",
"subaction": "promodetails",
"promotionIds": "a2F46000000kmtNEAQ",
"id": "80246000000hhNzAAI",
"cartId": "80146000000h5jmAAA"
}

© 2021 Vlocity LLC, a Salesforce


company 766
CME CPQ

},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"value": "80246000000hhNzAAI",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"Pricebook2Id": "01s46000003EDDHAA4",
"Product2Id": "01t46000000Lo2mAAC",
"ProductCode": "BUNDLE_A",
"UnitPrice": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Unit Price",
"hidden": true,
"fieldName": "UnitPrice",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"Name": "Bundle A",
"vlocity_cmt__RecurringPrice__c": 0,
"IsActive": true,
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v39.0/sobjects/Product2/01t46000000Lo2mAAC"
},
"Id": "01t46000000Lo2mAAC",
"Description": "Bundle A",
"Name": "Bundle A",
"vlocity_cmt__IsConfigurable__c": false,

© 2021 Vlocity LLC, a Salesforce


company 767
CME CPQ

"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "01246000000hFtZAAU",
"vlocity_cmt__JSONAttribute__c": null
},

NOTE
This example has been truncated.

Delete Applied Promo Items


Delete applied promotion items from cart.

DELETE /v2/cpq/carts/{cart_ID}/promotions

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
deletePromotionItems

REST Handler
APIPromotionsCartsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
"id": "a2Lf40000008nL5EAI",
"cartId": "801f40000012NEIAA2",
"methodName": "deleteAppliedPromoItems",
"price": true,
"validate": true
}

© 2021 Vlocity LLC, a Salesforce


company 768
CME CPQ

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/promotions

Example Request
DELETE
/services/apexrest/vlocity_cmt/v2/cpq/carts/801f40000012NEIAA2/promotions

Request Body:
{
"id": "a2Lf40000008nL5EAI",
"cartId": "801f40000012NEIAA2",
"methodName": "deleteAppliedPromoItems",
"price": true,
"validate": true
}

Example Response
{
"totalSize": 0,
"messages": [
{
"severity": "INFO",
"messageId": null,
"message": "Successfully deleted.",
"code": "152",
"bundleId": null,
"actions": {}
}
],
"actions": {
"itemdeleted": {
"rest": {
"params": {},
"method": null,
"link": null
},

© 2021 Vlocity LLC, a Salesforce


company 769
CME CPQ

"remote": {
"params": {}
},
"client": {
"params": {
"items": [
{
"message": "add TestProd-12 bundle has been deleted from the
cart.",
"Id": "a2Lf40000008nL5EAI"
}
]
}
}
}
}
}

Delete String Translations


Delete the specified string translation.

DELETE /v2/stringtranslations/ID

Apex Remote Service


APIHandler

Remote Method
deleteStringTranslations

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Discard Supplemental Order


For CME Winter '20 and later releases, the discardOrder API is invoked on a supplemental order if the
supplemental order is not submitted and the user wants to discard a supplemental order and proceed with
the original order’s fulfillment.

Apex Method
Use this method with the supplemental order's ID as input (supplementalOrdId) to discard a
supplemental order request.

© 2021 Vlocity LLC, a Salesforce


company 770
CME CPQ

public static void unfreezeOrder(Id supplementalOrdId)


{
final String methodName = 'discardOrder';
Map<String, Object> inputMap = new Map<String, Object>
{
'cartId' => supplementalOrdId,
'methodName' => methodName
};
Map<String, Object> outputMap = new Map<String, Object>();
Map<String, Object> optionsMap = new Map<String, Object>();
vlocity_cmt.CpqAppHandler handler = new vlocity_cmt.CpqAppHandler();
handler.invokeMethod(methodName, inputMap, outputMap, optionsMap);
// traverse the result that was returned, to find the supplemental order
id.
vlocity_cmt.JSONResult result = (vlocity_cmt.JSONResult)
outputMap.get('result');
}

See Also
• Create Supplemental Order
• Unfreeze Order

Expand Items
Retrieves the next level of children of product in a bundle (in cart). The intent of this API is to improve
performance when refreshing big product bundles in carts by returning child items when parent items are
clicked.

GET /v2/cpq/carts/{cart_ID}/items/{item_ID}/expand

Remote Method
getExpandedItems

Handlers
REST Endpoint: APIExpandItemCartsCpqv2.cls
Implementation: CpqExpandCartItemActionV2.cls

Apex remote service


CpqAppHandler

Apex remote input map


{
methodName: getExpandedItems

© 2021 Vlocity LLC, a Salesforce


company 771
CME CPQ

productHierarchyPath:"01t36000004hM92AAE<01t36000004hM8xAAE"
itemId: 80236000009E2InAAK
cartId: 80136000000OXQvAAO
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items/{item_ID}/expand

Example Request
GET /services/apexrest/vlocity_cmt/v2/cpq/carts/80146000000iwCx/
items/80236000009E2InAAK/expand?
productHierarchyPath=01t36000004hM92AAE<01t36000004hM8xAAE

Example Result
{
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"actions": {
"expanditems": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80136000000OXQvAAO/items/80236000009E2InAAK/expand?
cartId=80136000000OXQvAAO&itemId=80236000009E2InAAK&productHierarchyPath=01t360
00004hM92AAE<01t36000004hM8xAAE"
},
"remote": {
"params": {
"methodName": "getExpandedItems",
"productHierarchyPath": "01t36000004hM92AAE<01t36000004hM8xAAE",
"itemId": "80236000009E2InAAK",
"cartId": "80136000000OXQvAAO"
}

© 2021 Vlocity LLC, a Salesforce


company 772
CME CPQ

},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"label": "Price Book Entry ID",
"value": "01u36000009qFdRAAU"
},
"Pricebook2Id": {
"label": "Price Book ID",
"value": "01s36000006iLkuAAE"
},
"Product2Id": {
"label": "Product ID",
"value": "01t36000004hM8xAAE"
},
"ProductCode": {
"label": "Product Code",
"value": "es-aug-vhcild1"
},
"UnitPrice": {
"label": "List Price",
"value": null
},
"Name": {
"label": "Product Name",
"value": "es-aug-vhcild1"
},
"vlocity_cmt__RecurringPrice__c": {
"label": "Recurring Price",
"value": null
},
"IsActive": {
"label": "Active",
"value": true
},
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/Product2/01t36000004hM8xAAE"
},
"Description": "es-aug-vhcild1",
"Name": "es-aug-vhcild1",

© 2021 Vlocity LLC, a Salesforce


company 773
CME CPQ

"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"Id": "01t36000004hM8xAAE",
"vlocity_cmt__JSONAttribute__c": null
},
"productId": "01t36000004hM8xAAE",
"defaultQuantity": 1.0,
"minQuantity": 0.0,
"maxQuantity": 99999.0,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1.00,
"productChildItemId": "a1x36000002sB2zAAE",
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v41.0/sobjects/vlocity_cmt__ProductChildItem__c/
a1x36000002sB2zAAE"
},
"vlocity_cmt__IsVirtualItem__c": true,
"vlocity_cmt__ChildLineNumber__c": "1",
"Name": "a1x36000002sB2z",
"vlocity_cmt__SeqNumber__c": 1.00,
"Id": "a1x36000002sB2zAAE",
"vlocity_cmt__ChildProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/Product2/01t36000004hM8xAAE"
},
"Name": "es-aug-vhcild1",
"Id": "01t36000004hM8xAAE"
},
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__ParentProductId__c": "01t36000004hM92AAE",
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__IsRootProductChildItem__c": false,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/Product2/01t36000004hM92AAE"
},

© 2021 Vlocity LLC, a Salesforce


company 774
CME CPQ

"Name": "es-aug-bundle",
"Id": "01t36000004hM92AAE"
},
"vlocity_cmt__ChildProductId__c": "01t36000004hM8xAAE",
"vlocity_cmt__IsOverride__c": false
},
"productHierarchyPath": "01t36000004hM92AAE<01t36000004hM8xAAE",
"isVirtualItem": true,
"attributeValues": {},
"hasChildren": true,
"itemType": "productGroup",
"parentLineItemId": "80236000009E2InAAK",
"productCategories": {
"totalSize": 0,
"messages": []
},
"childProducts": {
"totalSize": 0,
"messages": [],
"records": [{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"items": [{
"parentId": "80236000009E2InAAK",
"parentHierarchyPath":
"01t36000004hM92AAE<01t36000004hM8xAAE",
"itemId": "01u36000009qFeFAAU"
}],
"cartId": "80136000000OXQvAAO",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80136000000OXQvAAO/items"
},
"remote": {
"params": {
"methodName": "postCartsItems",

© 2021 Vlocity LLC, a Salesforce


company 775
CME CPQ

"items": [{
"parentId": "80236000009E2InAAK",
"parentHierarchyPath":
"01t36000004hM92AAE<01t36000004hM8xAAE",
"itemId": "01u36000009qFeFAAU"
}],
"cartId": "80136000000OXQvAAO",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"getproductbyid": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80136000000OXQvAAO/products?cartId=80136000000OXQvAAO&id=01u36000009qFeFAAU"
},
"remote": {
"params": {
"methodName": "getCartsProductsById",
"id": "01u36000009qFeFAAU",
"cartId": "80136000000OXQvAAO"
}
},
"client": {
"params": {
"cartId": "80136000000OXQvAAO",
"id": "01u36000009qFeFAAU",
"methodName": "getCartsProductsById"
}
}
}
},
"displaySequence": -1,
"Id": {
"label": "Price Book Entry ID",
"value": "01u36000009qFeFAAU"

© 2021 Vlocity LLC, a Salesforce


company 776
CME CPQ

},
"Pricebook2Id": {
"label": "Price Book ID",
"value": "01s36000006iLkuAAE"
},
"Product2Id": {
"label": "Product ID",
"value": "01t36000004hM97AAE"
},
"ProductCode": {
"label": "Product Code",
"value": "es-aug-addon1"
},
"UnitPrice": {
"label": "List Price",
"value": null
},
"Name": {
"label": "Product Name",
"value": "es-aug-addon1"
},
"vlocity_cmt__RecurringPrice__c": {
"label": "Recurring Price",
"value": null
},
"IsActive": {
"label": "Active",
"value": true
},
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/Product2/01t36000004hM97AAE"
},
"Description": "es-aug-addon1",
"Name": "es-aug-addon1",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"Id": "01t36000004hM97AAE",
"vlocity_cmt__JSONAttribute__c": null
},
"productId": "01t36000004hM97AAE",
"defaultQuantity": 0.0,
"minQuantity": 0.0,
"maxQuantity": 5.0,

© 2021 Vlocity LLC, a Salesforce


company 777
CME CPQ

"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1.00,
"productChildItemId": "a1x36000002sB39AAE",
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v41.0/sobjects/
vlocity_cmt__ProductChildItem__c/a1x36000002sB39AAE"
},
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__ChildLineNumber__c": "1",
"Name": "a1x36000002sB39",
"vlocity_cmt__SeqNumber__c": 1.00,
"Id": "a1x36000002sB39AAE",
"vlocity_cmt__ChildProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/
Product2/01t36000004hM97AAE"
},
"Name": "es-aug-addon1",
"Id": "01t36000004hM97AAE"
},
"vlocity_cmt__Quantity__c": 0,
"vlocity_cmt__ParentProductId__c": "01t36000004hM8xAAE",
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__MaxQuantity__c": 5,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__IsRootProductChildItem__c": false,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/
Product2/01t36000004hM8xAAE"
},
"Name": "es-aug-vhcild1",
"Id": "01t36000004hM8xAAE"
},
"vlocity_cmt__ChildProductId__c": "01t36000004hM97AAE",
"vlocity_cmt__IsOverride__c": false
},
"productHierarchyPath":
"01t36000004hM92AAE<01t36000004hM8xAAE<01t36000004hM97AAE",

© 2021 Vlocity LLC, a Salesforce


company 778
CME CPQ

"isVirtualItem": false,
"attributeValues": {},
"hasChildren": false,
"itemType": "childProduct",
"productCategories": {
"totalSize": 0,
"messages": []
}
}]
}
}]
}

Freeze Order
Freeze the order's fulfillment in the order management system.

POST /v2/cpq/carts/{order_ID}/prevalidate

Before canceling an order, call the order management system and return the real-time point of no return
(PONR) status to confirm that the order can be canceled.

With CME Winter '20 and later releases, clicking the Cancel button calls the CPQ/CancelOrder OmniScript,
which calls the preValidate and createSupplementalOrder methods.

Prior to CME Winter '20, the Cancel Order button was displayed and it would call the submitCancelOrder
method. For backward compatibility, you can adjust the value of the
OriginalOrderCancellationStatusChanges configuration setting.

The preValidate method freezes the order's fulfillment in the order management system, which can respond
with one of the following:

• Accepted: The fulfillment is (or can be eventually) frozen. When the order management system accepts
the freeze order request, Odin will set the Order.OrderStatus__c to the Frozen state.
• Rejected: The fulfillment cannot be Frozen. Odin looks for the reasonCode field. If the reasonCode value
is PONR, Odin sets the Changes Allowed flag in the Order and OrderItem to false.

Remote Method
preValidate

REST Handler
APIPrevalidateCartsCPQV2

Apex
public static void preValidate(Id orderId)
{

© 2021 Vlocity LLC, a Salesforce


company 779
CME CPQ

vlocity_cmt.CpqAppHandler handler = new vlocity_cmt.CpqAppHandler();

/** Setup Input and Output maps **/


Map<String, Object> inputMap = new Map<String, Object>
{
'cartId' => orderId
};
Map<String, Object> outputMap = new Map<String, Object>();
Map<String, Object> optionsMap = new Map<String, Object>();

handler.invokeMethod('preValidate', inputMap, outputMap, optionsMap);


}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{order_ID}/prevalidate
Request Body {"cartId": "order_ID"}

Message Codes
Code Description
FREEZE-1026 The preValidate API can make a Freeze Order request to the Order Management System (OM). This code indicates
that OM accepted the Freeze Order request.
FREEZE-1027 The preValidate API can make a Freeze Order request to the Order Management System (OM). This code indicates
that OM rejected the Freeze Order request.
FREEZE-1028 The preValidate API can make a Freeze Order request to the Order Management System (OM). This code indicates
that parameters required by OdinAPIHandler (orderIdList) were not passed. To avoid this, use standard Vlocity-
provided implementations for OdinAPIHandler interface.
FREEZE-1029 The preValidate API can make a Freeze Order request to the Order Management System (OM). If OM returns an
unrecognized response, then this code is returned by preValidate API. Only Accepted and Rejected are recognized
responses for Freeze Order request.
FREEZE-1030 The preValidate API can make a Freeze Order request to the Order Management System (OM). If the OM rejects
the request, it can send the reasonCode field to specify why the request was rejected. Recognized reasonCode
values include PONR, UNKNOWN, and EXCEPTION. If OM returns any other reasonCode, the preValidate API returns
this error code.
INVOKE-500 The preValidate API was called with an incorrect cart ID.

© 2021 Vlocity LLC, a Salesforce


company 780
CME CPQ

See Also
• In-Flight Order Cancellation
• OdinAPIHandler
• Unfreeze Order

Get Account Details


Retrieve the details for a specified account ID.

GET /v2/accounts/{account_ID}

Remote Method
getAccounts

Handlers
REST Endpoint: APIAccountsV2.cls
Implementation: CpqGetAccountsActionV2.cls

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName: getAccounts
id: 0011I000007lzDO
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/accounts/{account_ID}

Example Request
GET
/services/apexrest/vlocity_cmt/v2/accounts/0011I000007lzDO?fields=OwnerId,Name

© 2021 Vlocity LLC, a Salesforce


company 781
CME CPQ

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"displaySequence": -1,
"OwnerId": "0051I000000Qvb4QAC",
"Name": "AR3"
}
]
}

Get Applied or Available Promotions for Cart


Get a list of promotions. The API can return a sorted list of promotions based on the sortBy input
parameter.

GET /v2/cpq/carts/{cart_ID}/promotions

The filters parameter specifies the filters to use to determine the subset of promotions to return. Each
filters parameter specifies the field and values to match. The fields parameter specifies the
Promotion__c fields to return in the API response.

The filters parameter input is a comma-separated list of sObject fields and values. If one of the fields
does not match any sObject fields, it will be discarded. If the filters parameter specifies multiple values
separated by underscores, the API matches the field value with OR, for example, SubClass_c:HD_SD will
match SubClassc='HD'OR SubClass_c='SD'.

To specify a promotion name using a locale other than the user's locale, set the localeCode parameter to
the desired locale and the query parameter to the name of the promotion. For example:

GET /services/apexrest/vlocity_cmt/v2/cpq/carts/8011N000002BL2P/promotions?
localeCode=fr&query=échantillon

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
getPromotionList

REST Handler
APIPromotionsCartsCpqV2

© 2021 Vlocity LLC, a Salesforce


company 782
CME CPQ

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
"methodName": "getPromotionList",
"cartId": "801360000008eNU"
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/promotions

Example Request
GET /services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000bARD/promotions?
filters=vlocity_cmt_Codec:Test1,Name:Promo1_Promo2&fields=Name,vlocity_cmtCodec
,vlocity_cmtIsActive_c

Example Result
{
"totalSize" => 2,
"messages" => [],
"records" => [{
"messages" => [],
"actions" => {
"addtocart" => {
"rest" => {
"params" => {
"items" => [{
"itemId" => "a2f6A000000hDwJQAU"
}]
}, "method" => "POST", "link" => "/services/apexrest/vlocity_cmt/v2/cpq/
carts/8016A000000bwG3QAI/promotions"
},
"remote" => {

© 2021 Vlocity LLC, a Salesforce


company 783
CME CPQ

"params" => {
"items" => [{
"itemId" => "a2f6A000000hDwJQAU"
}], "promotionId" => "a2f6A000000hDwJQAU", "cartId" =>
"8016A000000bwG3QAI", "methodName" => "postCartsPromoItems"
}
},
"client" => {
"params" => {}
}
},
"validatecart" => {
"rest" => {
"params" => {}, "method" => "POST", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwG3QAI/validate"
},
"remote" => {
"params" => {
"cartId" => "8016A000000bwG3QAI", "methodName" => "runCartValidation"
}
},
"client" => {
"params" => {}
}
}
},
"displaySequence" => 0,
"name" => "PromoOne",
"code" => "PromoOne",
"id" => "a2f6A000000hDwJQAU",
"category" => "Qualified"
},
{
"messages" => [],
"actions" => {
"addtocart" => {
"rest" => {
"params" => {
"items" => [{
"itemId" => "a2f6A000000hpOHQAY"
}]
}, "method" => "POST", "link" => "/services/apexrest/vlocity_cmt/v2/cpq/
carts/8016A000000bwG3QAI/promotions"
},
"remote" => {
"params" => {

© 2021 Vlocity LLC, a Salesforce


company 784
CME CPQ

"items" => [{
"itemId" => "a2f6A000000hpOHQAY"
}], "promotionId" => "a2f6A000000hpOHQAY", "cartId" =>
"8016A000000bwG3QAI", "methodName" => "postCartsPromoItems"
}
},
"client" => {
"params" => {}
}
},
"validatecart" => {
"rest" => {
"params" => {}, "method" => "POST", "link" => "/services/apexrest/
vlocity_cmt/v2/cpq/carts/8016A000000bwG3QAI/validate"
},
"remote" => {
"params" => {
"cartId" => "8016A000000bwG3QAI", "methodName" => "runCartValidation"
}
},
"client" => {
"params" => {}
}
}
},
"displaySequence" => 1,
"name" => "2146PROMO",
"code" => "2146PROMO",
"id" => "a2f6A000000hpOHQAY",
"category" => "Qualified"
}
]
}

Get Applied Promotions for Account


Return the applied promotions for a specified account ID.

GET /v2/accounts/{account_ID}/promotions

Remote Method
getAppliedPromotionsByAccount

Handlers
REST Endpoint: APIAppliedPromotionsAccountsV2.cls
Implementation: CpqAppliedPromotionsAccountActionV2.cls

© 2021 Vlocity LLC, a Salesforce


company 785
CME CPQ

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName:getAppliedPromotionsByAccount
accounttId:0011I000007lzDO
fields:"vlocity_cmt__CancellationDate__c,vlocity_cmt__AppliesTo__c"
pagesize:2
filters:vlocity_cmt__AppliesTo__c:Account_Contract
commitmentDateFilter:2017-04-05T07:00:00.000Z
appliedPromoStatusFilter:Active
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/vlocity_cmt/v2/cpq/carts/{account_ID}/promotions?
subaction=getPromotionsAppliedToCart

Example Request
GET /services/apexrest/vlocity_cmt/v2/cpq/carts/801360000000oQ9/promotions

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"displaySequence": -1,
"Id": {
"value": "a1if4000000Z1wTAAS",
"previousValue": null,
"originalValue": null,
"messages": [],

© 2021 Vlocity LLC, a Salesforce


company 786
CME CPQ

"label": "Record ID",


"hidden": true,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"vlocity_cmt__BillingAccountId__c": {
"value": "001f40000093uqMAAQ",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Account",
"hidden": true,
"fieldName": "vlocity_cmt__BillingAccountId__c",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"vlocity_cmt__PromotionId__c": {
"value": "a2ff4000000cHPMAA2",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Promotion",
"hidden": true,
"fieldName": "vlocity_cmt__PromotionId__c",
"editable": true,
"dataType": "REFERENCE",
"actions": {}
},
"vlocity_cmt__Sequence__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Sequence",
"hidden": true,
"fieldName": "vlocity_cmt__Sequence__c",
"editable": true,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__CancellationDate__c": {
"value": null,
"previousValue": null,

© 2021 Vlocity LLC, a Salesforce


company 787
CME CPQ

"originalValue": null,
"messages": [],
"label": "Cancellation Date",
"hidden": true,
"fieldName": "vlocity_cmt__CancellationDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"vlocity_cmt__CommitmentStartDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Commitment Start Date",
"hidden": true,
"fieldName": "vlocity_cmt__CommitmentStartDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"vlocity_cmt__AppliesTo__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Applies To",
"hidden": true,
"fieldName": "vlocity_cmt__AppliesTo__c",
"editable": true,
"dataType": "PICKLIST",
"actions": {}
},
"vlocity_cmt__CancellationStatus__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Cancellation Status",
"hidden": true,
"fieldName": "vlocity_cmt__CancellationStatus__c",
"editable": true,
"dataType": "PICKLIST",
"actions": {}
},
"vlocity_cmt__ReasonForCancellation__c": {

© 2021 Vlocity LLC, a Salesforce


company 788
CME CPQ

"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Reason for Cancellation",
"hidden": true,
"fieldName": "vlocity_cmt__ReasonForCancellation__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__CommitmentEndDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Commitment End Date",
"hidden": true,
"fieldName": "vlocity_cmt__CommitmentEndDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"vlocity_cmt__PricingStartDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Benefit Start Date",
"hidden": true,
"fieldName": "vlocity_cmt__PricingStartDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"vlocity_cmt__PricingEndDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Benefit End Date",
"hidden": true,
"fieldName": "vlocity_cmt__PricingEndDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}

© 2021 Vlocity LLC, a Salesforce


company 789
CME CPQ

},
"Name": "BundleJul19Promo",
"Description": "BundleJul19Promo"
}
]
}{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"displaySequence": -1,
"Id": {
"value": "a1if4000000Z1wTAAS",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Record ID",
"hidden": true,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"cmt_araov100_1__BillingAccountId__c": {
"value": "001f40000093uqMAAQ",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Account",
"hidden": true,
"fieldName": "cmt_araov100_1__BillingAccountId__c",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"cmt_araov100_1__PromotionId__c": {
"value": "a2ff4000000cHPMAA2",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Promotion",
"hidden": true,
"fieldName": "cmt_araov100_1__PromotionId__c",
"editable": true,
"dataType": "REFERENCE",

© 2021 Vlocity LLC, a Salesforce


company 790
CME CPQ

"actions": {}
},
"cmt_araov100_1__Sequence__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Sequence",
"hidden": true,
"fieldName": "cmt_araov100_1__Sequence__c",
"editable": true,
"dataType": "DOUBLE",
"actions": {}
},
"cmt_araov100_1__CancellationDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Cancellation Date",
"hidden": true,
"fieldName": "cmt_araov100_1__CancellationDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"cmt_araov100_1__CommitmentStartDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Commitment Start Date",
"hidden": true,
"fieldName": "cmt_araov100_1__CommitmentStartDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"cmt_araov100_1__AppliesTo__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Applies To",
"hidden": true,
"fieldName": "cmt_araov100_1__AppliesTo__c",

© 2021 Vlocity LLC, a Salesforce


company 791
CME CPQ

"editable": true,
"dataType": "PICKLIST",
"actions": {}
},
"cmt_araov100_1__CancellationStatus__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Cancellation Status",
"hidden": true,
"fieldName": "cmt_araov100_1__CancellationStatus__c",
"editable": true,
"dataType": "PICKLIST",
"actions": {}
},
"cmt_araov100_1__ReasonForCancellation__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Reason for Cancellation",
"hidden": true,
"fieldName": "cmt_araov100_1__ReasonForCancellation__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"cmt_araov100_1__CommitmentEndDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Commitment End Date",
"hidden": true,
"fieldName": "cmt_araov100_1__CommitmentEndDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"cmt_araov100_1__PricingStartDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Benefit Start Date",

© 2021 Vlocity LLC, a Salesforce


company 792
CME CPQ

"hidden": true,
"fieldName": "cmt_araov100_1__PricingStartDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"cmt_araov100_1__PricingEndDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Benefit End Date",
"hidden": true,
"fieldName": "cmt_araov100_1__PricingEndDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"Name": "BundleJul19Promo",
"Description": "BundleJul19Promo"
}
]
}

Get Asset Pricing


Retrieve pricing details for a price field for the specified cart and line item. Supported by Pricing
ElementServiceImplementation.

GET /v2/assets/{ID}/pricing?accountId={account_ID}

Remote Method
getAssetPriceDetail

Handlers
REST endpoint: APIAssetsPricingV2.cls
Implementation: CpqAssetsAccountsActionV2.cls

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
"methodName": "getAssetPriceDetail",

© 2021 Vlocity LLC, a Salesforce


company 793
CME CPQ

"id": "02i46000000htMrAAI",
"accountId": "0014600000qExFDAA0",
"effectiveAssetsDateFilter": "2017-11-06T00:00:00Z"
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/assets/{ID}/pricing?accountId={account_ID}

Example Request
GET
/services/apexrest/vlocity_cmt/v2/assets/02i46000000htMrAAI/pricing?
accountId=0014600000qExFDAA0&effectiveAssetsDateFilter=2017-11-06T00:00:00Z

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"displaySequence": -1,
"id": "02i46000000htMrAAI",
"vlocity_cmt__OneTimeCharge__c": {
"pricedetail": [
{
"actions": {},
"DetailType": "PRICE",
"Description": "Product B Base $100 Charge",
"StartValue": 100,
"EndValue": 100,
"AdjustmentType": "None",
"AdjustmentMethod": null,
"AdjustmentValue": 0
}
]
},

© 2021 Vlocity LLC, a Salesforce


company 794
CME CPQ

"vlocity_cmt__OneTimeCalculatedPrice__c": {
"pricedetail": [
{
"actions": {},
"DetailType": null,
"Description": "One Time Charge (100.00) - One Time Manual
Discount (0.00%)",
"StartValue": null,
"EndValue": null,
"AdjustmentType": null,
"AdjustmentMethod": null,
"AdjustmentValue": null
}
]
},
"vlocity_cmt__OneTimeTotal__c": {
"pricedetail": [
{
"actions": {},
"DetailType": null,
"Description": "[One Time Calculated Price (100.00) + Rollup One
Time Total (0.00)] x Quantity (1.00)",
"StartValue": null,
"EndValue": null,
"AdjustmentType": null,
"AdjustmentMethod": null,
"AdjustmentValue": null
}
]
},
"vlocity_cmt__RecurringCharge__c": {
"pricedetail": [
{
"actions": {},
"DetailType": "PRICE",
"Description": "$10 MRC",
"StartValue": 10,
"EndValue": 10,
"AdjustmentType": "None",
"AdjustmentMethod": null,
"AdjustmentValue": 0
},
{
"actions": {},
"DetailType": "ADJUSTMENT",
"Description": "Markup applied by Agent",

© 2021 Vlocity LLC, a Salesforce


company 795
CME CPQ

"StartValue": 10,
"EndValue": 15,
"AdjustmentType": "Markup",
"AdjustmentMethod": "Percent",
"AdjustmentValue": 50
}
]
},
"vlocity_cmt__RecurringCalculatedPrice__c": {
"pricedetail": [
{
"actions": {},
"DetailType": null,
"Description": "Recurring Charge (15.0000) - Recurring Manual
Discount (0.00%)",
"StartValue": null,
"EndValue": null,
"AdjustmentType": null,
"AdjustmentMethod": null,
"AdjustmentValue": null
}
]
},
"vlocity_cmt__RecurringTotal__c": {
"pricedetail": [
{
"actions": {},
"DetailType": null,
"Description": "[Recurring Calculated Price (15.00) + Rollup
Recurring Total (0.00)] x Quantity (1.00)",
"StartValue": null,
"EndValue": null,
"AdjustmentType": null,
"AdjustmentMethod": null,
"AdjustmentValue": null
}
]
}
}
]
}

Get Assets for Account


Retrieve the assets for a specified account ID.

GET /v2/assets/{ID}/pricing?accountId={account_ID}

© 2021 Vlocity LLC, a Salesforce


company 796
CME CPQ

Remote Method
getAssetsByAccount

Handlers
REST Endpoint: APIAssetsContractsV2.cls
Implementation: CpqAssetsContractsActionV2.cls

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


methodName: getAssetsByAccount
accountId: 0011I000007lzDO
includes: noContractAssets
effectiveAssetsDateFilter: 2019-04-05T07:00:00.000Z
pagesize: 2

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/accounts/{account_ID}/assets

Example Request
GET /services/apexrest/vlocity_cmt/v2/accounts/0011I000007lzDO/assets?
pagesize=2&includes=noContractAssets&effectiveAssetsDateFilter=2019-04-05T07:00
:00.000Z

Example Response
{
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"actions": {

© 2021 Vlocity LLC, a Salesforce


company 797
CME CPQ

"assetchangesite": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/carts?
subaction=assetChangeSite"
},
"remote": {
"params": {
"assetList": ["02i1I00000058doQAA"],
"moveDate": null,
"toServiceLocation": null,
"fromServiceLocation": null
}
},
"client": {
"params": {}
}
},
"assettoquote": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/carts?subaction=assetToQuote"
},
"remote": {
"params": {
"assetList": ["02i1I00000058doQAA"],
"requestDate": null
}
},
"client": {
"params": {}
}
},
"assettoorder": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/carts?subaction=assetToOrder"
},
"remote": {
"params": {
"assetList": ["02i1I00000058doQAA"],
"requestDate": null
}

© 2021 Vlocity LLC, a Salesforce


company 798
CME CPQ

},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"value": "02i1I00000058doQAA",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Asset ID",
"hidden": true,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"Quantity": {
"value": 1.00,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Quantity",
"hidden": true,
"fieldName": "Quantity",
"editable": false,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__ProvisioningStatus__c": {
"value": "Active",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Provisioning Status",
"hidden": true,
"fieldName": "vlocity_cmt__ProvisioningStatus__c",
"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RecurringTotal__c": {
"value": 10.00,
"previousValue": null,

© 2021 Vlocity LLC, a Salesforce


company 799
CME CPQ

"originalValue": null,
"messages": [],
"label": "Recurring Total",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {
"pricedetail": {
"rest": {
"params": {},
"method": "GET",
link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02
i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ &
priceDetailsFields = vlocity_cmt__RecurringTotal__c &
effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "

},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
"priceDetailsFields": "vlocity_cmt__RecurringTotal__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],
"params": {}
}
}
}
},
"vlocity_cmt__OneTimeTotal__c": {
"value": 100.00,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "One Time Total",
"hidden": true,
"fieldName": "vlocity_cmt__OneTimeTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {

© 2021 Vlocity LLC, a Salesforce


company 800
CME CPQ

"pricedetail": {
"rest": {
"params": {},
"method": "GET",
link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02
i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ &
priceDetailsFields = vlocity_cmt__RecurringTotal__c &
effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "

},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
"priceDetailsFields": "vlocity_cmt__OneTimeTotal__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],
"params": {}
}
}
}
},
"vlocity_cmt__ContractId__c": {
"value": "8001I0000000ThqQAE",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Contract",
"hidden": false,
"fieldName": "vlocity_cmt__ContractId__c",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"vlocity_cmt__LineNumber__c": {
"value": "0001",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Line Number",
"hidden": true,

© 2021 Vlocity LLC, a Salesforce


company 801
CME CPQ

"fieldName": "vlocity_cmt__LineNumber__c",
"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RootItemId__c": {
"value": "02i1I00000058doQAA",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "RootItemId",
"hidden": true,
"fieldName": "vlocity_cmt__RootItemId__c",
"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__OneTimeCharge__c": {
"value": 100.00,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "One Time Charge",
"hidden": true,
"fieldName": "vlocity_cmt__OneTimeCharge__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {
"pricedetail": {
"rest": {
"params": {},
"method": "GET",
link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02
i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ &
priceDetailsFields = vlocity_cmt__RecurringTotal__c &
effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "

},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
"priceDetailsFields": "vlocity_cmt__OneTimeCharge__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"

© 2021 Vlocity LLC, a Salesforce


company 802
CME CPQ

}
},
"client": {
"records": [],
"params": {}
}
}
}
},
"vlocity_cmt__OneTimeCalculatedPrice__c": {
"value": 100.00,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "One Time Calculated Price",
"hidden": true,
"fieldName": "vlocity_cmt__OneTimeCalculatedPrice__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {
"pricedetail": {
"rest": {
"params": {},
"method": "GET",
link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02
i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ &
priceDetailsFields = vlocity_cmt__RecurringTotal__c &
effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "

},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
"priceDetailsFields": "vlocity_cmt__OneTimeCalculatedPrice__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],
"params": {}
}
}
}

© 2021 Vlocity LLC, a Salesforce


company 803
CME CPQ

},
"vlocity_cmt__OneTimeManualDiscount__c": {
"value": 0.00,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "One Time Manual Discount",
"hidden": true,
"fieldName": "vlocity_cmt__OneTimeManualDiscount__c",
"editable": false,
"dataType": "PERCENT",
"actions": {}
},
"vlocity_cmt__RecurringCharge__c": {
"value": 10.00,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Recurring Charge",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringCharge__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {
"pricedetail": {
"rest": {
"params": {},
"method": "GET",
link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02
i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ &
priceDetailsFields = vlocity_cmt__RecurringTotal__c &
effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "

},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
"priceDetailsFields": "vlocity_cmt__RecurringCharge__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],

© 2021 Vlocity LLC, a Salesforce


company 804
CME CPQ

"params": {}
}
}
}
},
"vlocity_cmt__RecurringCalculatedPrice__c": {
"value": 10.00,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Recurring Calculated Price",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringCalculatedPrice__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {
"pricedetail": {
"rest": {
"params": {},
"method": "GET",
link ": " / services / apexrest / vlocity_cmt / v2 / assets / 02
i1I00000058doQAA / pricing ? accountId = 0011 I000007ms8TQAQ &
priceDetailsFields = vlocity_cmt__RecurringTotal__c &
effectiveAssetsDateFilter = 2019 - 04 - 05 T07 : 00: 00.000 Z "

},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2019-04-05T07:00:00.000Z",
"priceDetailsFields": "vlocity_cmt__RecurringCalculatedPrice__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],
"params": {}
}
}
}
},
"vlocity_cmt__RecurringManualDiscount__c": {
"value": 0.00,
"previousValue": null,

© 2021 Vlocity LLC, a Salesforce


company 805
CME CPQ

"originalValue": null,
"messages": [],
"label": "Recurring Manual Discount",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringManualDiscount__c",
"editable": false,
"dataType": "PERCENT",
"actions": {}
},
"vlocity_cmt__ServiceAccountId__c": {
"value": "0011I000007ms8TQAQ",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Service Account",
"hidden": false,
"fieldName": "vlocity_cmt__ServiceAccountId__c",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"vlocity_cmt__BillingAccountId__c": {
"value": "0011I000007ms8TQAQ",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Billing Account",
"hidden": false,
"fieldName": "vlocity_cmt__BillingAccountId__c",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"vlocity_cmt__PricingLogData__c": {
"value": "{\"LogData\":{\"OT_STD_PRC\":[{\"PriceListEntryId
\":\"a2X1I0000009iFXUAY\",\"LogType\":\"PRICE\",\"PricingElementGlobalKey
\":\"775e358f-31c4-e8de-e23d-e00bbbfedfa6\",\"StartValue\":100.00,\"SubType
\":\"Standard\",\"Frequency\":null,\"ChargeTiming\":\"One-time\",\"EndValue
\":100.00,\"DisplayText\":\"100$ OTSP\",\"PricingVariableCode\":\"OT_STD_PRC
\",\"PricingElementId\":\"a2a1I000000Bar6QAC\",\"PromotionId\":null,\"OfferId
\":null,\"PriceListId\":\"a2Y1I000000TlsrUAC\",\"BaseAdjustment
\":null,\"BaseValue\":100.00,\"AdjustmentMethod\":null,\"AdjustmentValue
\":0.00,\"Amount\":100.00,\"AdjustmentType\":\"None\",\"LogSequence
\":0}],\"REC_MNTH_STD_PRC\":[{\"PriceListEntryId\":\"a2X1I0000009iFcUAI
\",\"LogType\":\"PRICE\",\"PricingElementGlobalKey\":\"9ef41d53-1bba-017e-625a-
b06ac2de2c28\",\"StartValue\":10.00,\"SubType\":\"Standard\",\"Frequency

© 2021 Vlocity LLC, a Salesforce


company 806
CME CPQ

\":\"Monthly\",\"ChargeTiming\":\"Recurring\",\"EndValue\":10.00,\"DisplayText
\":\"10$ RMSP\",\"PricingVariableCode\":\"REC_MNTH_STD_PRC\",\"PricingElementId
\":\"a2a1I000000Bar1QAC\",\"PromotionId\":null,\"OfferId\":null,\"PriceListId
\":\"a2Y1I000000TlsrUAC\",\"BaseAdjustment\":null,\"BaseValue
\":10.00,\"AdjustmentMethod\":null,\"AdjustmentValue\":0.00,\"Amount
\":10.00,\"AdjustmentType\":\"None\",\"LogSequence\":0}],\"OT_STD_PRC_CALC\":
[{\"LogSequence\":0,\"DisplayText\":\"One Time Charge (100.00) - One Time
Manual Discount (0.00%)\"}],\"OT_STD_PRC_TOTAL\":[{\"LogSequence
\":0,\"DisplayText\":\"[One Time Calculated Price (100.00) + Rollup One Time
Total (0.00)] x Quantity (1.00)\"}],\"REC_MNTH_STD_PRC_CALC\":[{\"LogSequence
\":0,\"DisplayText\":\"Recurring Charge (10.00) - Recurring Manual Discount
(0.00%)\"}],\"REC_MNTH_STD_PRC_TOTAL\":[{\"LogSequence\":0,\"DisplayText
\":\"[Recurring Calculated Price (10.00) + Rollup Recurring Total (0.00)] x
Quantity (1.00)\"}]},\"PricingVariableCodeFieldBinding\":{\"Quantity
\":\"LINE_QUANTITY\",\"vlocity_cmt__EffectiveRecurringTotal__c
\":\"EFF_REC_MNTH_STD_PRC_TOTAL\",\"vlocity_cmt__EffectiveOneTimeTotal__c
\":\"EFF_OT_STD_PRC_TOTAL\",\"vlocity_cmt__OneTimeCalculatedPrice__c
\":\"OT_STD_PRC_CALC\",\"vlocity_cmt__OneTimeManualDiscount__c
\":\"OT_STD_PRC_DISC_PCT_MAN\",\"vlocity_cmt__OneTimeCharge__c\":\"OT_STD_PRC
\",\"vlocity_cmt__RecurringTotal__c\":\"REC_MNTH_STD_PRC_TOTAL
\",\"vlocity_cmt__RecurringCalculatedPrice__c\":\"REC_MNTH_STD_PRC_CALC
\",\"vlocity_cmt__RecurringManualDiscount__c\":\"REC_MNTH_STD_PRC_DISC_PCT_MAN
\",\"vlocity_cmt__RecurringCharge__c\":\"REC_MNTH_STD_PRC
\",\"vlocity_cmt__OneTimeTotal__c\":\"OT_STD_PRC_TOTAL
\",\"vlocity_cmt__EffectiveQuantity__c\":\"EFFECTIVE_QUANTITY
\"},\"PriceAdjustmentPromoKeys\":[],\"PricingVariableCodeValues\":
{\"LINE_QUANTITY\":1.00,\"OT_STD_PRC_DISC_PCT_MAN
\":0.00,\"REC_MNTH_STD_PRC_DISC_PCT_MAN\":0.00,\"OT_STD_PRC
\":100.00,\"OT_STD_PRC_CALC\":100.00,\"OT_STD_PRC_TOTAL
\":100.00,\"REC_MNTH_STD_PRC\":10.00,\"REC_MNTH_STD_PRC_CALC
\":10.00,\"REC_MNTH_STD_PRC_TOTAL\":10.00,\"ROLLUP_OT_STD_PRC_TOTAL
\":0.00,\"ROLLUP_REC_MNTH_STD_PRC_TOTAL\":0.00,\"EFF_OT_STD_PRC_TOTAL
\":100.00,\"EFF_REC_MNTH_STD_PRC_TOTAL\":10.00,\"EFFECTIVE_QUANTITY
\":1.00},\"PricingVariableCodeBaseValues\":{\"OT_STD_PRC
\":100.00,\"REC_MNTH_STD_PRC\":10.00},\"LogVersion\":\"1.0\",\"LastPricingTime
\":\"2019-11-07T10:21:55.572Z\"}",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Pricing Log",
"hidden": true,
"fieldName": "vlocity_cmt__PricingLogData__c",
"editable": false,
"dataType": "TEXTAREA",
"actions": {}
},

© 2021 Vlocity LLC, a Salesforce


company 807
CME CPQ

"vlocity_cmt__SequenceNumber__c": {
"value": 1,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Sequence Number",
"hidden": true,
"fieldName": "vlocity_cmt__SequenceNumber__c",
"editable": false,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__PricebookEntryId__c": {
"value": "01u1I000000ZY4nQAG",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "PricebookEntryId",
"hidden": true,
"fieldName": "vlocity_cmt__PricebookEntryId__c",
"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__EffectiveQuantity__c": {
"value": 1.00,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Effective Quantity",
"hidden": true,
"fieldName": "vlocity_cmt__EffectiveQuantity__c",
"editable": false,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__EffectiveRecurringTotal__c": {
"value": 10.00,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Effective Recurring Total",
"hidden": true,
"fieldName": "vlocity_cmt__EffectiveRecurringTotal__c",
"editable": false,
"dataType": "CURRENCY",

© 2021 Vlocity LLC, a Salesforce


company 808
CME CPQ

"actions": {}
},
"vlocity_cmt__EffectiveOneTimeTotal__c": {
"value": 100.00,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Effective One Time Total",
"hidden": true,
"fieldName": "vlocity_cmt__EffectiveOneTimeTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"Name": "TestA",
"promotions": {
"totalSize": 0,
"messages": []
}
}]
}

Get Assets for Contract


Retrieve the assets for a specified contract ID.

GET /v2/contracts/{contract_ID}/assets

Remote Method
getAssetsByContract

Handlers
REST Endpoint: APIAssetsContractsV2.cls
Implementation: CpqAssetsContractsActionV2.cls

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


methodName: getAssetsByContract
contractId: 8001I0000000Thq
effectiveAssetsDateFilter: 2020-04-05T07:00:00.000Z
pagesize: 2

© 2021 Vlocity LLC, a Salesforce


company 809
CME CPQ

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/contracts/{contract_ID}/assets

Example Request
GET
/services/apexrest/vlocity_cmt/v2/contracts/8001I0000000Thq/assets?
pagesize=2&includes=noContractAssets&effectiveAssetsDateFilter=2020-04-05T07:00
:00.000Z

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"actions": {
"assetchangesite": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/carts?
subaction=assetChangeSite"
},
"remote": {
"params": {
"assetList": [
"02i1I00000058doQAA"
],
"moveDate": null,
"toServiceLocation": null,
"fromServiceLocation": null
}
},
"client": {
"params": {}

© 2021 Vlocity LLC, a Salesforce


company 810
CME CPQ

}
},
"assettoquote": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/carts?
subaction=assetToQuote"
},
"remote": {
"params": {
"assetList": [
"02i1I00000058doQAA"
],
"requestDate": null
}
},
"client": {
"params": {}
}
},
"assettoorder": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/carts?
subaction=assetToOrder"
},
"remote": {
"params": {
"assetList": [
"02i1I00000058doQAA"
],
"requestDate": null
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"value": "02i1I00000058doQAA",
"previousValue": null,
"originalValue": null,

© 2021 Vlocity LLC, a Salesforce


company 811
CME CPQ

"messages": [],
"label": "Asset ID",
"hidden": true,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"Quantity": {
"value": 1,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Quantity",
"hidden": true,
"fieldName": "Quantity",
"editable": false,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__ProvisioningStatus__c": {
"value": "Active",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Provisioning Status",
"hidden": true,
"fieldName": "vlocity_cmt__ProvisioningStatus__c",
"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RecurringTotal__c": {
"value": 10,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Recurring Total",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {
"pricedetail": {
"rest": {
"params": {},

© 2021 Vlocity LLC, a Salesforce


company 812
CME CPQ

"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/assets/
02i1I00000058doQAA/pricing?
accountId=0011I000007ms8TQAQ&priceDetailsFields=vlocity_cmt__RecurringTotal__c&
effectiveAssetsDateFilter=2020-04-05T07:00:00.000Z"
},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2020-04-05T07:00:00.000Z",
"priceDetailsFields": "vlocity_cmt__RecurringTotal__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],
"params": {}
}
}
}
},
"vlocity_cmt__OneTimeTotal__c": {
"value": 100,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "One Time Total",
"hidden": true,
"fieldName": "vlocity_cmt__OneTimeTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {
"pricedetail": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/assets/
02i1I00000058doQAA/pricing?
accountId=0011I000007ms8TQAQ&priceDetailsFields=vlocity_cmt__OneTimeTotal__c&ef
fectiveAssetsDateFilter=2020-04-05T07:00:00.000Z"
},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2020-04-05T07:00:00.000Z",

© 2021 Vlocity LLC, a Salesforce


company 813
CME CPQ

"priceDetailsFields": "vlocity_cmt__OneTimeTotal__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],
"params": {}
}
}
}
},
"vlocity_cmt__ContractId__c": {
"value": "8001I0000000ThqQAE",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Contract",
"hidden": false,
"fieldName": "vlocity_cmt__ContractId__c",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"vlocity_cmt__LineNumber__c": {
"value": "0001",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Line Number",
"hidden": true,
"fieldName": "vlocity_cmt__LineNumber__c",
"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RootItemId__c": {
"value": "02i1I00000058doQAA",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "RootItemId",
"hidden": true,
"fieldName": "vlocity_cmt__RootItemId__c",

© 2021 Vlocity LLC, a Salesforce


company 814
CME CPQ

"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__OneTimeCharge__c": {
"value": 100,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "One Time Charge",
"hidden": true,
"fieldName": "vlocity_cmt__OneTimeCharge__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {
"pricedetail": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/assets/
02i1I00000058doQAA/pricing?
accountId=0011I000007ms8TQAQ&priceDetailsFields=vlocity_cmt__OneTimeCharge__c&e
ffectiveAssetsDateFilter=2020-04-05T07:00:00.000Z"
},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2020-04-05T07:00:00.000Z",
"priceDetailsFields": "vlocity_cmt__OneTimeCharge__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],
"params": {}
}
}
}
},
"vlocity_cmt__OneTimeCalculatedPrice__c": {
"value": 100,
"previousValue": null,
"originalValue": null,
"messages": [],

© 2021 Vlocity LLC, a Salesforce


company 815
CME CPQ

"label": "One Time Calculated Price",


"hidden": true,
"fieldName": "vlocity_cmt__OneTimeCalculatedPrice__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {
"pricedetail": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/assets/
02i1I00000058doQAA/pricing?
accountId=0011I000007ms8TQAQ&priceDetailsFields=vlocity_cmt__OneTimeCalculatedP
rice__c&effectiveAssetsDateFilter=2020-04-05T07:00:00.000Z"
},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2020-04-05T07:00:00.000Z",
"priceDetailsFields": "vlocity_cmt__OneTimeCalculatedPrice__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],
"params": {}
}
}
}
},
"vlocity_cmt__OneTimeManualDiscount__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "One Time Manual Discount",
"hidden": true,
"fieldName": "vlocity_cmt__OneTimeManualDiscount__c",
"editable": false,
"dataType": "PERCENT",
"actions": {}
},
"vlocity_cmt__RecurringCharge__c": {
"value": 10,

© 2021 Vlocity LLC, a Salesforce


company 816
CME CPQ

"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Recurring Charge",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringCharge__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {
"pricedetail": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/assets/
02i1I00000058doQAA/pricing?
accountId=0011I000007ms8TQAQ&priceDetailsFields=vlocity_cmt__RecurringCharge__c
&effectiveAssetsDateFilter=2020-04-05T07:00:00.000Z"
},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2020-04-05T07:00:00.000Z",
"priceDetailsFields": "vlocity_cmt__RecurringCharge__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],
"params": {}
}
}
}
},
"vlocity_cmt__RecurringCalculatedPrice__c": {
"value": 10,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Recurring Calculated Price",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringCalculatedPrice__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {

© 2021 Vlocity LLC, a Salesforce


company 817
CME CPQ

"pricedetail": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/assets/
02i1I00000058doQAA/pricing?
accountId=0011I000007ms8TQAQ&priceDetailsFields=vlocity_cmt__RecurringCalculate
dPrice__c&effectiveAssetsDateFilter=2020-04-05T07:00:00.000Z"
},
"remote": {
"params": {
"effectiveAssetsDateFilter": "2020-04-05T07:00:00.000Z",
"priceDetailsFields":
"vlocity_cmt__RecurringCalculatedPrice__c",
"priceDetail": true,
"id": "02i1I00000058doQAA",
"accountId": "0011I000007ms8TQAQ",
"methodName": "getAssetPriceDetail"
}
},
"client": {
"records": [],
"params": {}
}
}
}
},
"vlocity_cmt__RecurringManualDiscount__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Recurring Manual Discount",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringManualDiscount__c",
"editable": false,
"dataType": "PERCENT",
"actions": {}
},
"vlocity_cmt__ServiceAccountId__c": {
"value": "0011I000007ms8TQAQ",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Service Account",
"hidden": false,

© 2021 Vlocity LLC, a Salesforce


company 818
CME CPQ

"fieldName": "vlocity_cmt__ServiceAccountId__c",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"vlocity_cmt__BillingAccountId__c": {
"value": "0011I000007ms8TQAQ",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Billing Account",
"hidden": false,
"fieldName": "vlocity_cmt__BillingAccountId__c",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"vlocity_cmt__PricingLogData__c": {
"value": "{\"LogData\":{\"OT_STD_PRC\":[{\"PriceListEntryId
\":\"a2X1I0000009iFXUAY\",\"LogType\":\"PRICE\",\"PricingElementGlobalKey
\":\"775e358f-31c4-e8de-e23d-e00bbbfedfa6\",\"StartValue\":100.00,\"SubType
\":\"Standard\",\"Frequency\":null,\"ChargeTiming\":\"One-time\",\"EndValue
\":100.00,\"DisplayText\":\"100$ OTSP\",\"PricingVariableCode\":\"OT_STD_PRC
\",\"PricingElementId\":\"a2a1I000000Bar6QAC\",\"PromotionId\":null,\"OfferId
\":null,\"PriceListId\":\"a2Y1I000000TlsrUAC\",\"BaseAdjustment
\":null,\"BaseValue\":100.00,\"AdjustmentMethod\":null,\"AdjustmentValue
\":0.00,\"Amount\":100.00,\"AdjustmentType\":\"None\",\"LogSequence
\":0}],\"REC_MNTH_STD_PRC\":[{\"PriceListEntryId\":\"a2X1I0000009iFcUAI
\",\"LogType\":\"PRICE\",\"PricingElementGlobalKey\":\"9ef41d53-1bba-017e-625a-
b06ac2de2c28\",\"StartValue\":10.00,\"SubType\":\"Standard\",\"Frequency
\":\"Monthly\",\"ChargeTiming\":\"Recurring\",\"EndValue\":10.00,\"DisplayText
\":\"10$ RMSP\",\"PricingVariableCode\":\"REC_MNTH_STD_PRC\",\"PricingElementId
\":\"a2a1I000000Bar1QAC\",\"PromotionId\":null,\"OfferId\":null,\"PriceListId
\":\"a2Y1I000000TlsrUAC\",\"BaseAdjustment\":null,\"BaseValue
\":10.00,\"AdjustmentMethod\":null,\"AdjustmentValue\":0.00,\"Amount
\":10.00,\"AdjustmentType\":\"None\",\"LogSequence\":0}],\"OT_STD_PRC_CALC\":
[{\"LogSequence\":0,\"DisplayText\":\"One Time Charge (100.00) - One Time
Manual Discount (0.00%)\"}],\"OT_STD_PRC_TOTAL\":[{\"LogSequence
\":0,\"DisplayText\":\"[One Time Calculated Price (100.00) + Rollup One Time
Total (0.00)] x Quantity (1.00)\"}],\"REC_MNTH_STD_PRC_CALC\":[{\"LogSequence
\":0,\"DisplayText\":\"Recurring Charge (10.00) - Recurring Manual Discount
(0.00%)\"}],\"REC_MNTH_STD_PRC_TOTAL\":[{\"LogSequence\":0,\"DisplayText
\":\"[Recurring Calculated Price (10.00) + Rollup Recurring Total (0.00)] x
Quantity (1.00)\"}]},\"PricingVariableCodeFieldBinding\":{\"Quantity
\":\"LINE_QUANTITY\",\"vlocity_cmt__EffectiveRecurringTotal__c
\":\"EFF_REC_MNTH_STD_PRC_TOTAL\",\"vlocity_cmt__EffectiveOneTimeTotal__c

© 2021 Vlocity LLC, a Salesforce


company 819
CME CPQ

\":\"EFF_OT_STD_PRC_TOTAL\",\"vlocity_cmt__OneTimeCalculatedPrice__c
\":\"OT_STD_PRC_CALC\",\"vlocity_cmt__OneTimeManualDiscount__c
\":\"OT_STD_PRC_DISC_PCT_MAN\",\"vlocity_cmt__OneTimeCharge__c\":\"OT_STD_PRC
\",\"vlocity_cmt__RecurringTotal__c\":\"REC_MNTH_STD_PRC_TOTAL
\",\"vlocity_cmt__RecurringCalculatedPrice__c\":\"REC_MNTH_STD_PRC_CALC
\",\"vlocity_cmt__RecurringManualDiscount__c\":\"REC_MNTH_STD_PRC_DISC_PCT_MAN
\",\"vlocity_cmt__RecurringCharge__c\":\"REC_MNTH_STD_PRC
\",\"vlocity_cmt__OneTimeTotal__c\":\"OT_STD_PRC_TOTAL
\",\"vlocity_cmt__EffectiveQuantity__c\":\"EFFECTIVE_QUANTITY
\"},\"PriceAdjustmentPromoKeys\":[],\"PricingVariableCodeValues\":
{\"LINE_QUANTITY\":1.00,\"OT_STD_PRC_DISC_PCT_MAN
\":0.00,\"REC_MNTH_STD_PRC_DISC_PCT_MAN\":0.00,\"OT_STD_PRC
\":100.00,\"OT_STD_PRC_CALC\":100.00,\"OT_STD_PRC_TOTAL
\":100.00,\"REC_MNTH_STD_PRC\":10.00,\"REC_MNTH_STD_PRC_CALC
\":10.00,\"REC_MNTH_STD_PRC_TOTAL\":10.00,\"ROLLUP_OT_STD_PRC_TOTAL
\":0.00,\"ROLLUP_REC_MNTH_STD_PRC_TOTAL\":0.00,\"EFF_OT_STD_PRC_TOTAL
\":100.00,\"EFF_REC_MNTH_STD_PRC_TOTAL\":10.00,\"EFFECTIVE_QUANTITY
\":1.00},\"PricingVariableCodeBaseValues\":{\"OT_STD_PRC
\":100.00,\"REC_MNTH_STD_PRC\":10.00},\"LogVersion\":\"1.0\",\"LastPricingTime
\":\"2020-11-07T10:21:55.572Z\"}",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Pricing Log",
"hidden": true,
"fieldName": "vlocity_cmt__PricingLogData__c",
"editable": false,
"dataType": "TEXTAREA",
"actions": {}
},
"vlocity_cmt__SequenceNumber__c": {
"value": 1,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Sequence Number",
"hidden": true,
"fieldName": "vlocity_cmt__SequenceNumber__c",
"editable": false,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__PricebookEntryId__c": {
"value": "01u1I000000ZY4nQAG",
"previousValue": null,
"originalValue": null,

© 2021 Vlocity LLC, a Salesforce


company 820
CME CPQ

"messages": [],
"label": "PricebookEntryId",
"hidden": true,
"fieldName": "vlocity_cmt__PricebookEntryId__c",
"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__EffectiveQuantity__c": {
"value": 1,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Effective Quantity",
"hidden": true,
"fieldName": "vlocity_cmt__EffectiveQuantity__c",
"editable": false,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__EffectiveRecurringTotal__c": {
"value": 10,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Effective Recurring Total",
"hidden": true,
"fieldName": "vlocity_cmt__EffectiveRecurringTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__EffectiveOneTimeTotal__c": {
"value": 100,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Effective One Time Total",
"hidden": true,
"fieldName": "vlocity_cmt__EffectiveOneTimeTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"Name": "TestA",
"promotions": {

© 2021 Vlocity LLC, a Salesforce


company 821
CME CPQ

"totalSize": 0,
"messages": []
}
}
]
}

Get Available Sites


Get the available records for the billing account or service account lookup field.

GET /v2/cpq/carts/{cart_ID}/sites?id={item_ID},lookupField={field_name},
[fields]={field names to return}

Remote Method

getAvailableSites

REST Handler

APISitesCartsCpqV2

Apex Remote Service

CpqAppHandler

Apex Remote Input Map

{
"methodName": "priceCart",
"cartId": "801360000008eNU",
"id":"01t36000000pfcKAAQ"
"lookupField": "vlocity_cmt__BillingAccountId__c"
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Example Request

GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/8014100000009fU/sites

© 2021 Vlocity LLC, a Salesforce


company 822
CME CPQ

Example Result
{
"totalSize" => 2,
"messages" => [],
"actions" => {
"newsite" => {
"rest" => {
"params" => {
"fields" => "'Id'",
"inputFields" =>
"[{\"value\":null,\"previousValue\":null,\"originalValue\":null,\"messages
\":[],\"label\":\"Account Name\",\"hidden\":null,\"fieldName\":\"name
\",\"editable\":true,\"dataType\":\"STRING\",\"actions\":{}}]",
"objectType" => "Account"
},
"method" => "POST",
"link" => "/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwG8QAI/
sites"
},
"remote" => {
"params" => {
"fields" => "'Id'",
" inputFields" =>
"[{\"value\":null,\"previousValue\":null,\"originalValue\":null,\"messages
\":[],\"label\":\"Account Name\",\"hidden\":null,\"fieldName\":\"name
\",\"editable\":true,\"dataType\":\"STRING\",\"actions\":{}}]",
"objectType" => "Account",
"cartId" => "8016A000000bwG8QAI",
"methodName" => "newSite"
}
},
"client" => {
"params" => {}
}
}
},
"records" => [{
"messages" => [],
"displaySequence" => -1,
"Id" => "0016A000006baXeQAI",
"Name" => "SFA1"
},
{
"messages" => [],
"displaySequence" => -1,

© 2021 Vlocity LLC, a Salesforce


company 823
CME CPQ

"Id" => "0016A000006bNfzQAE",


"Name" => "SA"
}
]
}

Get Cart Items


Return cart items and their configurable attributes based on specified criteria.

• Item name, description, and price


• Configurable attributes for the item
• Links to further actions
• Messages per item
• Whether to expand all the child items in the bundle

GET /v2/cpq/carts/{cart_ID}/items?
query={query}&lastRecordId=(n)&pagesize={n}&filters={filter}&fields={field1,fie
ld2}&validate={true/false}&price={true/false}

Vlocity does not support fieldset as a parameter for this API. If the fieldset parameter is passed, a
runtime error occurs.

This API can be called either through REST or through Apex remote calls. The default value for the price
parameter is true. If price=false is not specified, pricing is executed by default. Specify price=false
if you do not want to execute pricing.

In Vlocity Communications, Media, and Energy Fall '20 and later releases, the getCarts validate
parameter has a default value of True, so the API will return validation messages. If validate=false is
not specified, validation messages are returned by default. Specify validate=false in the UI if you do
not want to receive validation messages.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
getCartsItems

REST Handler
APIItemsCartsCpqV2

Apex Remote Service


CpqAppHandler

© 2021 Vlocity LLC, a Salesforce


company 824
CME CPQ

Apex Remote Input Map


{
methodName: getCartsItems,
cartId: 801360000008 eNU,
query: "iphone",
lastItemId: "01t36000000pfcKAAQ",
pagesize: 20,
includeAttachment: false,
fields: fields = Quantity,
vlocity_cmt__RecurringCharge__c,
vlocity_cmt__OneTimeTotal__c,
vlocity_cmt__BillingAccountId__r.Name,
vlocity_cmt__ServiceAccountId__r.Name,
vlocity_cmt__PremisesId__r.Name
filter: vlocity_cmt__ServiceAccountId__c: 991360000008 eNU_991360000008eNY,
vlocity_cmt__BillingAccount__c: 01 t36000000pfcKAAQ_01t36000000pfcKAAQ
}
cartId = order.Id, opportunity.Id, quote.Id

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response JSON
Format
Resource /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items?
URL query={query}&lastRecordId=(n)&pagesize={n}&filters={filter}&fields={field1,field2}&validate={true/
false}&price={true/false}

Example Request
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8H/items?pagesize=5

Example Response
{
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],

© 2021 Vlocity LLC, a Salesforce


company 825
CME CPQ

"actions": {
"addtocart": {
"rest": {
"params": {
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [{
"parentId": "80241000000HalcAAC",
"quantity": 1,
"itemId": "01u41000001QPtsAAG"
}]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [{
"parentId": "80241000000HalcAAC",
"quantity": 1,
"itemId": "01u41000001QPtsAAG"
}],
"cartId": "80141000000Cg8HAAS",
"methodName": "postCartsItems"
}
},
"client": {
"params": {}
}
},
"updateitems": {
"rest": {
"params": {
"fields": null,
"price": true,
"validate": true,
"filters": null,

© 2021 Vlocity LLC, a Salesforce


company 826
CME CPQ

"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [{
"itemId": "80241000000HalcAAC"
}]
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"fields": null,
"price": true,
"validate": true,
"filters": null,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [{
"itemId": "80241000000HalcAAC"
}],
"cartId": "80141000000Cg8HAAS",
"methodName": "putCartsItems"
}
},
"client": {
"params": {}
}
},
"deleteitem": {
"rest": {
"params": {},
"method": "DELETE",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items/80241000000HalcAAC?
pagesize=5&amp;includeAttachment=false&amp;validate=true&amp;price=true"
},
"remote": {
"params": {
"price": true,
"validate": true,
"filters": null,

© 2021 Vlocity LLC, a Salesforce


company 827
CME CPQ

"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"id": "80241000000HalcAAC",
"cartId": "80141000000Cg8HAAS",
"methodName": "deleteCartsItems"
}
},
"client": {
"params": {}
}
},
"cloneitem": {
"rest": {
"params": {
"items": [{
"itemId": "80241000000HalcAAC"
}]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items/clone"
},
"remote": {
"params": {
"id": "80241000000HalcAAC",
"cartId": "80141000000Cg8HAAS",
"methodName": "cloneItems"
}
},
"client": {
"params": {}
}
},
"modifyattributes": {
"rest": {
"params": {
"fields": null,
"items": [{
"itemId": "80241000000HalcAAC"
}]
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items/80241000000HalcAAC/itemattributes"

© 2021 Vlocity LLC, a Salesforce


company 828
CME CPQ

},
"remote": {
"params": {
"fields": null,
"items": [{
"itemId": "80241000000HalcAAC"
}],
"itemId": "80241000000HalcAAC",
"cartId": "80141000000Cg8HAAS",
"methodName": "putItemAttributes"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"value": "80241000000HalcAAC",
"messages": [],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"Pricebook2Id": "01s41000005dPYQAA2",
"Product2Id": "01t41000000sYaSAAU",
"UnitPrice": {
"value": 1.00,
"messages": [],
"label": "Unit Price",
"hidden": false,
"fieldName": "UnitPrice",
"editable": true,
"dataType": "CURRENCY",
"actions": {}
},
"Name": "GC 2",
"IsActive": true,
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"

© 2021 Vlocity LLC, a Salesforce


company 829
CME CPQ

},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "012410000006OWUAA2",
"vlocity_cmt__JSONAttribute__c": null
},
"productId": "01t41000000sYaSAAU",
"defaultQuantity": 1.0,
"minQuantity": 0.0,
"maxQuantity": 99999.0,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1.00,
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v38.0/sobjects/
vlocity_cmt__ProductChildItem__c/a2541000000G0AGAA0"
},
"Id": "a2541000000G0AGAA0",
"Name": "Root PCI",
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01t41000000sYaSAAU",
"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1.00,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__IsRootProductChildItem__c": true,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2"
}
},
"productHierarchyPath":"01t41000000sYaSAAU",

© 2021 Vlocity LLC, a Salesforce


company 830
CME CPQ

"name": "GC 2",


"isVirtualItem": false,
"itemType": "lineItem",
"PricebookEntryId": {
"value": "01u41000001QPtsAAG",
"messages": [],
"label": "Price Book Entry ID",
"hidden": false,
"fieldName": "PricebookEntryId",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"Quantity": {
"value": 1.00,
"messages": [],
"label": "Quantity",
"hidden": false,
"fieldName": "Quantity",
"editable": true,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__OneTimeTotal__c": {
"value": 1.00,
"messages": [],
"label": "One Time Total",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__RecurringTotal__c": {
"value": 0.00,
"messages": [],
"label": "Recurring Total",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__ProvisioningStatus__c": {
"value": "New",
"messages": [],

© 2021 Vlocity LLC, a Salesforce


company 831
CME CPQ

"label": "Provisioning Status",


"hidden": false,
"fieldName": "vlocity_cmt__ProvisioningStatus__c",
"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__BillingAccountId__c": "00141000007uyWYAAY",
"vlocity_cmt__ServiceAccountId__c": "00141000007uyWYAAY",
"vlocity_cmt__ProductHierarchyPath__c": {
"value": "01t41000000sYaSAAU",
"messages": [],
"label": "Product Hierarchy Path",
"hidden": false,
"fieldName": "vlocity_cmt__ProductHierarchyPath__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__LineNumber__c": {
"value": "0001",
"messages": [],
"label": "LineNumber",
"hidden": true,
"fieldName": "vlocity_cmt__LineNumber__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RootItemId__c": {
"value": "80241000000HalcAAC",
"messages": [],
"label": "RootItemId",
"hidden": true,
"fieldName": "vlocity_cmt__RootItemId__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"ListPrice": {
"value": 1.00,
"messages": [],
"label": "List Price",
"hidden": false,
"fieldName": "ListPrice",
"editable": false,

© 2021 Vlocity LLC, a Salesforce


company 832
CME CPQ

"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__OneTimeCharge__c": {
"value": 1.00,
"messages": [],
"label": "One Time Charge",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeCharge__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__OneTimeCalculatedPrice__c": {
"value": 1.00,
"messages": [],
"label": "One Time Calculated Price",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeCalculatedPrice__c",
"editable": true,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__OneTimeManualDiscount__c": {
"value": 0.00,
"messages": [],
"label": "One Time Manual Discount",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeManualDiscount__c",
"editable": true,
"dataType": "PERCENT",
"actions": {}
},
"vlocity_cmt__RecurringCharge__c": {
"value": 0.00,
"messages": [],
"label": "Recurring Charge",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringCharge__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__RecurringCalculatedPrice__c": {
"value": 0.00,
"messages": [],

© 2021 Vlocity LLC, a Salesforce


company 833
CME CPQ

"label": "Recurring Calculated Price",


"hidden": false,
"fieldName": "vlocity_cmt__RecurringCalculatedPrice__c",
"editable": true,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__RecurringManualDiscount__c": {
"value": 0.00,
"messages": [],
"label": "Recurring Manual Discount",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringManualDiscount__c",
"editable": true,
"dataType": "PERCENT",
"actions": {}
},
"PricebookEntry": {
"attributes": {
"type": "PricebookEntry",
"url": "/services/data/v38.0/sobjects/PricebookEntry/
01u41000001QPtsAAG"
},
"Id": "01u41000001QPtsAAG",
"Product2Id": "01t41000000sYaSAAU",
"Pricebook2Id": "01s41000005dPYQAA2",
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2",
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__IsConfigurable__c": false
}
},
"vlocity_cmt__ServiceAccountId__r": {
"attributes": {
"type": "Account",
"url": "/services/data/v38.0/sobjects/Account/00141000007uyWYAAY"
},
"Id": "00141000007uyWYAAY",
"Name": "Telco test"
},
"vlocity_cmt__BillingAccountId__r": {

© 2021 Vlocity LLC, a Salesforce


company 834
CME CPQ

"attributes": {
"type": "Account",
"url": "/services/data/v38.0/sobjects/Account/00141000007uyWYAAY"
},
"Id": "00141000007uyWYAAY",
"Name": "Telco test"
},
"vlocity_cmt__InCartQuantityMap__c": {
"value": null,
"messages": [],
"label": "InCartQuantityMap",
"hidden": false,
"fieldName": "vlocity_cmt__InCartQuantityMap__c",
"editable": true,
"dataType": "TEXTAREA",
"actions": {}
},
"vlocity_cmt__JSONAttribute__c": {
"value": null,
"messages": [],
"label": "JSONAttribute",
"hidden": false,
"fieldName": "vlocity_cmt__JSONAttribute__c",
"editable": true,
"dataType": "TEXTAREA",
"actions": {}
},
"vlocity_cmt__ParentItemId__c": {
"value": null,
"messages": [],
"label": "ParentItemId",
"hidden": true,
"fieldName": "vlocity_cmt__ParentItemId__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RecurringDiscountPrice__c": {
"value": null,
"messages": [],
"label": "Recurring Discount Price",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringDiscountPrice__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}

© 2021 Vlocity LLC, a Salesforce


company 835
CME CPQ

}
}]
}

See Also
• Adding a New Column to Vlocity Cart
• Configuring Dual Data Sources
• Configuring OmniScript for Guided Selling

Get Cart Promotions


Retrieve all promotions for a specified opportunity, quote, or order.

GET /v2/cpq/carts/cart_ID/promotions

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
getCartsPromotions

Handlers
REST Endpoint: APIPromotionsCartsCpqV2.cls
Implementation: EPCPromotionRuntimeService.cls

Apex remote service


CpqAppHandler

Apex Remote Input Map


methodName:getCartsPromotions
cartId:8011I000000TUaK
query:query
filters:vlocity_cmt__Code__c:Root-Promo
sortBy:Id

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

© 2021 Vlocity LLC, a Salesforce


company 836
CME CPQ

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/promotions

Example Request
GET /services/apexrest/vlocity_cmt/v2/cpq/carts/8011I000000TUaK/promotions?
query=iphone&sortBy=Id&filters=vlocity_cmt__Code__c:Root-Promo

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"actions": {
"validatecart": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011I000000TUaKQAW/validate"
},
"remote": {
"params": {
"cartId": "8011I000000TUaKQAW",
"methodName": "runCartValidation"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": 0,
"Id": "a2j1I000000XzfWQAS",
"Name": "Root-Promo",
"vlocity_cmt__Code__c": "Root-Promo",
"name": "Root-Promo",
"code": "Root-Promo",
"id": "a2j1I000000XzfWQAS",
"category": "Qualified"
}

© 2021 Vlocity LLC, a Salesforce


company 837
CME CPQ

]
}

Get Cart Summary


Return the cart details, including pricing, account, multi-site, and additional action information.

• Pricing information, such as total one-time charge and total recurring charge
• Account information associated with this cart
• If this cart includes a multi-site order, available sites
• Links to further actions, such as check out

GET /v2/cpq/carts/{cart_ID}?headerFieldSet={field_set_feature}&validate={true|
false}&price={true|false}

Get Cart Details returns all fields from the Opportunity, Order, or Quote, except for the following fields:

• IsDeleted
• CreatedDate
• CreatedById
• LastModifiedDate
• LastModifiedById
• SystemModstamp
• LastActivityDate
• CleanStatus

NOTE
By default, items deleted from a cart are not evaluated for Vlocity Rules. To enable
evaluation of deleted items, set the 'ShouldConsiderDeletedItems' custom setting to true.

In Vlocity Communications, Media, and Energy Winter '21 and later releases, the getCarts validate
parameter has a default value of True, so the API will return validation messages. If validate=false is
not specified, validation messages are returned by default. Specify validate=false in the UI if you do
not want to receive validation messages.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
getCarts

© 2021 Vlocity LLC, a Salesforce


company 838
CME CPQ

REST Handler
APICartsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName: getCarts,
cartId: 801360000008 eNU,
"headerFieldSet": "CPQV2"
}
cartId = order.Id, opportunity.Id, or quote.Id

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}?
headerFieldSet={field_set_feature}&validate={true|false}&price={true|false}

Example Request
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8H

Example Result
{
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"displaySequence": -1,
"details": {
"totalSize": 1,
"messages": [],
"records": [{

© 2021 Vlocity LLC, a Salesforce


company 839
CME CPQ

"messages": [],
"actions": {
"checkout": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/checkout"
},
"remote": {
"params": {
"cartId": "80141000000Cg8HAAS",
"methodName": "checkout"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": "80141000000Cg8HAAS",
"Status": "Draft",
"OrderNumber": "00000965",
"Account.Name": "Telco test",
"EffectiveRecurringTotal__c": 0.00,
"EffectiveOneTimeTotal__c": 5.00,
"EffectiveOrderTotal__c": 5.00,
"ObjectType": "Order"
}]
},
"sites": {
"totalSize": 0,
"messages": [{
"severity": "ERROR",
"messageId": null,
"message": "No Results Found.",
"code": "101",
"actions": {}
}],
"actions": {
"newsite": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/

© 2021 Vlocity LLC, a Salesforce


company 840
CME CPQ

80141000000Cg8HAAS/sites"
},
"remote": {
"params": {
"type": "Service",
"methodName": "newSite"
}
},
"client": {
"params": {}
}
}
}
}
}]
}

Get Catalog Information


Return data from the specified catalog. If you omit the catalog ID, this API returns data from root catalogs.
By default, all catalog data is returned in the results.

GET /v2/cpq/catalogs?catalogId={catalog_ID}&ContextId={cart_ID}

For root catalogs, you can paginate the results to minimize client wait time by returning the data in a series
of chunks (child catalogs are not paginated). To loop through paginated results, issue the first GET call, use
the data returned in the action field to compose subsequent GET calls, and looping until the action field is
empty, which indicates that the last page has been returned.

To override the default page size of 20, create a custom object named VlocityAPIMetadata and set its
API name to getCatalogHierarchy. In the field named APIParams, add a key/value pair specified in
curly brackets with the key set to pagesize and value set to the desired default page size (for example:
{"pagesize":100}). To return all records when no page size is specified in the call, set the APIParams
fields to -1. To restore the default page size to 20, set the APIParams field to null or delete the
VlocityAPIMetadata custom object.

By default, root catalogs are returned sorted by ID. To retrieve root catalogs in a specific order, set the
sortBy parameter to a comma-separated list of fields to be used to sort the results.

If the ContextId parameter is specified, the API returns the action and parameters required to retrieve the
catalog products.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

© 2021 Vlocity LLC, a Salesforce


company 841
CME CPQ

Remote Method
getCatalogHierarchy

REST Handler
APICatalogsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
"methodName": "getCatalogHierarchy",
"catalogId": "a1T36000000j2lB",
"cartId":"80136000000S4kq",
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/catalogs?
catalogId={catalog_ID}&ContextId={cart_ID}

Examples

Example 36. Retrieve All Root Catalogs


GET /services/apexrest/vlocity_cmt/v2/cpq/catalogs

Example 37. Response


{
"totalSize": 2,
"records": [
{
"displaySequence": -1,
"attributes": {

© 2021 Vlocity LLC, a Salesforce


company 842
CME CPQ

"type": "vlocity_cmt__Catalog__c",
"url": "/services/data/v42.0/sobjects/vlocity_cmt__Catalog__c/
a0D0a00000Ges3cEAB"
},
"Id": "a0D0a00000Ges3cEAB",
"OwnerId": "0050a00000JIgxVAAT",
"IsDeleted": false,
"Name": "First",
"CreatedDate": "2018-03-01T04:31:50.000+0000",
"CreatedById": "0050a00000JIgxVAAT",
"LastModifiedDate": "2018-03-01T04:59:18.000+0000",
"LastModifiedById": "0050a00000JIgxVAAT",
"SystemModstamp": "2018-03-03T01:04:14.000+0000",
"LastViewedDate": "2018-03-05T11:06:51.000+0000",
"LastReferencedDate": "2018-03-05T11:06:51.000+0000",
"vlocity_cmt__CatalogCode__c": "Catalog_f",
"vlocity_cmt__GlobalKey__c": "55d205fa-9271-c00f-1d33-8a21c62490ef",
"vlocity_cmt__IsActive__c": true,
"vlocity_cmt__IsCatalogRoot__c": true,
"catalogId": "a0D0a00000Ges3cEAB",
"catalogName": "First"
},
{
"displaySequence": -1,
"attributes": {
"type": "vlocity_cmt__Catalog__c",
"url": "/services/data/v42.0/sobjects/vlocity_cmt__Catalog__c/
a0D0a00000Ges3hEAB"
},
"Id": "a0D0a00000Ges3hEAB",
"OwnerId": "0050a00000JIgxVAAT",
"IsDeleted": false,
"Name": "Second",
"CreatedDate": "2018-03-01T04:32:18.000+0000",
"CreatedById": "0050a00000JIgxVAAT",
"LastModifiedDate": "2018-03-01T04:59:40.000+0000",
"LastModifiedById": "0050a00000JIgxVAAT",
"SystemModstamp": "2018-03-03T01:04:14.000+0000",
"LastViewedDate": "2018-03-01T08:12:34.000+0000",
"LastReferencedDate": "2018-03-01T08:12:34.000+0000",
"vlocity_cmt__GlobalKey__c": "85057565-e71e-2d6e-3713-3cd437750bcb",
"vlocity_cmt__IsActive__c": true,
"vlocity_cmt__IsCatalogRoot__c": true,
"catalogId": "a0D0a00000Ges3hEAB",
"catalogName": "Second"
}

© 2021 Vlocity LLC, a Salesforce


company 843
CME CPQ

]
}

Example 38. Retrieve First Root Catalog


No sort order is specified in the following request:

GET /services/apexrest/vlocity_cmt/v2/cpq/catalogs?pagesize=1

Example 39. Response


{
"totalSize": 1,
"actions": {
"nextcatalogs": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/catalogs/?
offsetSize=1&pagesize=1&includeProducts=false"
},
"remote": {
"params": {
"includeProducts": false,
"pagesize": 1,
"offsetSize": 1,
"methodName": "getCatalog"
}
},
"client": {
"params": {}
}
}
},
"records": [
{
"displaySequence": -1,
"attributes": {
"type": "vlocity_cmt__Catalog__c",
"url": "/services/data/v42.0/sobjects/vlocity_cmt__Catalog__c/
a0D0a00000Ges3cEAB"
},
"Id": "a0D0a00000Ges3cEAB",
"OwnerId": "0050a00000JIgxVAAT",
"IsDeleted": false,
"Name": "First",

© 2021 Vlocity LLC, a Salesforce


company 844
CME CPQ

"CreatedDate": "2018-03-01T04:31:50.000+0000",
"CreatedById": "0050a00000JIgxVAAT",
"LastModifiedDate": "2018-03-01T04:59:18.000+0000",
"LastModifiedById": "0050a00000JIgxVAAT",
"SystemModstamp": "2018-03-03T01:04:14.000+0000",
"LastViewedDate": "2018-03-05T11:06:51.000+0000",
"LastReferencedDate": "2018-03-05T11:06:51.000+0000",
"vlocity_cmt__CatalogCode__c": "Catalog_f",
"vlocity_cmt__GlobalKey__c": "55d205fa-9271-c00f-1d33-8a21c62490ef",
"vlocity_cmt__IsActive__c": true,
"vlocity_cmt__IsCatalogRoot__c": true,
"catalogId": "a0D0a00000Ges3cEAB",
"catalogName": "First"
}
]
}

Example 40. Retrieve All Root Catalogs Sorted by Name


/services/apexrest/vlocity_cmt/v2/cpq/catalogs?sortBy=Name_ASC

Example 41. Response


{
"totalSize": 2,
"records": [
{
"displaySequence": -1,
"attributes": {
"type": "vlocity_cmt__Catalog__c",
"url": "/services/data/v42.0/sobjects/vlocity_cmt__Catalog__c/
a0D0a00000Ges3hEAB"
},
"Id": "a0D0a00000Ges3hEAB",
"OwnerId": "0050a00000JIgxVAAT",
"IsDeleted": false,
"Name": "Second",
"CreatedDate": "2018-03-01T04:32:18.000+0000",
"CreatedById": "0050a00000JIgxVAAT",
"LastModifiedDate": "2018-03-01T04:59:40.000+0000",
"LastModifiedById": "0050a00000JIgxVAAT",
"SystemModstamp": "2018-03-03T01:04:14.000+0000",
"LastViewedDate": "2018-03-01T08:12:34.000+0000",
"LastReferencedDate": "2018-03-01T08:12:34.000+0000",
"vlocity_cmt__GlobalKey__c": "85057565-e71e-2d6e-3713-3cd437750bcb",
"vlocity_cmt__IsActive__c": true,

© 2021 Vlocity LLC, a Salesforce


company 845
CME CPQ

"vlocity_cmt__IsCatalogRoot__c": true,
"catalogId": "a0D0a00000Ges3hEAB",
"catalogName": "Second"
},
{
"displaySequence": -1,
"attributes": {
"type": "vlocity_cmt__Catalog__c",
"url": "/services/data/v42.0/sobjects/vlocity_cmt__Catalog__c/
a0D0a00000Ges3cEAB"
},
"Id": "a0D0a00000Ges3cEAB",
"OwnerId": "0050a00000JIgxVAAT",
"IsDeleted": false,
"Name": "First",
"CreatedDate": "2018-03-01T04:31:50.000+0000",
"CreatedById": "0050a00000JIgxVAAT",
"LastModifiedDate": "2018-03-01T04:59:18.000+0000",
"LastModifiedById": "0050a00000JIgxVAAT",
"SystemModstamp": "2018-03-03T01:04:14.000+0000",
"LastViewedDate": "2018-03-05T11:06:51.000+0000",
"LastReferencedDate": "2018-03-05T11:06:51.000+0000",
"vlocity_cmt__CatalogCode__c": "Catalog_f",
"vlocity_cmt__GlobalKey__c": "55d205fa-9271-c00f-1d33-8a21c62490ef",
"vlocity_cmt__IsActive__c": true,
"vlocity_cmt__IsCatalogRoot__c": true,
"catalogId": "a0D0a00000Ges3cEAB",
"catalogName": "First"
}
]
}

Get Contracts for Account


Retrieve the contracts for a specified account ID.

GET /v2/assets/{ID}/pricing?accountId={account_ID}

Remote Method
getContracts

Handlers
REST Endpoint: APIContractsAccountsV2.cls
Implementation: CpqContractsAccountsActionV2.cls

© 2021 Vlocity LLC, a Salesforce


company 846
CME CPQ

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


methodName: getContracts
accountId: 0011I000007lzDO

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/accounts/{account_ID}

Example Request
GET
/services/apexrest/vlocity_cmt/v2/accounts/0011I000007lzDO/contracts

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"actions": {
"getassetsbycontract": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/contracts/
8001I0000000ThgQAE/assets"
},
"remote": {
"params": {
"includes": "allAssets"
}
},

© 2021 Vlocity LLC, a Salesforce


company 847
CME CPQ

"client": {
"params": {}
}
}
},
"displaySequence": -1,
"name": "00000364",
"Id": {
"value": "8001I0000000ThgQAE",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Id",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
}
}
]
}

Get Details of Product


For all disqualified promotions or products, get a message about which rule conditions failed. Return
information about why a product or promotion was disqualified.

GET /v2/cpq/carts/{cart_ID}/products/{pricebook_entry_ID}?
include=qualifications&ruleType=Qualification

or

GET v2/cpq/carts/{cart_ID}/promotions/{promotion_ID}?
include=qualifications&ruleType=Qualification

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
getRuleMessages

REST Handler
APIProductsCartsCpqV2

© 2021 Vlocity LLC, a Salesforce


company 848
CME CPQ

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName: getRuleMessages
ruleEvaluationInput: null
ruleType: Qualification
include: qualifications
id: <pricebookentryId/promotionId>
cartId:<cartId>
}

Package
Communications (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/801f4000000kCNPAA2/products/
01uf4000000sMtjAAE?include=qualifications&ruleType=Qualification
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/801f4000000kCNPAA2/promotions/
a2ff4000000LUCDAA4?include=qualifications&ruleType=Qualification

Example Request
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/801f4000000kCNPAA2/products/
01uf4000000sMtjAAE?include=qualifications&ruleType=Qualification

Example Response
{
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"displaySequence": -1,
"id": "01uf4000000sMtjAAE",
"name": "TestProd-2",
"product2id": "01tf4000000YyZyAAK",

© 2021 Vlocity LLC, a Salesforce


company 849
CME CPQ

"product2.description": "TestProd-2",
"qualifications": {
"totalSize": 1,
"messages": [],
"records": [{
"messages": [{
"severity": "WARN",
"messageId": null,
"message": "ruleset: accName is not acc-4",
"code": "207",
"bundleId": null,
"actions": {}
}],
"displaySequence": -1,
"name": "Ruleset-5",
"type": "ruleset",
"qualifications": {
"totalSize": 1,
"messages": [],
"records": [{
"messages": [{
"severity": "WARN",
"messageId": null,
"message": "accountName is not acc-4",
"code": "207",
"bundleId": null,
"actions": {}
}],
"displaySequence": -1,
"name": "accountName is acc-4",
"code": "accountName is acc-4",
"type": "rule",
"qualifications": {
"totalSize": 2,
"messages": [],
"records": [{
"messages": [{
"severity": "WARN",
"messageId": null,
"message": "rsCond: accName is not acc-4",
"code": "301",
"bundleId": null,
"actions": {}
}],
"displaySequence": -1,
"code": "accountName is acc-4-con-1",

© 2021 Vlocity LLC, a Salesforce


company 850
CME CPQ

"type": "rulecondition"
}, {
"messages": [{
"severity": "WARN",
"messageId": null,
"message": "channel is not web",
"code": "301",
"bundleId": null,
"actions": {}
}],
"displaySequence": -1,
"code": "cod-2-1-1",
"type": "rulecondition"
}]
}
}]
}
}]
}
}]
}

Get Filterable Attributes


Return the filterable attributes that are applicable for this cart, including the product attributes and the
product attribute values that the customer can choose to filter products.

GET /v2/cpq/carts/{cart_ID}/attributes

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method

getCartsAttributes

REST Handler

APICartsAttributesCpqV2

Apex Remote Service

CpqAppHandler

© 2021 Vlocity LLC, a Salesforce


company 851
CME CPQ

Apex Remote Input Map


{
methodName:getCartsAttributes,
cartId:801360000008eNU
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/attributes

Example Request
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/80136000000siLM/attributes

Example Response
"totalSize": 1, "messages": [], "records": [{
"messages": [],
"displaySequence": -1,
"attributeCategories": {
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"displaySequence": 123,
"Code__c": "121",
"Name": "Test Category",
"id": "a0936000003VfDrAAK",
"productAttributes": {
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"dataType": "number",
"inputType": "number-range",
"multiselect": false,
"required": false,

© 2021 Vlocity LLC, a Salesforce


company 852
CME CPQ

"readonly": false,
"min": 1.00,
"max": 51.00,
"attributeId": "a0A36000009t7jGEAQ",
"label": "Filter Number",
"displaySequence": 1,
"hasRules": false,
"values": [{
"value": 1,
"defaultValue": 1
}, {
"value": 51,
"defaultValue": 51
}],
"userValues": null
}]
}
}]
}
}]
}

Get Line Items by ID


Return the items and configurable attributes based on item IDs.

GET /v2/cpq/carts/{cart_ID}/items?id={item_ID},{item_ID}&validate={true|false}

Remote Method
getCartsItemsById

REST Handler
APIItemsCartsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName:getCartsItemsById,
cartId:801360000008eNU,
id:01t36000000pfcKAAQ,01t36000000pfcKAAQ
}
cartId = order.Id, opportunity.Id, quote.Id

© 2021 Vlocity LLC, a Salesforce


company 853
CME CPQ

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items?
id=80236000000Z0QNAA0,01t36000000pfcKAAQ&validate=true

Example Request
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/80136000000aSTqAAM/items?
id=80236000000Z0QNAA0,01t36000000pfcKAAQ&validate=true

Example Result
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"items": [
{
"quantity": 1,
"parentId": "8021I00000186qVQAQ",
"itemId": "01u1I000000wj9IQAQ"
}
],
"cartId": "8011I000000KN9dQAG",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 10,
"lastRecordId": null,
"query": null
},
"method": "POST",

© 2021 Vlocity LLC, a Salesforce


company 854
CME CPQ

"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011I000000KN9dQAG/items"
},
"remote": {
"params": {
"methodName": "postCartsItems",
"items": [
{
"quantity": 1,
"parentId": "8021I00000186qVQAQ",
"itemId": "01u1I000000wj9IQAQ"
}
],
"cartId": "8011I000000KN9dQAG",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 10,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"updateitems": {
"rest": {
"params": {
"items": [
{
"itemId": "8021I00000186qVQAQ"
}
],
"filters": null,
"fields": "vlocity_cmt__BillingAccountId__c,
vlocity_cmt__ServiceAccountId__c, Quantity, vlocity_cmt__RecurringTotal__c,
vlocity_cmt__OneTimeTotal__c, vlocity_cmt__OneTimeManualDiscount__c,
vlocity_cmt__RecurringManualDiscount__c, vlocity_cmt__ProvisioningStatus__c,
vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeCharge__c, ListPrice,
vlocity_cmt__ParentItemId__c, vlocity_cmt__BillingAccountId__r.Name,
vlocity_cmt__ServiceAccountId__r.Name, vlocity_cmt__PremisesId__r.Name,
vlocity_cmt__InCartQuantityMap__c",
"cartId": "8011I000000KN9dQAG",
"price": true,
"validate": true,

© 2021 Vlocity LLC, a Salesforce


company 855
CME CPQ

"includeAttachment": false,
"pagesize": 10,
"lastRecordId": null,
"query": null
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011I000000KN9dQAG/items"
},
"remote": {
"params": {
"methodName": "putCartsItems",
"items": [
{
"itemId": "8021I00000186qVQAQ"
}
],
"filters": null,
"fields": "vlocity_cmt__BillingAccountId__c,
vlocity_cmt__ServiceAccountId__c, Quantity, vlocity_cmt__RecurringTotal__c,
vlocity_cmt__OneTimeTotal__c, vlocity_cmt__OneTimeManualDiscount__c,
vlocity_cmt__RecurringManualDiscount__c, vlocity_cmt__ProvisioningStatus__c,
vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeCharge__c, ListPrice,
vlocity_cmt__ParentItemId__c, vlocity_cmt__BillingAccountId__r.Name,
vlocity_cmt__ServiceAccountId__r.Name, vlocity_cmt__PremisesId__r.Name,
vlocity_cmt__InCartQuantityMap__c",
"cartId": "8011I000000KN9dQAG",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 10,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"deleteitem": {
"rest": {
"params": {},
"method": "DELETE",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011I000000KN9dQAG/items/ 8021I00000186qVQAQ?
pagesize=10&includeAttachment=false&

© 2021 Vlocity LLC, a Salesforce


company 856
CME CPQ

validate=true&price=true&cartId=8011I000000KN9dQAG&fields=
vlocity_cmt__BillingAccountId__c, vlocity_cmt__ServiceAccountId__c, Quantity,
vlocity_cmt__RecurringTotal__c, vlocity_cmt__OneTimeTotal__c,
vlocity_cmt__OneTimeManualDiscount__c,
vlocity_cmt__RecurringManualDiscount__c, vlocity_cmt__ProvisioningStatus__c,
vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeCharge__c, ListPrice,
vlocity_cmt__ParentItemId__c, vlocity_cmt__BillingAccountId__r.Name,
vlocity_cmt__ServiceAccountId__r.Name, vlocity_cmt__PremisesId__r.Name,
vlocity_cmt__InCartQuantityMap__c & id = 8021I00000186qVQAQ"
},
"remote": {
"params": {
"methodName": "deleteCartsItems",
"id": "8021I00000186qVQAQ",
"filters": null,
"fields": "vlocity_cmt__BillingAccountId__c,
vlocity_cmt__ServiceAccountId__c, Quantity, vlocity_cmt__RecurringTotal__c,
vlocity_cmt__OneTimeTotal__c, vlocity_cmt__OneTimeManualDiscount__c,
vlocity_cmt__RecurringManualDiscount__c, vlocity_cmt__ProvisioningStatus__c,
vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeCharge__c, ListPrice,
vlocity_cmt__ParentItemId__c, vlocity_cmt__BillingAccountId__r.Name,
vlocity_cmt__ServiceAccountId__r.Name, vlocity_cmt__PremisesId__r.Name,
vlocity_cmt__InCartQuantityMap__c",
"cartId": "8011I000000KN9dQAG",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 10,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"configdelete": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "configDeleteItem",
"id": "8021I00000186qVQAQ",

© 2021 Vlocity LLC, a Salesforce


company 857
CME CPQ

"cartId": "8011I000000KN9dQAG"
}
},
"client": {
"params": {}
}
},
"cloneitem": {
"rest": {
"params": {
"items": [
{
"itemId": "8021I00000186qVQAQ"
}
],
"id": "8021I00000186qVQAQ",
"cartId": "8011I000000KN9dQAG"
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011I000000KN9dQAG/items/ clone"
},
"remote": {
"params": {
"methodName": "cloneItems",
"items": [
{
"itemId": "8021I00000186qVQAQ"
}
],
"id": "8021I00000186qVQAQ",
"cartId": "8011I000000KN9dQAG"
}
},
"client": {
"params": {}
}
},
"modifyattributes": {
"rest": {
"params": {
"items": [
{
"itemId": "8021I00000186qVQAQ"
}
],

© 2021 Vlocity LLC, a Salesforce


company 858
CME CPQ

"filters": null,
"itemId": "8021I00000186qVQAQ",
"id": "8021I00000186qVQAQ",
"cartId": "8011I000000KN9dQAG"
}
}
}
}
}
]
}

NOTE
An entire result can be thousands of lines long. This example has been truncated.

Get List of Products


Return the list of products that match the specified criteria.

• Query with the text the customer enters


• Attributes
• Product hierarchy
• The last record ID from the previous search result, if available
• The page size of the number of products to return; the default is 20

NOTE
In Vlocity CMT V15, if the page size is set to 20, the API does not return images.

• Product IDs

GET /v2/cpq/carts/{cart_ID}/products?
query={query}&attributes={attribute_code:value}&lastRecordId={record_ID}&pagesi
ze={n}&includeAttachment={true|
false}&category={category}&filters={filters}&includeIneligible={true|false}

Use includeAttachment to indicate whether product attachments are returned.

The value specified for attribute_code must be the ID of the value, not the label or display text.

Use the includeIneligible=true parameter if you are using context rules to control product visibility in the
product list. This will add a Category node to the response, which will contain two sub-nodes: Qualified and

© 2021 Vlocity LLC, a Salesforce


company 859
CME CPQ

Disqualified. If you want to display only the qualified products, you can select the list of products in the
Qualified sub-node.

To specify a product name using a locale other than the user's locale, set the localeCode parameter to
the desired locale and the query parameter to the name of the product. For example:

GET /services/apexrest/vlocity_cmt/v2/cpq/carts/8011N000002BL2P/products?
localeCode=fr&query=échantillon

Get Products replaces the OmniCPQServiceWrapper getProducts method.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
getCartsProducts

REST Handler
APIProductsCartsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName:getCartsProducts,
cartId:801360000008eNU,
query:iphone,
attributes: 991360000008eNU:32GB_64GB,991360000008eNY:RED,
maxProdListHierarchy: 1,
lastProductId:,
pagesize: 10,
includeAttachment: true,
fields: Product2.vlocity_cmt__CustomField__c
}
cartId = order.Id, opportunity.Id, quote.Id

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

© 2021 Vlocity LLC, a Salesforce


company 860
CME CPQ

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/products

Example Request
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8H/products?pagesize=5

Example Response
{
"totalSize": 5,
"messages": [],
"actions": {
"nextproducts": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/products?
lastRecordId=01u41000001QPtsAAG&pagesize=5&includeAttachment=false"
},
"remote": {
"params": {
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": "01u41000001QPtsAAG",
"cartId": "80141000000Cg8HAAS",
"methodName": "getCartsProducts"
}
},
"client": {
"params": {}
}
}
},
"records": [
{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"price": true,

© 2021 Vlocity LLC, a Salesforce


company 861
CME CPQ

"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [
{
"quantity": 1,
"itemId": "01u41000001QPs0AAG"
}
]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [
{
"quantity": 1,
"itemId": "01u41000001QPs0AAG"
}
],
"cartId": "80141000000Cg8HAAS",
"methodName": "postCartsItems"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"label": "Price Book Entry ID",
"value": "01u41000001QPs0AAG"
},
"Pricebook2Id": {
"label": "Price Book ID",

© 2021 Vlocity LLC, a Salesforce


company 862
CME CPQ

"value": "01s41000005dPYQAA2"
},
"Product2Id": {
"label": "Product ID",
"value": "01t41000000sYZQAA2"
},
"UnitPrice": {
"label": "List Price",
"value": 1
},
"Name": {
"label": "Product Name",
"value": "Root 1"
},
"IsActive": {
"label": "Active",
"value": true
},
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZQAA2"
},
"Id": "01t41000000sYZQAA2",
"Name": "Root 1",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "012410000006OWUAA2"
},
"productId": "01t41000000sYZQAA2",
"defaultQuantity": 1,
"minQuantity": 0,
"maxQuantity": 99999,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1,
"productChildItemId": "a2541000000G09wAAC",
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v38.0/sobjects/
vlocity_cmt__ProductChildItem__c/a2541000000G09wAAC"
},
"Id": "a2541000000G09wAAC",
"Name": "Root PCI",

© 2021 Vlocity LLC, a Salesforce


company 863
CME CPQ

"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01t41000000sYZQAA2",
"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__IsRootProductChildItem__c": true,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZQAA2"
},
"Id": "01t41000000sYZQAA2",
"Name": "Root 1"
}
},
"productHierarchyPath": "01t41000000sYZQAA2",
"name": "Root 1",
"isVirtualItem": false,
"attributeValues": {},
"itemType": "childProduct"
},
{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [
{
"quantity": 1,
"itemId": "01u41000001QPs5AAG"
}
]
},

© 2021 Vlocity LLC, a Salesforce


company 864
CME CPQ

"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [
{
"quantity": 1,
"itemId": "01u41000001QPs5AAG"
}
],
"cartId": "80141000000Cg8HAAS",
"methodName": "postCartsItems"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"label": "Price Book Entry ID",
"value": "01u41000001QPs5AAG"
},
"Pricebook2Id": {
"label": "Price Book ID",
"value": "01s41000005dPYQAA2"
},
"Product2Id": {
"label": "Product ID",
"value": "01t41000000sYZVAA2"
},
"UnitPrice": {
"label": "List Price",
"value": 2
},
"Name": {
"label": "Product Name",

© 2021 Vlocity LLC, a Salesforce


company 865
CME CPQ

"value": "Parent 1"


},
"IsActive": {
"label": "Active",
"value": true
},
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZVAA2"
},
"Id": "01t41000000sYZVAA2",
"Name": "Parent 1",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "012410000006OWUAA2"
},
"productId": "01t41000000sYZVAA2",
"defaultQuantity": 1,
"minQuantity": 0,
"maxQuantity": 99999,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1,
"productChildItemId": "a2541000000G0A1AAK",
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v38.0/sobjects/
vlocity_cmt__ProductChildItem__c/a2541000000G0A1AAK"
},
"Id": "a2541000000G0A1AAK",
"Name": "Root PCI",
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01t41000000sYZVAA2",
"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__IsRootProductChildItem__c": true,

© 2021 Vlocity LLC, a Salesforce


company 866
CME CPQ

"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYZVAA2"
},
"Id": "01t41000000sYZVAA2",
"Name": "Parent 1"
}
},
"productHierarchyPath": "01t41000000sYZVAA2",
"name": "Parent 1",
"isVirtualItem": false,
"attributeValues": {},
"itemType": "childProduct"
},
{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [
{
"quantity": 1,
"itemId": "01u41000001QPtmAAG"
}
]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,

© 2021 Vlocity LLC, a Salesforce


company 867
CME CPQ

"items": [
{
"quantity": 1,
"itemId": "01u41000001QPtmAAG"
}
],
"cartId": "80141000000Cg8HAAS",
"methodName": "postCartsItems"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"label": "Price Book Entry ID",
"value": "01u41000001QPtmAAG"
},
"Pricebook2Id": {
"label": "Price Book ID",
"value": "01s41000005dPYQAA2"
},
"Product2Id": {
"label": "Product ID",
"value": "01t41000000sYaIAAU"
},
"UnitPrice": {
"label": "List Price",
"value": 1
},
"Name": {
"label": "Product Name",
"value": "Child 1"
},
"IsActive": {
"label": "Active",
"value": true
},
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaIAAU"
},
"Id": "01t41000000sYaIAAU",

© 2021 Vlocity LLC, a Salesforce


company 868
CME CPQ

"Name": "Child 1",


"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "012410000006OWUAA2"
},
"productId": "01t41000000sYaIAAU",
"defaultQuantity": 1,
"minQuantity": 0,
"maxQuantity": 99999,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1,
"productChildItemId": "a2541000000G0A6AAK",
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v38.0/sobjects/
vlocity_cmt__ProductChildItem__c/a2541000000G0A6AAK"
},
"Id": "a2541000000G0A6AAK",
"Name": "Root PCI",
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01t41000000sYaIAAU",
"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__IsRootProductChildItem__c": true,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaIAAU"
},
"Id": "01t41000000sYaIAAU",
"Name": "Child 1"
}
},
"productHierarchyPath": "01t41000000sYaIAAU",
"name": "Child 1",
"isVirtualItem": false,

© 2021 Vlocity LLC, a Salesforce


company 869
CME CPQ

"attributeValues": {},
"itemType": "childProduct"
},
{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [
{
"quantity": 1,
"itemId": "01u41000001QPtrAAG"
}
]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [
{
"quantity": 1,
"itemId": "01u41000001QPtrAAG"
}
],
"cartId": "80141000000Cg8HAAS",
"methodName": "postCartsItems"
}
},
"client": {
"params": {}

© 2021 Vlocity LLC, a Salesforce


company 870
CME CPQ

}
}
},
"displaySequence": -1,
"Id": {
"label": "Price Book Entry ID",
"value": "01u41000001QPtrAAG"
},
"Pricebook2Id": {
"label": "Price Book ID",
"value": "01s41000005dPYQAA2"
},
"Product2Id": {
"label": "Product ID",
"value": "01t41000000sYaNAAU"
},
"UnitPrice": {
"label": "List Price",
"value": 1
},
"Name": {
"label": "Product Name",
"value": "GC 1"
},
"IsActive": {
"label": "Active",
"value": true
},
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaNAAU"
},
"Id": "01t41000000sYaNAAU",
"Name": "GC 1",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "012410000006OWUAA2"
},
"productId": "01t41000000sYaNAAU",
"defaultQuantity": 1,
"minQuantity": 0,
"maxQuantity": 99999,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,

© 2021 Vlocity LLC, a Salesforce


company 871
CME CPQ

"sequenceNumber": 1,
"productChildItemId": "a2541000000G0ABAA0",
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v38.0/sobjects/
vlocity_cmt__ProductChildItem__c/a2541000000G0ABAA0"
},
"Id": "a2541000000G0ABAA0",
"Name": "Root PCI",
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01t41000000sYaNAAU",
"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__IsRootProductChildItem__c": true,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaNAAU"
},
"Id": "01t41000000sYaNAAU",
"Name": "GC 1"
}
},
"productHierarchyPath": "01t41000000sYaNAAU",
"name": "GC 1",
"isVirtualItem": false,
"attributeValues": {},
"itemType": "childProduct"
},
{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,

© 2021 Vlocity LLC, a Salesforce


company 872
CME CPQ

"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [
{
"quantity": 1,
"itemId": "01u41000001QPtsAAG"
}
]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 5,
"lastRecordId": null,
"query": null,
"items": [
{
"quantity": 1,
"itemId": "01u41000001QPtsAAG"
}
],
"cartId": "80141000000Cg8HAAS",
"methodName": "postCartsItems"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"label": "Price Book Entry ID",
"value": "01u41000001QPtsAAG"
},
"Pricebook2Id": {
"label": "Price Book ID",
"value": "01s41000005dPYQAA2"
},

© 2021 Vlocity LLC, a Salesforce


company 873
CME CPQ

"Product2Id": {
"label": "Product ID",
"value": "01t41000000sYaSAAU"
},
"UnitPrice": {
"label": "List Price",
"value": 1
},
"Name": {
"label": "Product Name",
"value": "GC 2"
},
"IsActive": {
"label": "Active",
"value": true
},
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "012410000006OWUAA2"
},
"productId": "01t41000000sYaSAAU",
"defaultQuantity": 1,
"minQuantity": 0,
"maxQuantity": 99999,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1,
"productChildItemId": "a2541000000G0AGAA0",
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v38.0/sobjects/
vlocity_cmt__ProductChildItem__c/a2541000000G0AGAA0"
},
"Id": "a2541000000G0AGAA0",
"Name": "Root PCI",
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,

© 2021 Vlocity LLC, a Salesforce


company 874
CME CPQ

"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01t41000000sYaSAAU",
"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__IsRootProductChildItem__c": true,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2"
}
},
"productHierarchyPath": "01t41000000sYaSAAU",
"name": "GC 2",
"isVirtualItem": false,
"attributeValues": {},
"itemType": "childProduct"
}
]
}

Get Lists of Values


Retrieve time plans, time policies, and adjustment codes. The Price Adjustment dialog box enables a user
to pick a time plan and time policy to associate with a recurring adjustment or to pick a code that defines an
adjustment for a specific price, such as a recurring charge, one-time charge, one-time total, and so on.

GET /v2/listsofvalues?
listkeys={type_of_list}&cartId={cart_ID}&id={line_item_ID}&fields={field_name}&
PricingVariableCode={price_variable_code}

Remote Method
getListsOfValues

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

© 2021 Vlocity LLC, a Salesforce


company 875
CME CPQ

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/listsofvalues

Example Request
GET
/services/apexrest/vlocity_cmt/v2/listsofvalues?
listkeys=AdjustmentCodes&cartId=80146000000goGvAAI&id=80246000000gaR9AAI&fields
=vlocity_cmt__OneTimeCharge__c&PricingVariableCode=OT_STD_PRC

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"displaySequence": -1,
"id": "80246000000gZfOAAU",
"vlocity_cmt__OneTimeCharge__c": {
"pricedetail": [
{
"actions": {},
"DetailType": "PRICE",
"Description": "$50 One Time Standard Price",
"StartValue": 50,
"EndValue": 50,
"AdjustmentType": "None",
"AdjustmentMethod": null,
"AdjustmentValue": 0
},
{
"actions": {},
"DetailType": "ADJUSTMENT",
"Description": "5% Discount on OT Std Price due to Bundle A...",
"StartValue": 50,
"EndValue": 47.5,
"AdjustmentType": "Discount",
"AdjustmentMethod": "Percent",
"AdjustmentValue": -5
},
{
"actions": {},

© 2021 Vlocity LLC, a Salesforce


company 876
CME CPQ

"DetailType": "ADJUSTMENT",
"Description": "10% Discount on OT Std Price due to Promotion 'Add
Bundle A'",
"StartValue": 47.5,
"EndValue": 42.5,
"AdjustmentType": "Discount",
"AdjustmentMethod": "Percent",
"AdjustmentValue": -10
},
{
"actions": {},
"DetailType": "ADJUSTMENT",
"Description": "Additional 10% - Add Child 2 Promo",
"StartValue": 42.5,
"EndValue": 37.5,
"AdjustmentType": "Discount",
"AdjustmentMethod": "Percent",
"AdjustmentValue": -10
}
]
}
}
]
}

Example Request
GET
/services/apexrest/vlocity_cmt/v2/listsofvalues?listkeys=TimePlans,TimePolicies

Example Response
{
"totalSize": 2,
"messages": [],
"records": [
{
"messages": [],
"displaySequence": -1,
"listkey": "TimePlans",
"listvalues": [
{
"uiStates": {},
"nameResult": {},
"messages": [],
"fields": {

© 2021 Vlocity LLC, a Salesforce


company 877
CME CPQ

"valuekey": "a2l460000005J5xAAE",
"label": "One Year"
},
"displaySequence": -1,
"actions": {}
},
{
"uiStates": {},
"nameResult": {},
"messages": [],
"fields": {
"valuekey": "a2l460000005J1ZAAU",
"label": "60 Days"
},
"displaySequence": -1,
"actions": {}
},
{
"uiStates": {},
"nameResult": {},
"messages": [],
"fields": {
"valuekey": "a2l460000005J1UAAU",
"label": "6 months"
},
"displaySequence": -1,
"actions": {}
}
]
},
{
"messages": [],
"displaySequence": -1,
"listkey": "TimePolicies",
"listvalues": [
{
"uiStates": {},
"nameResult": {},
"messages": [],
"fields": {
"valuekey": "a2m460000004xcvAAA",
"label": "First Day of the Month"
},
"displaySequence": -1,
"actions": {}
},

© 2021 Vlocity LLC, a Salesforce


company 878
CME CPQ

{
"uiStates": {},
"nameResult": {},
"messages": [],
"fields": {
"valuekey": "a2m460000004xbfAAA",
"label": "Time Policy Purchase Date"
},
"displaySequence": -1,
"actions": {}
}
]
}
]
}

Get Price Lists for Cart


Return the price lists available for a cart.

GET /v2/cpq/carts/{cart_ID}/pricelists

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
getPriceLists

REST Handler
REST Endpoint: APIPriceListsCpqV2.cls
Implementation: CpqGetPriceListsActionV2.cls

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName: getPriceLists
cartId: 80146000000 iwCx
pagesize: 2
}

© 2021 Vlocity LLC, a Salesforce


company 879
CME CPQ

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/pricelists

Example Request
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/8011I000000TUaK/pricelists?
pagesize=10

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"actions": {
"setpricelist": {
"rest": {
"params": {
"inputFields": [
{
"vlocity_cmt__PriceListId__c": "a2Y1I000000g50kUAA"
}
]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011I000000XegcQAC"
},
"remote": {
"params": {
"inputFields": [
{
"vlocity_cmt__PriceListId__c": "a2Y1I000000g50kUAA"
}
],

© 2021 Vlocity LLC, a Salesforce


company 880
CME CPQ

"cartId": "8011I000000XegcQAC",
"methodName": "updateCarts"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": "a2Y1I000000g50kUAA",
"Name": "Base PriceList"
}
]
}

Get Price Waterfall for Price


Get the price waterfall for a price. The Get Price Details API retrieves the pricing details for a price field
based on the cart context—opportunity, quote, order—specified by the cartId parameter and the line item
ID.

Only the PricingElementServiceImplementation supports the Get Price Details API.

GET /v2/cpq/carts/{cart_ID}/items/{ID}/pricing

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method

getPriceDetail

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information

Response Format JSON


Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items/{ID}/pricing

© 2021 Vlocity LLC, a Salesforce


company 881
CME CPQ

Example Request
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/80146000000goGv/items/
80246000000gZfO/pricing?fields=vlocity_cmt__OneTimeCharge__c

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"displaySequence": -1,
"id": "80246000000gZfOAAU",
"vlocity_cmt__OneTimeCharge__c": {
"pricedetail": [
{
"actions": {},
"DetailType": "PRICE",
"Description": "$50 One Time Standard Price",
"StartValue": 50,
"EndValue": 50,
"AdjustmentType": "None",
"AdjustmentMethod": null,
"AdjustmentValue": 0
},
{
"actions": {},
"DetailType": "ADJUSTMENT",
"Description": "5% Discount on OT Std Price due to Bundle
A...",
"StartValue": 50,
"EndValue": 47.5,
"AdjustmentType": "Discount",
"AdjustmentMethod": "Percent",
"AdjustmentValue": -5
},
{
"actions": {},
"DetailType": "ADJUSTMENT",
"Description": "10% Discount on OT Std Price due to
Promotion 'Add Bundle A'",
"StartValue": 47.5,
"EndValue": 42.5,

© 2021 Vlocity LLC, a Salesforce


company 882
CME CPQ

"AdjustmentType": "Discount",
"AdjustmentMethod": "Percent",
"AdjustmentValue": -10
},
{
"actions": {},
"DetailType": "ADJUSTMENT",
"Description": "Additional 10% - Add Child 2 Promo",
"StartValue": 42.5,
"EndValue": 37.5,
"AdjustmentType": "Discount",
"AdjustmentMethod": "Percent",
"AdjustmentValue": -10
}
]
}
}
]
}

Get Products by ID
Retrieve a list of products and attributes for the specified price book entry ID.

GET /v2/cpq/carts/{cart_ID}/products?{ID}&includeAttachment=[true|false]

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
getCartsProductsById

REST Handler
APIProductsCartsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName:getCartsProductsById,
cartId:801360000008eNU,

© 2021 Vlocity LLC, a Salesforce


company 883
CME CPQ

id: 991360000008eNU,
includeAttachment: true,
fields: Product2.vlocity_cmt__CustomField__c
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Example Request
GET
/v2/cpq/carts/{cart_ID}/products?
id=01t36000000pfcKAAQ,01t36000000pfcKAAQ&includeAttachment=true

Example Response
{
"totalSize" => 1,
"messages" => [],
"records" => [{
"messages" => [],
"actions" => {
"addtocart" => {
"rest" => {
"params" => {
"items" => [{
"itemId" => "01u6A00000135XPQAY"
}],
"cartId" => "8016A000000bwDJQAY",
"price" => true,
"validate" => true,
"includeAttachment" => true,
"pagesize" => 20,
"lastRecordId" => nil,
"query" => nil
},
"method" => "POST",
"link" =>
"/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/
items"
},
"remote" => {
"params" => {

© 2021 Vlocity LLC, a Salesforce


company 884
CME CPQ

"methodName" => "postCartsItems",


"items" => [{
"itemId" => "01u6A00000135XPQAY"
}],
"cartId" => "8016A000000bwDJQAY",
"price" => true,
"validate" => true,
"includeAttachment" => true,
"pagesize" => 20,
"lastRecordId" => nil,
"query" => nil
}
},
"client" => {
"params" => {}
}
},
"getproductbyid" => {
"rest" => {
"params" => {},
"method" => "GET",
"link" =>
"/services/apexrest/vlocity_cmt/v2/cpq/carts/8016A000000bwDJQAY/
products?cartId=8016A000000bwDJQAY&id=01u6A00000135XPQAY"
},
"remote" => {
"params" => {
"methodName" => "getCartsProductsById",
"id" => "01u6A00000135XPQAY",
"cartId" => "8016A000000bwDJQAY"
}
},
"client" => {
"params" => {
"cartId" => "8016A000000bwDJQAY",
"id" => "01u6A00000135XPQAY",
"methodName" => "getCartsProductsById"
}
}
}
},
"displaySequence" => -1,
"Id" => {
"label" => "Price Book Entry ID", "value" => "01u6A00000135XPQAY"
},
"Pricebook2Id" => {

© 2021 Vlocity LLC, a Salesforce


company 885
CME CPQ

"label" => "Price Book ID", "value" => "01s6A0000037JCtQAM"


},
"Product2Id" => {
"label" => "Product ID", "value" => "01t6A000000fczvQAA"
},
"ProductCode" => {
"label" => "Product Code", "value" => "IRKP1"
},
"UnitPrice" => {
"label" => "List Price", "value" => nil
},
"Name" => {
"label" => "Product Name", "value" => "IRKP1"
},
"vlocity_cmt__RecurringPrice__c" => {
"label" => "Recurring Price", "value" => nil
},
"IsActive" => {
"label" => "Active", "value" => true
},
"Product2" => {
"attributes" => {
"type" => "Product2",
"url" => "/services/data/v40.0/sobjects/Product2/01t6A000000fczvQAA"
},
"Id" => "01t6A000000fczvQAA",
"Name" => "IRKP1",
"vlocity_cmt__IsConfigurable__c" => false,
"vlocity_cmt__Type__c" => "None",
"vlocity_cmt__SubType__c" => "None",
"RecordTypeId" => "0126A000000gwBfQAI"
},
"productId" => "01t6A000000fczvQAA",
"defaultQuantity" => 1.0,
"minQuantity" => 0.0,
"maxQuantity" => 99999.0,
"groupMinQuantity" => 0,
"groupMaxQuantity" => 99999,
"sequenceNumber" => 1.0,
"productChildItemId" => "a2a6A000000wm6IQAQ",
"productChildItemDefinition" => {
"attributes" => {
"type" => "vlocity_cmt__ProductChildItem__c",
"url" =>
"/services/data/v40.0/sobjects/vlocity_cmt__ProductChildItem__c/
a2a6A000000wm6IQAQ"

© 2021 Vlocity LLC, a Salesforce


company 886
CME CPQ

},
"vlocity_cmt__MinQuantity__c" => 0,
"vlocity_cmt__SeqNumber__c" => 1.0,
"Name" => "Root PCI",
"Id" => "a2a6A000000wm6IQAQ",
"vlocity_cmt__Quantity__c" => 1,
"vlocity_cmt__MaximumChildItemQuantity__c" => 99999,
"vlocity_cmt__ParentProductId__r" => {
"attributes" => {
"type" => "Product2",
"url" =>
"/services/data/v40.0/sobjects/Product2/01t6A000000fczvQAA"
},
"Name" => "IRKP1",
"Id" => "01t6A000000fczvQAA",
"RecordTypeId" => "0126A000000gwBfQAI"
},
"vlocity_cmt__MaxQuantity__c" => 99999,
"vlocity_cmt__MinimumChildItemQuantity__c" => 0,
"vlocity_cmt__CollapseHierarchy__c" => false,
"vlocity_cmt__IsOverride__c" => false,
"vlocity_cmt__IsVirtualItem__c" => false,
"vlocity_cmt__ChildLineNumber__c" => "1",
"vlocity_cmt__IsRootProductChildItem__c" => true,
"vlocity_cmt__ParentProductId__c" => "01t6A000000fczvQAA"
},
"productHierarchyPath" => "01t6A000000fczvQAA",
"name" => "IRKP1",
"isVirtualItem" => false,
"attributeValues" => {},
"hasChildren" => true,
"itemType" => "childProduct",
"category" => "Qualified",
"productCategories" => {
"totalSize" => 0, "messages" => []
},
"childProducts" => {
"totalSize" => 0,
"messages" => [],
"records" => [{
"messages" => [],
"displaySequence" => -1,
"Id" => {
"label" => "Price Book Entry ID", "value" => "01u6A00000135XUQAY"
},
"Pricebook2Id" => {

© 2021 Vlocity LLC, a Salesforce


company 887
CME CPQ

"label" => "Price Book ID", "value" => "01s6A0000037JCtQAM"


},
"Product2Id" => {
"label" => "Product ID", "value" => "01t6A000000fd00QAA"
},
"ProductCode" => {
"label" => "Product Code", "value" => "IRKADDON"
},
"UnitPrice" => {
"label" => "List Price", "value" => nil
},
"Name" => {
"label" => "Product Name", "value" => "IRKADDON"
},
"vlocity_cmt__RecurringPrice__c" => {
"label" => "Recurring Price", "value" => nil
},
"IsActive" => {
"label" => "Active", "value" => true
},
"Product2" => {
"attributes" => {
"type" => "Product2",
"url" =>
"/services/data/v40.0/sobjects/Product2/01t6A000000fd00QAA"
},
"Id" => "01t6A000000fd00QAA",
"Name" => "IRKADDON",
"vlocity_cmt__IsConfigurable__c" => false,
"vlocity_cmt__Type__c" => "None",
"vlocity_cmt__SubType__c" => "None",
"RecordTypeId" => "0126A000000gwBfQAI"
},
"productId" => "01t6A000000fd00QAA",
"defaultQuantity" => 0.0,
"minQuantity" => 0.0,
"maxQuantity" => 1.0,
"groupMinQuantity" => 0,
"groupMaxQuantity" => 99999,
"sequenceNumber" => 1.0,
"productChildItemId" => "a2a6A000000wm6cQAA",
"productChildItemDefinition" => {
"attributes" =>
:
"vlocity_cmt__RecurringPrice__c" => {
"label" => "Recurring Price", "value" => nil

© 2021 Vlocity LLC, a Salesforce


company 888
CME CPQ

},
"IsActive" => {
"label" => "Active", "value" => true
},
"Product2" => {
"attributes" => {
"type" => "Product2",
"url" =>
"/services/data/v40.0/sobjects/Product2/01t6A000000fd00QAA"
},
"Id" => "01t6A000000fd00QAA",
"Name" => "IRKADDON",
"vlocity_cmt__IsConfigurable__c" => false,
"vlocity_cmt__Type__c" => "None",
"vlocity_cmt__SubType__c" => "None",
"RecordTypeId" => "0126A000000gwBfQAI"
},
"productId" => "01t6A000000fd00QAA",
"defaultQuantity" => 0.0,
"minQuantity" => 0.0,
"maxQuantity" => 1.0,
"groupMinQuantity" => 0,
"groupMaxQuantity" => 99999,
"sequenceNumber" => 1.0,
"productChildItemId" => "a2a6A000000wm6cQAA",
"productChildItemDefinition" => {
"attributes" => {
"type" => "vlocity_cmt__ProductChildItem__c",:
"vlocity_cmt__RecurringPrice__c" => {
"label" => "Recurring Price", "value" => nil
},
"IsActive" => {
"label" => "Active", "value" => true
},
"Product2" => {
"attributes" => {
"type" => "Product2",
"url" =>
"/services/data/v40.0/sobjects/
Product2/01t6A000000fd00QAA"
},
"Id" => "01t6A000000fd00QAA",
"Name" => "IRKADDON",
"vlocity_cmt__IsConfigurable__c" => false,
"vlocity_cmt__Type__c" => "None",
"vlocity_cmt__SubType__c" => "None",

© 2021 Vlocity LLC, a Salesforce


company 889
CME CPQ

"RecordTypeId" => "0126A000000gwBfQAI"


},
"productId" => "01t6A000000fd00QAA",
"defaultQuantity" => 0.0,
"minQuantity" => 0.0,
"maxQuantity" => 1.0,
"groupMinQuantity" => 0,
"groupMaxQuantity" => 99999,
"sequenceNumber" => 1.0,
"productChildItemId" => "a2a6A000000wm6cQAA",
"productChildItemDefinition" => {
"attributes" => {
"type" => "vlocity_cmt__ProductChildItem__c",
"url" =>
"/services/data/v40.0/sobjects/
vlocity_cmt__ProductChildItem__c/a2a6A000000wm6cQAA"
},
"vlocity_cmt__ChildProductId__c" => "01t6A000000fd00QAA",
"vlocity_cmt__MinQuantity__c" => 0,
"vlocity_cmt__SeqNumber__c" => 1.0,
"Name" => "a2a6A000000wm6c",
"Id" => "a2a6A000000wm6cQAA",
"vlocity_cmt__Quantity__c" => 0,
"vlocity_cmt__MaximumChildItemQuantity__c" => 99999,
"vlocity_cmt__ParentProductId__r" => {
"attributes" => {
"type" => "Product2",
"url" =>
"/services/data/v40.0/sobjects/
Product2/01t6A000000fczvQAA"
},
"Name" => "IRKP1",
"Id" => "01t6A000000fczvQAA",
"RecordTypeId" => "0126A000000gwBfQAI"
},
"vlocity_cmt__MaxQuantity__c" => 1,
"vlocity_cmt__ChildProductId__r" => {
"attributes" => {
"type" => "Product2",
"url" =>
"/services/data/v40.0/sobjects/
Product2/01t6A000000fd00QAA"
},
"Id" => "01t6A000000fd00QAA",
"RecordTypeId" => "0126A000000gwBfQAI"
},

© 2021 Vlocity LLC, a Salesforce


company 890
CME CPQ

"vlocity_cmt__MinimumChildItemQuantity__c" => 0,
"vlocity_cmt__CollapseHierarchy__c" => false,
"vlocity_cmt__IsOverride__c" => false,
"vlocity_cmt__IsVirtualItem__c" => false,
"vlocity_cmt__ChildLineNumber__c" => "1",
"vlocity_cmt__IsRootProductChildItem__c" => false,
"vlocity_cmt__ParentProductId__c" => "01t6A000000fczvQAA"
},
"productHierarchyPath" =>
"01t6A000000fczvQAA<01t6A000000fd00QAA",
"isVirtualItem" => false,
"attributeValues" => {},
"hasChildren" => true,
"itemType" => "childProduct",
"productCategories" => {
"totalSize" => 0, "messages" => []
},

NOTE
This example result has been truncated.

Get Promotions Applied to Cart


Return a list of promotions applied to a specified cart.

GET /v2/cpq/carts/{cart_ID}

Remote Method
getPromotionsAppliedToCart

REST Handlers
• REST endpoint: APIPromotionsCartsCpqV2.cls
• Implementation: CpqAppliedPromotionsCartsActionV2.cls

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName:getPromotionsAppliedToCart

© 2021 Vlocity LLC, a Salesforce


company 891
CME CPQ

cartId:80146000000iwCx,
pagesize:10,
fields:"Id,Name",
includePenalties:true,
filters:vlocity_cmt__AppliesTo__c:Account_Contract,
commitmentDateFilter:2020-04-05T07:00:00.000Z,
appliedPromoStatusFilter:Expired
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/promotions?
subaction=getPromotionsAppliedToCart

Example Request
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/801360000000oQ9/promotions

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"actions": {
"deleteappliedpromoitems": {
"rest": {
"params": {},
"method": "DELETE",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
801f40000008UlxAAE/promotions?id=a2Lf4000000TvFmEAK"
},
"remote": {
"params": {
"id": "a2Lf4000000TvFmEAK",
"cartId": "801f40000008UlxAAE",

© 2021 Vlocity LLC, a Salesforce


company 892
CME CPQ

"methodName": "deleteAppliedPromoItems"
}
},
"client": {
"params": {}
}
},
"getpromodetails": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
801f40000008UlxAAE/promotions?
id=a2Lf4000000TvFmEAK&subaction=getPromotionsAppliedToCart&includePenalties=tru
e"
},
"remote": {
"params": {
"includePenalties": true,
"subaction": "getPromotionsAppliedToCart",
"id": "a2Lf4000000TvFmEAK",
"cartId": "801f40000008UlxAAE",
"methodName": "getPromotionsAppliedToCart"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"value": "a2Lf4000000TvFmEAK",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Record ID",
"hidden": true,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"vlocity_cmt__BillingAccountId__c": {
"value": "001f40000093uqMAAQ",
"previousValue": null,

© 2021 Vlocity LLC, a Salesforce


company 893
CME CPQ

"originalValue": null,
"messages": [],
"label": "Account",
"hidden": true,
"fieldName": "vlocity_cmt__BillingAccountId__c",
"editable": true,
"dataType": "REFERENCE",
"actions": {}
},
"vlocity_cmt__Action__c": {
"value": "Change",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Action",
"hidden": true,
"fieldName": "vlocity_cmt__Action__c",
"editable": true,
"dataType": "PICKLIST",
"actions": {}
},
"vlocity_cmt__PromotionId__c": {
"value": "a2ff4000000cHPMAA2",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Promotion",
"hidden": true,
"fieldName": "vlocity_cmt__PromotionId__c",
"editable": true,
"dataType": "REFERENCE",
"actions": {}
},
"vlocity_cmt__Sequence__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Sequence",
"hidden": true,
"fieldName": "vlocity_cmt__Sequence__c",
"editable": true,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__FulfilmentStatus__c": {

© 2021 Vlocity LLC, a Salesforce


company 894
CME CPQ

"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Fulfilment Status",
"hidden": true,
"fieldName": "vlocity_cmt__FulfilmentStatus__c",
"editable": true,
"dataType": "PICKLIST",
"actions": {}
},
"vlocity_cmt__ReasonForCancellation__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Reason for Cancellation",
"hidden": true,
"fieldName": "vlocity_cmt__ReasonForCancellation__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RequestDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Request Date",
"hidden": true,
"fieldName": "vlocity_cmt__RequestDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"vlocity_cmt__SubAction__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Sub Action",
"hidden": true,
"fieldName": "vlocity_cmt__SubAction__c",
"editable": true,
"dataType": "PICKLIST",
"actions": {}

© 2021 Vlocity LLC, a Salesforce


company 895
CME CPQ

},
"vlocity_cmt__CommitmentStartDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Commitment Start Date",
"hidden": true,
"fieldName": "vlocity_cmt__CommitmentStartDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"vlocity_cmt__CommitmentEndDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Commitment End Date",
"hidden": true,
"fieldName": "vlocity_cmt__CommitmentEndDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"vlocity_cmt__PricingStartDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Benefit Start Date",
"hidden": true,
"fieldName": "vlocity_cmt__PricingStartDate__c",
"editable": true,
"dataType": "DATETIME",
"actions": {}
},
"vlocity_cmt__PricingEndDate__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Benefit End Date",
"hidden": true,
"fieldName": "vlocity_cmt__PricingEndDate__c",
"editable": true,

© 2021 Vlocity LLC, a Salesforce


company 896
CME CPQ

"dataType": "DATETIME",
"actions": {}
},
"vlocity_cmt__AppliesTo__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Applies To",
"hidden": true,
"fieldName": "vlocity_cmt__AppliesTo__c",
"editable": true,
"dataType": "PICKLIST",
"actions": {}
},
"Name": "BundleJul19Promo",
"Description": "BundleJul19Promo",
"OrderRequestDate": "2019-11-13"
}
]
}

Get String Translation Dictionary


Retrieve the dictionary for a specified domain and locale.

GET /v2/stringtranslations/{domain}/{local_code}

Apex Remote Service


APIHandler

Remote Method
getDictionary

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

To take advantage of web caching, copy the value of the ETag that is returned in the response header, and
assign this value to If-None-Match in the request header of subsequent requests.

Example Response
{
"totalSize": 1,

© 2021 Vlocity LLC, a Salesforce


company 897
CME CPQ

"records": [{
"displaySequence": -1,
"localeCode": "fr",
"domain": "CPQ",
"totalSize": 22,
"dictionary": {
"failed products": "failed products fr",
"IPhone 6 >> 4 GB && 128 GB": "abc_translate_IPhone 6 >> 4 GB && 128
GB",
"IPhone 6 >> \nRAM 4 GB && Memory 128 GB": "IPhone 6 >> 4 GB && 128 GB
fr",
"this is <description> for P ^ P promotion": "this is <description> for
P ^ P promotion <fr>",
"this is <description> for May & June": "this is <description> for May &
June _fr",
"TestProd-4": "ptestprod-fr",
"TestProd-11": "ytestprod-fr",
"May & June": "fr_May & June",
"this is test promo 1": "this & is & test < promo 1",
"this is test promo 2": "this < is > test promo2",
"Promo-5": "Test & Promo 5",
"Promo-6": "Test < Promo 6",
"TestProd-2": "atestprod-fr",
"TestProd-20": "htestprod-20",
"TestProd-1": "ztestprod-fr",
"Demo-B": "demo-B_fr",
"Demo-A": "é;chantillon-a",
"TestProd-10": "TestProd-10_fr",
"May17SpecialChars <= this text will be cut out": "serasdfwe",
"TestProd-3": "gtestprod-3_fr",
"SPE-26": "spe<26>",
"Acc-1": "hr_fr"
}
}]
}

Get String Translations


Retrieve all string translations for a specified language and list of string translation object IDs.

GET /v2/stringtranslations/ID[,ID...]

Remote Action
APIHandler

© 2021 Vlocity LLC, a Salesforce


company 898
CME CPQ

Remote Method
getStringTranslations

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/stringtranslations

Example Response
{
"totalSize": 20,
"actions": {
"nexttranslation": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/stringtranslations?
pagesize=20&offsetSize=20&lastRecordId=a3b1N000000pfprQAA"
},
"remote": {
"params": {}
},
"client": {
"params": {}
}
}
},
"records": [{
"displaySequence": -1,
"Id": "a3b1N000000pfpLQAQ",
"Name": "ar-fi",
"vlocity_cmt__StringId__c": "a3c1N0000016TkaQAE",
"vlocity_cmt__Translation__c": "ar-fi",
"vlocity_cmt__LocaleCode__c": "fi",
"vlocity_cmt__StringId__r": {
"attributes": {
"type": "vlocity_cmt__String__c",
"url": "/services/data/v43.0/sobjects/vlocity_cmt__String__c/

© 2021 Vlocity LLC, a Salesforce


company 899
CME CPQ

a3c1N0000016TkaQAE"
},
"Id": "a3c1N0000016TkaQAE",
"vlocity_cmt__BaseString__c": "AR"
}
}, {
"displaySequence": -1,
"Id": "a3b1N000000pfpNQAQ",
"Name": "ar",
"vlocity_cmt__StringId__c": "a3c1N0000016TkaQAE",
"vlocity_cmt__Translation__c": "ar",
"vlocity_cmt__LocaleCode__c": "de",
"vlocity_cmt__StringId__r": {
"attributes": {
"type": "vlocity_cmt__String__c",
"url": "/services/data/v43.0/sobjects/vlocity_cmt__String__c/
a3c1N0000016TkaQAE"
},
"Id": "a3c1N0000016TkaQAE",
"vlocity_cmt__BaseString__c": "AR"
}
}, {
"displaySequence": -1,
"Id": "a3b1N000000pfpOQAQ",
"Name": "acc-1-fr",
"vlocity_cmt__StringId__c": "a3c1N0000016TkbQAE",
"vlocity_cmt__Translation__c": "acc-1-fr",
"vlocity_cmt__LocaleCode__c": "fi",
"vlocity_cmt__StringId__r": {
"attributes": {
"type": "vlocity_cmt__String__c",
"url": "/services/data/v43.0/sobjects/vlocity_cmt__String__c/
a3c1N0000016TkbQAE"
},
"Id": "a3c1N0000016TkbQAE",
"vlocity_cmt__BaseString__c": "Acc-1"
}
}, ...
[EXAMPLE TRUNCATED FOR BREVITY]

Post Cart Promotion Items


Add applied promotion items to the cart.

POST /v2/cpq/carts/{cart_ID}/promotions

© 2021 Vlocity LLC, a Salesforce


company 900
CME CPQ

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
postCartsPromoItems

REST Handler
APIPromotionsCartsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
"items": [{
"itemId": "a2ff4000000Li5eAAC"
}],
"promotionId": "a2ff4000000Li5eAAC",
"cartId": "801f40000012NEIAA2",
"methodName": "postCartsPromoItems"
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/promotions

Example Request
POST
/services/apexrest/vlocity_cmt/v2/cpq/carts/801f40000012NEIAA2/promotions

BODY:
{

© 2021 Vlocity LLC, a Salesforce


company 901
CME CPQ

"items": [
{
"itemId": "a2ff4000000Li5eAAC"
}
],
"promotionId": "a2ff4000000Li5eAAC",
"cartId": "801f40000012NEIAA2",
"methodName": "postCartsPromoItems"
}

Example Response
{
"totalSize": 0,
"messages": [],
"actions": {
"itempricesupdated": {
"rest": {
"params": {},
"method": "GET",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/801f40000012NEIAA2/
price"
},
"remote": {
"params": {
"cartId": "801f40000012NEIAA2",
"methodName": "getCartLineItemPrices"
}
},
"client": {
"params": {}
}
},
"itemadded": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {}
},
"client": {
"params": {
"items": [{
"message": "TestProd-7 has been auto-added to the cart.",

© 2021 Vlocity LLC, a Salesforce


company 902
CME CPQ

"Id": null
}]
}
}
},
"rootitemadded": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {}
},
"client": {
"params": {},
"records": [{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "postCartsItems",
"items": [{
"quantity": 1,
"parentId": "802f4000000CuauAAC",
"itemId": "01uf4000000sXvTAAU"
}],
"cartId": "801f40000012NEIAA2",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},

© 2021 Vlocity LLC, a Salesforce


company 903
CME CPQ

"updateitems": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "putCartsItems",
"items": [{
"itemId": "802f4000000CuauAAC"
}],
"filters": null,
"fields": null,
"cartId": "801f40000012NEIAA2",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"deleteitem": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "deleteCartsItems",
"id": "802f4000000CuauAAC",
"filters": null,
"fields": null,
"cartId": "801f40000012NEIAA2",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null

© 2021 Vlocity LLC, a Salesforce


company 904
CME CPQ

}
},
"client": {
"params": {}
}
},
"configdelete": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "configDeleteItem",
"id": "802f4000000CuauAAC",
"cartId": "801f40000012NEIAA2"
}
},
"client": {
"params": {}
}
},
"cloneitem": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "cloneItems",
"items": [{
"itemId": "802f4000000CuauAAC"
}],
"id": "802f4000000CuauAAC",
"cartId": "801f40000012NEIAA2"
}
},
"client": {
"params": {}
}
},
"modifyattributes": {
"rest": {
"params": {},

© 2021 Vlocity LLC, a Salesforce


company 905
CME CPQ

"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "putItemAttributes",
"items": [{
"itemId": "802f4000000CuauAAC"
}],
"filters": null,
"itemId": "802f4000000CuauAAC",
"id": "802f4000000CuauAAC",
"cartId": "801f40000012NEIAA2"
}
},
"client": {
"params": {}
}
},
...
EXAMPLE TRUNCATED FOR BREVITY

Price Items in Cart (Query)


Retrieve current prices for the items in the cart.

GET /v2/cpq/carts/{cart_ID}/price?price={true|
false}&priceDetailsFields={field_name}%2C{field_name}

This API provides a way of retrieving minimal pricing fields to refresh the UI. It is called by the UI after a
putCartsItems call. When this API is called by the CPQ cart UI, it uses price=false, so the pricing
interface implementation is not executed.

This API can be called either through REST or through Apex remote calls. The default value for the price
parameter is true. If price=false is not specified, pricing is executed by default. Specify price=false
if you do not want to execute pricing.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
getCartLineItemPrices

© 2021 Vlocity LLC, a Salesforce


company 906
CME CPQ

REST Handlers

REST endpoint: APIPriceCartsCpqV2.cls


Implementation: CpqGetCartLineItemPricesActionV2.cls

Apex Remote Service

CpqAppHandler

Apex Remote Input Map

{
"methodName": "getCartLineItemPrices",
"cartId": "801360000008eNU",
"priceDetailsFields": "vlocity_cmt__OneTimeCharge__c,
vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeTotal__c,
vlocity_cmt__RecurringTotal__c"
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information

Response Format JSON


Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/price

Example Request

GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/80146000000iwCx/price?price=true

NOTE
Setting price=true will run the pricing engine, which can negatively impact performance.
To enhance performance, set price=false to return pricing information without repricing.

© 2021 Vlocity LLC, a Salesforce


company 907
CME CPQ

Example Response
{
"totalSize": 1,
"messages": [],
"records": [
{
"messages": [],
"displaySequence": -1,
"vlocity_cmt__EffectiveQuantity__c": {
"value": 1
},
"vlocity_cmt__OneTimeCharge__c": {
"value": 100
},
"vlocity_cmt__OneTimeManualDiscount__c": {
"value": 0
},
"vlocity_cmt__OneTimeCalculatedPrice__c": {
"value": 100
},
"vlocity_cmt__OneTimeTotal__c": {
"value": 100
},
"vlocity_cmt__RecurringCharge__c": {
"value": 20
},
"vlocity_cmt__RecurringManualDiscount__c": {
"value": 0
},
"vlocity_cmt__RecurringCalculatedPrice__c": {
"value": 20
},
"vlocity_cmt__RecurringTotal__c": {
"value": 20
},
"vlocity_cmt__EffectiveOneTimeTotal__c": {
"value": 100
},
"vlocity_cmt__EffectiveRecurringTotal__c": {
"value": 20
},
"Quantity": {
"value": 1
},
"Id": {

© 2021 Vlocity LLC, a Salesforce


company 908
CME CPQ

"value": "80246000000dwt8AAA"
},
"PricebookEntryId": {
"value": "01u46000001YhBOAA0"
},
"vlocity_cmt__LineNumber__c": {
"value": "0001"
},
"PricebookEntry": {
"attributes": {
"type": "PricebookEntry",
"url": "/services/data/v41.0/sobjects/PricebookEntry/
01u46000001YhBOAA0"
},
"Id": "01u46000001YhBOAA0",
"Product2Id": "01t46000000LFXRAA4",
"Pricebook2Id": "01s46000003EDDHAA4",
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/Product2/01t46000000LFXRAA4"
},
"Id": "01t46000000LFXRAA4",
"Name": "Product A",
"ProductCode": "PROD_A",
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__IsConfigurable__c": false
}
},
"Name": "Product A"
}
]
}

Remove Items from Cart


Delete the specified items from the cart. When products are bundled, the API deletes the child items.
Returns error in case of cardinality failures or any other failures.

DELETE /v2/cpq/carts/{cart_ID}/items

© 2021 Vlocity LLC, a Salesforce


company 909
CME CPQ

NOTE
By default, items deleted from a cart are not evaluated for Vlocity Rules. To enable
evaluation of deleted items, set the 'ShouldConsiderDeletedItems' custom setting to true.

Delete Items replaces the OmniCPQServiceWrapper deleteItem method.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
deleteCartsItems

NOTE
In releases prior to CME Spring '20, the deleteCartsItems method supports the
deletion of one item at a time. If you must delete multiple items, make multiple
deleteCartsItems calls.

With CME Spring '20 and later releases, the itemId parameter supports multiple comma-
separated values when deleting root and child items via deleteCartsItems method
calls if UOWMode is set to true.

REST Handler
APIItemsCartsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
methodName:deleteCartsItems,
cartId:801360000008eNU,
id:01t36000000pfcKAAQ

© 2021 Vlocity LLC, a Salesforce


company 910
CME CPQ

}
id = orderLineItem.Id, quoteLineItem.Id, opportunityLineItem.Id

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URI /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items/{itemId}

Example Request
DELETE
/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8H/items/
80241000000Ha4a

Example Response
{
"totalSize": 0,
"messages": [{
"severity": "INFO",
"messageId": null,
"message": "Successfully deleted.",
"code": "152",
"actions": {}
}],
"actions": {
"deletecart": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {}
},
"client": {
"params": {
"items": [{
"message": "Root 1 has been deleted from the cart. ",
"Id": "80241000000Ha4aAAC"

© 2021 Vlocity LLC, a Salesforce


company 911
CME CPQ

}],
"mode": "DELETE"
}
}
}
}
}

Run Pricing for Items to Cart


Return the pricing information for each line item by invoking pricing rules. If line items are specified, they
are priced. If line items are not specified, all of the items in the cart are priced.

POST /v2/cpq/carts/{cart_ID}/price

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
priceCart

REST Handler
APIPriceCartsCpqV2

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
"methodName": "priceCart",
"cartId": "801360000008eNU",
"items": [ "123456","99999" ]
}

Where items specifies the associated line item IDs.

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

© 2021 Vlocity LLC, a Salesforce


company 912
CME CPQ

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/price

Example Request
POST
/services/apexrest/vlocity_cmt/v2/cpq/carts/80141000000Cg8H/price

Example Response
{
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"displaySequence": -1,
"details": {
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"actions": {
"checkout": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/checkout"
},
"remote": {
"params": {
"cartId": "80141000000Cg8HAAS",
"methodName": "checkout"
}
},
"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": "80141000000Cg8HAAS",
"Status": "Draft",
"OrderNumber": "00000965",

© 2021 Vlocity LLC, a Salesforce


company 913
CME CPQ

"Account.Name": "Telco test",


"EffectiveRecurringTotal__c": 0.00,
"EffectiveOneTimeTotal__c": 5.00,
"EffectiveOrderTotal__c": 5.00,
"ObjectType": "Order"
}]
},
"sites": {
"totalSize": 0,
"messages": [{
"severity": "ERROR",
"messageId": null,
"message": "No Results Found.",
"code": "101",
"actions": {}
}],
"actions": {
"newsite": {
"rest": {
"params": {},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/sites"
},
"remote": {
"params": {
"type": "Service",
"methodName": "newSite"
}
},
"client": {
"params": {}
}
}
}
}
}]
}

Submit a Cancel Order Request


Cancel an in-flight order.

POST /v2/cpq/carts/{order_ID}/cancel

For CME Winter '20 and later releases, the Cancel button is used to cancel an in-flight order.

© 2021 Vlocity LLC, a Salesforce


company 914
CME CPQ

For releases prior to CME Winter '20, the Cancel Order button is used to invoke the submitCancelOrder
API, create a supplemental order, and submit the order to Vlocity Order Management.

The submitCancelOrder API uses the Supplemental Order interface implementations that predate the CME
Winter '20 release, including SupplementalOrderService and XOMSupplementalOrderLifeCycle. See In-
Flight Order Cancellation.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Apex Method
Use this method with the supplemental order's ID as input (supplementalOrdId) to submit a cancel
order request.

public static void submitSupplementalOrder(Id originalOrdId, Id


supplementalOrdId)
{
final String methodName = 'submitCancelOrder';
Map<String, Object> inputMap = new Map<String, Object>
{
'cartId' => originalOrdId,
'methodName' => methodName,
'cancelOrderId' => supplementalOrdId
};
Map<String, Object> outputMap = new Map<String, Object>();
Map<String, Object> optionsMap = new Map<String, Object>();
vlocity_cmt.CpqAppHandler handler = new vlocity_cmt.CpqAppHandler();
handler.invokeMethod(methodName, inputMap, outputMap, optionsMap);

// traverse the result that was returned, to find the supplemental order
id.
vlocity_cmt.JSONResult result = (vlocity_cmt.JSONResult)
outputMap.get('result');
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON

© 2021 Vlocity LLC, a Salesforce


company 915
CME CPQ

Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{order_ID}/cancel

Example Request
POST
/services/apexrest/v2/cpq/carts/{order_ID}/cancel

Example Request Body


{
"cartId": "order_ID",
"subaction": "submitCancelOrder",
"cancelOrderId": "supplemental_order_ID"
}

See Also
• Cancel Order
• Create Supplemental Order
• In-Flight Order Cancellation

Unfreeze Order
Unfreezes a previously frozen order.

POST /v2/cpq/carts/{order_ID}/unfreeze

For CME Winter '20 and later releases, create an unfreeze order request to the order management system.

A Freeze Order API request may have frozen order fulfillment. If the user decides not to submit a
supplemental order, you can use the unfreezeOrder API to unfreeze the order's fulfillment.

If the order management system sends the Accepted response, the OrderStatus__c field is set to In
Progress.

Apex Method
Use this method with the current order's ID as input (currentOrdId) to unfreeze a frozen order fulfillment.

public static void unfreezeOrder(Id currentOrdId)


{
final String methodName = 'unfreezeOrder';
Map<String, Object> inputMap = new Map<String, Object>
{
'cartId' => currentOrdId,
'methodName' => methodName
};
Map<String, Object> outputMap = new Map<String, Object>();

© 2021 Vlocity LLC, a Salesforce


company 916
CME CPQ

Map<String, Object> optionsMap = new Map<String, Object>();


vlocity_cmt.CpqAppHandler handler = new vlocity_cmt.CpqAppHandler();
handler.invokeMethod(methodName, inputMap, outputMap, optionsMap);
// traverse the result that was returned, to find the supplemental order
id.
vlocity_cmt.JSONResult result = (vlocity_cmt.JSONResult)
outputMap.get('result');
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{order_ID}/unfreeze

Example Request
POST
/services/apexrest/v2/cpq/carts/{order_ID}/unfreeze

Example Request Body


{
"cartId": "order_ID"
}

See Also
• Cancel Order
• Create Supplemental Order

Update Item Attributes


Update quantity, fields, and attributes for a specified line item in the cart.

To persist changes after calling this API, you must call the Update Items in Cart API.

PUT /v2/cpq/carts/{cart_ID}/items/{item_ID}/itemAttributes

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User

© 2021 Vlocity LLC, a Salesforce


company 917
CME CPQ

Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

Remote Method
putItemAttributes

Handlers
• REST endpoint: APIItemAttributesItemsCartsCpqV2.cls
• Implementation: CpqModifyAttributeActionV2.cls

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


{
"fields":null,
"items":{JSONRECORD},
"itemId":"8021I000001kvWeQAI",
"cartId":"8011I000000TOcSQAW",
"methodName":"putItemAttributes",
"price":true,"validate":true
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items/{item_ID}/itemAttributes

Example Request
PUT
/services/apexrest/vlocity_cmt/v2/cpq/carts/80146000000iwCx/items/
80236000009E2InAAK/itemAttributes

Example Request Body


{
"methodName": "putItemAttributes",

© 2021 Vlocity LLC, a Salesforce


company 918
CME CPQ

"items": {
"records": [{
"attributeCategories": {
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"displaySequence": 999,
"Code__c": "0529CattegoryA",
"Name": "0529CattegoryA",
"id": "a0941000006fDUjAAM",
"productAttributes": {
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"code": "A_PicklistAttribute_Text",
"dataType": "text",
"inputType": "dropdown",
"multiselect": false,
"required": false,
"readonly": false,
"disabled": false,
"filterable": true,
"attributeId": "a0A41000005Xp1IEAS",
"label": "A_PicklistAttribute_Text",
"displaySequence": 1,
"hasRules": true,
"values": [{
"id": "1",
"name": "1",
"label": "I am first (label)",
"readonly": false,
"disabled": false,
"value": "1",
"defaultSelected": false
},
{
"id": "2",
"name": "2",
"label": "I am second (label)",
"readonly": false,
"disabled": false,
"value": "2",
"defaultSelected": false
},

© 2021 Vlocity LLC, a Salesforce


company 919
CME CPQ

{
"id": "3",
"name": "3",
"label": "I am third (label)",
"readonly": false,
"disabled": false,
"value": "3",
"defaultSelected": false
},
{
"id": "4",
"name": "4",
"label": "I am no sequence (label)",
"readonly": false,
"disabled": false,
"value": "4",
"defaultSelected": false
}
],
"userValues": "1"
}]
}
}]
},
"Id": {
"value": "80241000006AutkAAC",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/Product2/01t410000032V0sAAE"
},
"Name": "City2City",
"vlocity_cmt__IsConfigurable__c": true,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"Id": "01t410000032V0sAAE",

© 2021 Vlocity LLC, a Salesforce


company 920
CME CPQ

"vlocity_cmt__JSONAttribute__c": null
},
"PricebookEntry": {
"attributes": {
"type": "PricebookEntry",
"url": "/services/data/v41.0/sobjects/PricebookEntry/
01u41000004eEY1AAM"
},
"Product2Id": "01t410000032V0sAAE",
"Pricebook2Id": "01s41000007liRQAAY",
"Id": "01u41000004eEY1AAM",
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/Product2/01t410000032V0sAAE"
},
"Name": "City2City",
"Id": "01t410000032V0sAAE",
"ProductCode": "City2City",
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__IsConfigurable__c": true
},
"value": {
"attributes": {
"type": "PricebookEntry",
"url": "/services/data/v41.0/sobjects/PricebookEntry/
01u41000004eEY1AAM"
},
"Product2Id": "01t410000032V0sAAE",
"Id": "01u41000004eEY1AAM",
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v41.0/sobjects/
Product2/01t410000032V0sAAE"
},
"Name": "City2City",
"Id": "01t410000032V0sAAE"
}
}
},
"PricebookEntryId": {
"value": "01u41000004eEY1AAM",
"previousValue": null,
"originalValue": null,
"messages": [],

© 2021 Vlocity LLC, a Salesforce


company 921
CME CPQ

"label": "Price Book Entry ID",


"hidden": false,
"fieldName": "PricebookEntryId",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
}
}]
},
"filters": null,
"itemId": "80241000006AutkAAC",
"id": "80241000006AutkAAC",
"cartId": "80141000002H2ILAA0",
"price": true,
"validate": true
}

Example Response
{
"totalSize": 1,
"messages": [{
"severity": "INFO",
"messageId": null,
"message": "No attributes to be modified.",
"code": "162",
"bundleId": null,
"actions": {}
}],
"records": [{
"messages": [],
"displaySequence": -1,
"Id": {
"value": "80241000006AutkAAC",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"Product2": {
"attributes": {

© 2021 Vlocity LLC, a Salesforce


company 922
CME CPQ

"url": "/services/data/v41.0/sobjects/Product2/01t410000032V0sAAE",
"type": "Product2"
},
"Name": "City2City",
"vlocity_cmt__IsConfigurable__c": true,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"Id": "01t410000032V0sAAE",
"vlocity_cmt__JSONAttribute__c": null
},
"PricebookEntry": {
"attributes": {
"url": "/services/data/v41.0/sobjects/PricebookEntry/
01u41000004eEY1AAM",
"type": "PricebookEntry"
},
"Product2Id": "01t410000032V0sAAE",
"Pricebook2Id": "01s41000007liRQAAY",
"Id": "01u41000004eEY1AAM",
"Product2": {
"vlocity_cmt__IsConfigurable__c": true,
"vlocity_cmt__Type__c": "None",
"ProductCode": "City2City",
"Id": "01t410000032V0sAAE",
"Name": "City2City",
"attributes": {
"url": "/services/data/v41.0/sobjects/Product2/01t410000032V0sAAE",
"type": "Product2"
}
},
"value": {
"Product2": {
"Id": "01t410000032V0sAAE",
"Name": "City2City",
"attributes": {
"url": "/services/data/v41.0/sobjects/Product2/01t410000032V0sAAE",
"type": "Product2"
}
},
"Id": "01u41000004eEY1AAM",
"Product2Id": "01t410000032V0sAAE",
"attributes": {
"url": "/services/data/v41.0/sobjects/PricebookEntry/
01u41000004eEY1AAM",
"type": "PricebookEntry"
}

© 2021 Vlocity LLC, a Salesforce


company 923
CME CPQ

}
},
"PricebookEntryId": {
"value": "01u41000004eEY1AAM",
"previousValue": null,
"originalValue": null,
"messages": [],
"label": "Price Book Entry ID",
"hidden": false,
"fieldName": "PricebookEntryId",
"editable": false,
"dataType": "REFERENCE",
"actions": {}
},
"attributeCategories": {
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"displaySequence": 999,
"Code__c": "0529CattegoryA",
"Name": "0529CattegoryA",
"id": "a0941000006fDUjAAM",
"productAttributes": {
"totalSize": 1,
"messages": [],
"records": [{
"messages": [],
"code": "A_PicklistAttribute_Text",
"dataType": "text",
"inputType": "dropdown",
"multiselect": false,
"required": false,
"readonly": false,
"disabled": false,
"filterable": true,
"attributeId": "a0A41000005Xp1IEAS",
"label": "A_PicklistAttribute_Text",
"displaySequence": -1,
"hasRules": true,
"values": [{
"id": "1",
"name": "1",
"label": "I am first (label)",
"readonly": false,
"disabled": false,

© 2021 Vlocity LLC, a Salesforce


company 924
CME CPQ

"value": "1",
"defaultSelected": false
},
{
"id": "2",
"name": "2",
"label": "I am second (label)",
"readonly": false,
"disabled": false,
"value": "2",
"defaultSelected": false
},
{
"id": "3",
"name": "3",
"label": "I am third (label)",
"readonly": false,
"disabled": false,
"value": "3",
"defaultSelected": false
},
{
"id": "4",
"name": "4",
"label": "I am no sequence (label)",
"readonly": false,
"disabled": false,
"value": "4",
"defaultSelected": false
}
],
"userValues": "1"
}]
}
}]
}
}]
}

Update Items in Cart


Update one or more items in the specified cart with the revised set of items specified in the request body.

This API can update the following information:

• Item quantity
• Attribute values for the items

© 2021 Vlocity LLC, a Salesforce


company 925
CME CPQ

• Any other updatable field on the line item, such as Service Account ID or Billing Account ID

NOTE
Update Line Items in Cart replaces the OmniCPQServiceWrapper updateItem method.

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To
encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User
Technical Details. For additional information, UserSecurity Class and CPQ and Digital Commerce Changes
for Guest Users.

URI
/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items

HTTP Method
PUT

Request Parameters
Parameter Description
namespace vlocity_cmt
cart_ID The unique ID of the cart, which is the ID of the opportunity, quote, or order

Query Parameters, Requests, and Responses


For information about query parameters, request formats, response formats, see Cart-Based API Swagger
Reference.

Remote Method
putCartsItems

Apex Remote Service


CpqAppHandler

Apex Remote Input Map


To call putCartsItems, you must pass the JSONRecord for the attribute to update. The format of the
request is:

{
methodName:putCartsItems,

© 2021 Vlocity LLC, a Salesforce


company 926
CME CPQ

cartId:801360000008eNU,
items:[ {itemJSON} ]
}

In the request, itemJSON is the actual JSONRecord that is being updated. This JSONRecord is provided
by the response to an Add Items to Cart or Get Cart Items API call. Based on that response, update the
record or record attribute.

Example putCartsItems Request


{
"methodName": "putCartsItems",
"items": {
"records": [
{
"displaySequence": -1,
"Id": {
"value": "8026g000001e9vVAAQ",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"alternateValues": null,
"actions": {

}
},
"Pricebook2Id": "01s6g000008hmAUAAY",
"Product2Id": "01t6g000003DpXAAA0",
"ProductCode": "Phone1",
"UnitPrice": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Unit Price",
"hidden": true,
"fieldName": "UnitPrice",

© 2021 Vlocity LLC, a Salesforce


company 927
CME CPQ

"editable": false,
"dataType": "CURRENCY",
"alternateValues": null,
"actions": {

}
},
"Name": "Phone1",
"IsActive": true,
"vlocity_cmt__RecurringPrice__c": 0,
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v48.0/sobjects/Product2/01t6g000003DpXAAA0"
},
"Name": "Phone1",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "0126g000001Ktw7AAC",
"Id": "01t6g000003DpXAAA0",
"vlocity_cmt__JSONAttribute__c": null
},
"productId": "01t6g000003DpXAAA0",
"defaultQuantity": 1,
"minQuantity": 0,
"maxQuantity": 2,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1,
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c"
},
"Name": "Root PCI",
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__MaxQuantity__c": 2,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01t6g000003DpXAAA0",
"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1,
"vlocity_cmt__CollapseHierarchy__c": false,

© 2021 Vlocity LLC, a Salesforce


company 928
CME CPQ

"vlocity_cmt__IsRootProductChildItem__c": true,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v48.0/sobjects/
Product2/01t6g000003DpXAAA0"
},
"Name": "Phone1",
"Id": "01t6g000003DpXAAA0",
"RecordTypeId": "0126g000001Ktw7AAC"
}
},
"productHierarchyPath": "01t6g000003DpXAAA0",
"name": "Phone1",
"isVirtualItem": false,
"action": "Add",
"hasChildren": false,
"SellingPeriod": "Present",
"itemType": "lineItem",
"PricebookEntryId": {
"value": "01u6g000002qmvOAAQ",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Price Book Entry ID",
"hidden": false,
"fieldName": "PricebookEntryId",
"editable": false,
"dataType": "REFERENCE",
"alternateValues": null,
"actions": {

}
},
"Quantity": {
"value": 2,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Quantity",
"hidden": false,
"fieldName": "Quantity",

© 2021 Vlocity LLC, a Salesforce


company 929
CME CPQ

"editable": true,
"dataType": "DOUBLE",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__OneTimeTotal__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "One Time Total",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeTotal__c",
"editable": false,
"dataType": "CURRENCY",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__RecurringTotal__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Recurring Total",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringTotal__c",
"editable": false,
"dataType": "CURRENCY",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__Action__c": {
"value": "Add",
"previousValue": null,
"originalValue": null,
"messages": [

© 2021 Vlocity LLC, a Salesforce


company 930
CME CPQ

],
"label": "Action",
"hidden": false,
"fieldName": "vlocity_cmt__Action__c",
"editable": true,
"dataType": "PICKLIST",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__ProvisioningStatus__c": {
"value": "New",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Provisioning Status",
"hidden": true,
"fieldName": "vlocity_cmt__ProvisioningStatus__c",
"editable": false,
"dataType": "STRING",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__BillingAccountId__c": {
"value": "0016g00000NXwrqAAD",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Billing Account",
"hidden": false,
"fieldName": "vlocity_cmt__BillingAccountId__c",
"editable": true,
"dataType": "REFERENCE",
"alternateValues": null,
"actions": {
"availablesites": {
"rest": {
"params": {

© 2021 Vlocity LLC, a Salesforce


company 931
CME CPQ

},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "getAvailableSites",
"lookupField": "vlocity_cmt__billingaccountid__c",
"id": "8026g000001e9vVAAQ",
"cartId": "8016g000001EYYfAAO"
}
},
"client": {
"records": [

],
"params": {

}
}
}
}
},
"vlocity_cmt__ServiceAccountId__c": {
"value": "0016g00000NXwrqAAD",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Service Account",
"hidden": false,
"fieldName": "vlocity_cmt__ServiceAccountId__c",
"editable": true,
"dataType": "REFERENCE",
"alternateValues": null,
"actions": {
"availablesites": {
"rest": {
"params": {

},
"method": null,
"link": null
},

© 2021 Vlocity LLC, a Salesforce


company 932
CME CPQ

"remote": {
"params": {
"methodName": "getAvailableSites",
"lookupField": "vlocity_cmt__serviceaccountid__c",
"id": "8026g000001e9vVAAQ",
"cartId": "8016g000001EYYfAAO"
}
},
"client": {
"records": [

],
"params": {

}
}
}
}
},
"vlocity_cmt__ProductHierarchyPath__c": {
"value": "01t6g000003DpXAAA0",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Product Hierarchy Path",
"hidden": true,
"fieldName": "vlocity_cmt__ProductHierarchyPath__c",
"editable": false,
"dataType": "STRING",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__LineNumber__c": {
"value": "0001",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "LineNumber",
"hidden": true,
"fieldName": "vlocity_cmt__LineNumber__c",

© 2021 Vlocity LLC, a Salesforce


company 933
CME CPQ

"editable": false,
"dataType": "STRING",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__RootItemId__c": {
"value": "6710c5b9-d9ed-c47b-cf50-37e69ac42664",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "RootItemId",
"hidden": true,
"fieldName": "vlocity_cmt__RootItemId__c",
"editable": false,
"dataType": "STRING",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__Product2Id__c": {
"value": "01t6g000003DpXAAA0",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Product",
"hidden": false,
"fieldName": "vlocity_cmt__Product2Id__c",
"editable": true,
"dataType": "REFERENCE",
"alternateValues": null,
"actions": {
"availablesites": {
"rest": {
"params": {

},
"method": null,
"link": null
},

© 2021 Vlocity LLC, a Salesforce


company 934
CME CPQ

"remote": {
"params": {
"methodName": "getAvailableSites",
"lookupField": "vlocity_cmt__product2id__c",
"id": "8026g000001e9vVAAQ",
"cartId": "8016g000001EYYfAAO"
}
},
"client": {
"records": [

],
"params": {

}
}
}
}
},
"ListPrice": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "List Price",
"hidden": true,
"fieldName": "ListPrice",
"editable": false,
"dataType": "CURRENCY",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__OneTimeCharge__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "One Time Charge",
"hidden": true,
"fieldName": "vlocity_cmt__OneTimeCharge__c",

© 2021 Vlocity LLC, a Salesforce


company 935
CME CPQ

"editable": false,
"dataType": "CURRENCY",
"alternateValues": {

},
"actions": {

}
},
"vlocity_cmt__OneTimeCalculatedPrice__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "One Time Calculated Price",
"hidden": true,
"fieldName": "vlocity_cmt__OneTimeCalculatedPrice__c",
"editable": false,
"dataType": "CURRENCY",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__OneTimeManualDiscount__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "One Time Manual Discount",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeManualDiscount__c",
"editable": true,
"dataType": "PERCENT",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__RecurringCharge__c": {
"value": 0,
"previousValue": null,

© 2021 Vlocity LLC, a Salesforce


company 936
CME CPQ

"originalValue": null,
"messages": [

],
"label": "Recurring Charge",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringCharge__c",
"editable": false,
"dataType": "CURRENCY",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__RecurringCalculatedPrice__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Recurring Calculated Price",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringCalculatedPrice__c",
"editable": false,
"dataType": "CURRENCY",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__RecurringManualDiscount__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Recurring Manual Discount",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringManualDiscount__c",
"editable": true,
"dataType": "PERCENT",
"alternateValues": null,
"actions": {

© 2021 Vlocity LLC, a Salesforce


company 937
CME CPQ

}
},
"vlocity_cmt__CurrencyPaymentMode__c": {
"value": "Currency",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Currency Payment Mode",
"hidden": true,
"fieldName": "vlocity_cmt__CurrencyPaymentMode__c",
"editable": true,
"dataType": "PICKLIST",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__EffectiveOneTimeTotal__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Effective One Time Total",
"hidden": false,
"fieldName": "vlocity_cmt__EffectiveOneTimeTotal__c",
"editable": true,
"dataType": "CURRENCY",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__EffectiveRecurringTotal__c": {
"value": 0,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Effective Recurring Total",
"hidden": false,
"fieldName": "vlocity_cmt__EffectiveRecurringTotal__c",

© 2021 Vlocity LLC, a Salesforce


company 938
CME CPQ

"editable": true,
"dataType": "CURRENCY",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__AssetReferenceId__c": {
"value": "6710c5b9-d9ed-c47b-cf50-37e69ac42664",
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Asset Reference Id",
"hidden": true,
"fieldName": "vlocity_cmt__AssetReferenceId__c",
"editable": true,
"dataType": "STRING",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__IsChangesAllowed__c": {
"value": true,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Changes Allowed",
"hidden": false,
"fieldName": "vlocity_cmt__IsChangesAllowed__c",
"editable": true,
"dataType": "BOOLEAN",
"alternateValues": null,
"actions": {

}
},
"OrderId": {
"value": "8016g000001EYYfAAO",
"previousValue": null,
"originalValue": null,
"messages": [

© 2021 Vlocity LLC, a Salesforce


company 939
CME CPQ

],
"label": "Order ID",
"hidden": false,
"fieldName": "OrderId",
"editable": false,
"dataType": "REFERENCE",
"alternateValues": null,
"actions": {

}
},
"PricebookEntry": {
"attributes": {
"type": "PricebookEntry",
"url": "/services/data/v48.0/sobjects/PricebookEntry/
01u6g000002qmvOAAQ"
},
"Product2Id": "01t6g000003DpXAAA0",
"Pricebook2Id": "01s6g000008hmAUAAY",
"Id": "01u6g000002qmvOAAQ",
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v48.0/sobjects/
Product2/01t6g000003DpXAAA0"
},
"Name": "Phone1",
"Id": "01t6g000003DpXAAA0",
"ProductCode": "Phone1",
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__IsConfigurable__c": false,
"RecordTypeId": "0126g000001Ktw7AAC"
}
},
"vlocity_cmt__ServiceAccountId__r": {
"attributes": {
"type": "Account",
"url": "/services/data/v48.0/sobjects/Account/0016g00000NXwrqAAD"
},
"Name": "StarTelco",
"Id": "0016g00000NXwrqAAD",
"RecordTypeId": "0126g000001KtvLAAS"
},
"vlocity_cmt__BillingAccountId__r": {
"attributes": {

© 2021 Vlocity LLC, a Salesforce


company 940
CME CPQ

"type": "Account",
"url": "/services/data/v48.0/sobjects/Account/0016g00000NXwrqAAD"
},
"Name": "StarTelco",
"Id": "0016g00000NXwrqAAD",
"RecordTypeId": "0126g000001KtvLAAS"
},
"vlocity_cmt__SubAction__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Sub Action",
"hidden": false,
"fieldName": "vlocity_cmt__SubAction__c",
"editable": true,
"dataType": "PICKLIST",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__InCartQuantityMap__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "InCartQuantityMap",
"hidden": true,
"fieldName": "vlocity_cmt__InCartQuantityMap__c",
"editable": false,
"dataType": "TEXTAREA",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__ParentItemId__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

© 2021 Vlocity LLC, a Salesforce


company 941
CME CPQ

],
"label": "ParentItemId",
"hidden": true,
"fieldName": "vlocity_cmt__ParentItemId__c",
"editable": false,
"dataType": "STRING",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__RecurringDiscountPrice__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Recurring Discount Price",
"hidden": true,
"fieldName": "vlocity_cmt__RecurringDiscountPrice__c",
"editable": false,
"dataType": "CURRENCY",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__CpqMessageData__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Cpq Message Data",
"hidden": true,
"fieldName": "vlocity_cmt__CpqMessageData__c",
"editable": true,
"dataType": "TEXTAREA",
"alternateValues": null,
"actions": {

}
},

© 2021 Vlocity LLC, a Salesforce


company 942
CME CPQ

"vlocity_cmt__ItemName__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Item Name",
"hidden": false,
"fieldName": "vlocity_cmt__ItemName__c",
"editable": true,
"dataType": "STRING",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__CpqCardinalityMessage__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Cpq Cardinality Message",
"hidden": false,
"fieldName": "vlocity_cmt__CpqCardinalityMessage__c",
"editable": true,
"dataType": "TEXTAREA",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__CpqPricingMessage__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Cpq Pricing Message",
"hidden": false,
"fieldName": "vlocity_cmt__CpqPricingMessage__c",
"editable": true,
"dataType": "TEXTAREA",

© 2021 Vlocity LLC, a Salesforce


company 943
CME CPQ

"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__CatalogItemReferenceDateTime__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Reference Time",
"hidden": false,
"fieldName": "vlocity_cmt__CatalogItemReferenceDateTime__c",
"editable": true,
"dataType": "DATETIME",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__SupplementalAction__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Supplemental Action",
"hidden": false,
"fieldName": "vlocity_cmt__SupplementalAction__c",
"editable": true,
"dataType": "PICKLIST",
"alternateValues": null,
"actions": {

}
},
"vlocity_cmt__SupersededOrderItemId__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],

© 2021 Vlocity LLC, a Salesforce


company 944
CME CPQ

"label": "Superseded Order Product",


"hidden": false,
"fieldName": "vlocity_cmt__SupersededOrderItemId__c",
"editable": true,
"dataType": "REFERENCE",
"alternateValues": null,
"actions": {
"availablesites": {
"rest": {
"params": {

},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "getAvailableSites",
"lookupField": "vlocity_cmt__supersededorderitemid__c",
"id": "8026g000001e9vVAAQ",
"cartId": "8016g000001EYYfAAO"
}
},
"client": {
"records": [

],
"params": {

}
}
}
}
},
"vlocity_cmt__FirstVersionOrderItemId__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "First Order Product Version",
"hidden": false,
"fieldName": "vlocity_cmt__FirstVersionOrderItemId__c",
"editable": true,
"dataType": "REFERENCE",

© 2021 Vlocity LLC, a Salesforce


company 945
CME CPQ

"alternateValues": null,
"actions": {
"availablesites": {
"rest": {
"params": {

},
"method": null,
"link": null
},
"remote": {
"params": {
"methodName": "getAvailableSites",
"lookupField": "vlocity_cmt__firstversionorderitemid__c",
"id": "8026g000001e9vVAAQ",
"cartId": "8016g000001EYYfAAO"
}
},
"client": {
"records": [

],
"params": {

}
}
}
}
},
"vlocity_cmt__FulfilmentStatus__c": {
"value": null,
"previousValue": null,
"originalValue": null,
"messages": [

],
"label": "Fulfilment Status",
"hidden": false,
"fieldName": "vlocity_cmt__FulfilmentStatus__c",
"editable": true,
"dataType": "PICKLIST",
"alternateValues": null,
"actions": {

}
},

© 2021 Vlocity LLC, a Salesforce


company 946
CME CPQ

"productCategories": {
"totalSize": 0,
"messages": [

]
},
"vlocity_cmt__UsageQuantity__c": {
"value": 1
},
"vlocity_cmt__EffectiveQuantity__c": {
"value": 1
},
"fieldValidationMessageList": [

],
"processingLine": true
}
]
},
"filters": null,
"fields": null,
"cartId": "8016g000001EYYfAAO",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 10,
"lastRecordId": null,
"hierarchy": -1,
"query": null
}

REST Handler
APIItemsCartsCpqV2

Example REST Request


PUT /services/apexrest/vlocity_cmt/v2/cpq/carts/8016g000001EYYfAAO/items

Example Request Body Format

{
methodName:putCartsItems,
cartId:801360000008eNU,
items:[ {itemJSON} ]
}

© 2021 Vlocity LLC, a Salesforce


company 947
CME CPQ

In the request, itemJSON is the actual JSONRecord that is being updated. This JSONRecord is provided
by the response to an Add Items to Cart or Get Cart Items API call. Based on that response, update the
record or record attribute.

Example Response
{
"totalSize": 1,
"messages": [
{
"severity": "INFO",
"messageId": null,
"message": "Successfully added.",
"code": "150",
"actions": {}
}
],
"records": [
{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null,
"items": [
{
"parentId": "80241000000HalcAAC",
"quantity": 1,
"itemId": "01u41000001QPtsAAG"
}
]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,

© 2021 Vlocity LLC, a Salesforce


company 948
CME CPQ

"lastRecordId": null,
"query": null,
"items": [
{
"parentId": "80241000000HalcAAC",
"quantity": 1,
"itemId": "01u41000001QPtsAAG"
}
],
"cartId": "80141000000Cg8HAAS",
"methodName": "postCartsItems"
}
},
"client": {
"params": {}
}
},
"updateitems": {
"rest": {
"params": {
"fields": null,
"price": true,
"validate": true,
"filters": null,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null,
"items": [
{
"itemId": "80241000000HalcAAC"
}
]
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items"
},
"remote": {
"params": {
"fields": null,
"price": true,
"validate": true,
"filters": null,
"includeAttachment": false,
"pagesize": 20,

© 2021 Vlocity LLC, a Salesforce


company 949
CME CPQ

"lastRecordId": null,
"query": null,
"items": [
{
"itemId": "80241000000HalcAAC"
}
],
"cartId": "80141000000Cg8HAAS",
"methodName": "putCartsItems"
}
},
"client": {
"params": {}
}
},
"deleteitem": {
"rest": {
"params": {},
"method": "DELETE",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items/80241000000HalcAAC?
pagesize=20&includeAttachment=false&validate=true&price=true"
},
"remote": {
"params": {
"price": true,
"validate": true,
"filters": null,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null,
"id": "80241000000HalcAAC",
"cartId": "80141000000Cg8HAAS",
"methodName": "deleteCartsItems"
}
},
"client": {
"params": {}
}
},
"cloneitem": {
"rest": {
"params": {
"items": [
{

© 2021 Vlocity LLC, a Salesforce


company 950
CME CPQ

"itemId": "80241000000HalcAAC"
}
]
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items/clone"
},
"remote": {
"params": {
"id": "80241000000HalcAAC",
"cartId": "80141000000Cg8HAAS",
"methodName": "cloneItems"
}
},
"client": {
"params": {}
}
},
"modifyattributes": {
"rest": {
"params": {
"fields": null,
"items": [
{
"itemId": "80241000000HalcAAC"
}
]
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
80141000000Cg8HAAS/items/80241000000HalcAAC/itemattributes"
},
"remote": {
"params": {
"fields": null,
"items": [
{
"itemId": "80241000000HalcAAC"
}
],
"itemId": "80241000000HalcAAC",
"cartId": "80141000000Cg8HAAS",
"methodName": "putItemAttributes"
}
},

© 2021 Vlocity LLC, a Salesforce


company 951
CME CPQ

"client": {
"params": {}
}
}
},
"displaySequence": -1,
"Id": {
"value": "80241000000HalcAAC",
"messages": [],
"label": "Order Product ID",
"hidden": false,
"fieldName": "Id",
"editable": false,
"dataType": "ID",
"actions": {}
},
"Pricebook2Id": "01s41000005dPYQAA2",
"Product2Id": "01t41000000sYaSAAU",
"UnitPrice": {
"value": 1,
"messages": [],
"label": "Unit Price",
"hidden": false,
"fieldName": "UnitPrice",
"editable": true,
"dataType": "CURRENCY",
"actions": {}
},
"Name": "GC 2",
"IsActive": true,
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2",
"vlocity_cmt__IsConfigurable__c": false,
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__SubType__c": "None",
"RecordTypeId": "012410000006OWUAA2",
"vlocity_cmt__JSONAttribute__c": null
},
"productId": "01t41000000sYaSAAU",
"defaultQuantity": 1,
"minQuantity": 0,

© 2021 Vlocity LLC, a Salesforce


company 952
CME CPQ

"maxQuantity": 99999,
"groupMinQuantity": 0,
"groupMaxQuantity": 99999,
"sequenceNumber": 1,
"productChildItemDefinition": {
"attributes": {
"type": "vlocity_cmt__ProductChildItem__c",
"url": "/services/data/v38.0/sobjects/
vlocity_cmt__ProductChildItem__c/a2541000000G0AGAA0"
},
"Id": "a2541000000G0AGAA0",
"Name": "Root PCI",
"vlocity_cmt__IsVirtualItem__c": false,
"vlocity_cmt__Quantity__c": 1,
"vlocity_cmt__MaxQuantity__c": 99999,
"vlocity_cmt__MinQuantity__c": 0,
"vlocity_cmt__MaximumChildItemQuantity__c": 99999,
"vlocity_cmt__MinimumChildItemQuantity__c": 0,
"vlocity_cmt__IsOverride__c": false,
"vlocity_cmt__ParentProductId__c": "01t41000000sYaSAAU",
"vlocity_cmt__ChildLineNumber__c": "1",
"vlocity_cmt__SeqNumber__c": 1,
"vlocity_cmt__CollapseHierarchy__c": false,
"vlocity_cmt__IsRootProductChildItem__c": true,
"vlocity_cmt__ParentProductId__r": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2"
}
},
"productHierarchyPath": "01t41000000sYaSAAU",
"name": "GC 2",
"isVirtualItem": false,
"itemType": "lineItem",
"PricebookEntryId": {
"value": "01u41000001QPtsAAG",
"messages": [],
"label": "Price Book Entry ID",
"hidden": false,
"fieldName": "PricebookEntryId",
"editable": false,
"dataType": "REFERENCE",
"actions": {}

© 2021 Vlocity LLC, a Salesforce


company 953
CME CPQ

},
"Quantity": {
"value": 1,
"messages": [],
"label": "Quantity",
"hidden": false,
"fieldName": "Quantity",
"editable": true,
"dataType": "DOUBLE",
"actions": {}
},
"vlocity_cmt__OneTimeTotal__c": {
"value": 1,
"messages": [],
"label": "One Time Total",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__RecurringTotal__c": {
"value": 0,
"messages": [],
"label": "Recurring Total",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringTotal__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__ProvisioningStatus__c": {
"value": "New",
"messages": [],
"label": "Provisioning Status",
"hidden": false,
"fieldName": "vlocity_cmt__ProvisioningStatus__c",
"editable": false,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__BillingAccountId__c": "00141000007uyWYAAY",
"vlocity_cmt__ServiceAccountId__c": "00141000007uyWYAAY",
"vlocity_cmt__ProductHierarchyPath__c": {
"value": "01t41000000sYaSAAU",
"messages": [],

© 2021 Vlocity LLC, a Salesforce


company 954
CME CPQ

"label": "Product Hierarchy Path",


"hidden": false,
"fieldName": "vlocity_cmt__ProductHierarchyPath__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__LineNumber__c": {
"value": "0001",
"messages": [],
"label": "LineNumber",
"hidden": true,
"fieldName": "vlocity_cmt__LineNumber__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RootItemId__c": {
"value": "80241000000HalcAAC",
"messages": [],
"label": "RootItemId",
"hidden": true,
"fieldName": "vlocity_cmt__RootItemId__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"ListPrice": {
"value": 1,
"messages": [],
"label": "List Price",
"hidden": false,
"fieldName": "ListPrice",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__OneTimeCharge__c": {
"value": 1,
"messages": [],
"label": "One Time Charge",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeCharge__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}

© 2021 Vlocity LLC, a Salesforce


company 955
CME CPQ

},
"vlocity_cmt__OneTimeCalculatedPrice__c": {
"value": 1,
"messages": [],
"label": "One Time Calculated Price",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeCalculatedPrice__c",
"editable": true,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__OneTimeManualDiscount__c": {
"value": 0,
"messages": [],
"label": "One Time Manual Discount",
"hidden": false,
"fieldName": "vlocity_cmt__OneTimeManualDiscount__c",
"editable": true,
"dataType": "PERCENT",
"actions": {}
},
"vlocity_cmt__RecurringCharge__c": {
"value": 0,
"messages": [],
"label": "Recurring Charge",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringCharge__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__RecurringCalculatedPrice__c": {
"value": 0,
"messages": [],
"label": "Recurring Calculated Price",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringCalculatedPrice__c",
"editable": true,
"dataType": "CURRENCY",
"actions": {}
},
"vlocity_cmt__RecurringManualDiscount__c": {
"value": 0,
"messages": [],
"label": "Recurring Manual Discount",
"hidden": false,

© 2021 Vlocity LLC, a Salesforce


company 956
CME CPQ

"fieldName": "vlocity_cmt__RecurringManualDiscount__c",
"editable": true,
"dataType": "PERCENT",
"actions": {}
},
"PricebookEntry": {
"attributes": {
"type": "PricebookEntry",
"url": "/services/data/v38.0/sobjects/PricebookEntry/
01u41000001QPtsAAG"
},
"Id": "01u41000001QPtsAAG",
"Product2Id": "01t41000000sYaSAAU",
"Pricebook2Id": "01s41000005dPYQAA2",
"Product2": {
"attributes": {
"type": "Product2",
"url": "/services/data/v38.0/sobjects/Product2/01t41000000sYaSAAU"
},
"Id": "01t41000000sYaSAAU",
"Name": "GC 2",
"vlocity_cmt__Type__c": "None",
"vlocity_cmt__IsConfigurable__c": false
}
},
"vlocity_cmt__ServiceAccountId__r": {
"attributes": {
"type": "Account",
"url": "/services/data/v38.0/sobjects/Account/00141000007uyWYAAY"
},
"Id": "00141000007uyWYAAY",
"Name": "Telco test"
},
"vlocity_cmt__BillingAccountId__r": {
"attributes": {
"type": "Account",
"url": "/services/data/v38.0/sobjects/Account/00141000007uyWYAAY"
},
"Id": "00141000007uyWYAAY",
"Name": "Telco test"
},
"vlocity_cmt__InCartQuantityMap__c": {
"value": null,
"messages": [],
"label": "InCartQuantityMap",
"hidden": false,

© 2021 Vlocity LLC, a Salesforce


company 957
CME CPQ

"fieldName": "vlocity_cmt__InCartQuantityMap__c",
"editable": true,
"dataType": "TEXTAREA",
"actions": {}
},
"vlocity_cmt__JSONAttribute__c": {
"value": null,
"messages": [],
"label": "JSONAttribute",
"hidden": false,
"fieldName": "vlocity_cmt__JSONAttribute__c",
"editable": true,
"dataType": "TEXTAREA",
"actions": {}
},
"vlocity_cmt__ParentItemId__c": {
"value": null,
"messages": [],
"label": "ParentItemId",
"hidden": true,
"fieldName": "vlocity_cmt__ParentItemId__c",
"editable": true,
"dataType": "STRING",
"actions": {}
},
"vlocity_cmt__RecurringDiscountPrice__c": {
"value": null,
"messages": [],
"label": "Recurring Discount Price",
"hidden": false,
"fieldName": "vlocity_cmt__RecurringDiscountPrice__c",
"editable": false,
"dataType": "CURRENCY",
"actions": {}
}
}
]
}

See Also
• Add Items to Cart
• Get Cart Items

Update String Translations


Update translations for existing strings.

© 2021 Vlocity LLC, a Salesforce


company 958
CME CPQ

PUT /v2/stringtranslations/

Apex Remote Service


APIHandler

Remote Parameters
[
{
"Id": "",
"vlocity_cmt__Translation__c": "",
"vlocity_cmt__StringId__c": "",
"vlocity_cmt__LocaleCode__c": ""
},
{
"Id": "",
"vlocity_cmt__Translation__c": "",
"vlocity_cmt__StringId__c": "",
"vlocity_cmt__LocaleCode__c": ""
}
]

Remote Method
updateStringTranslations

Package
Communication (vlocity_cmt)

Example Request Body


[
{
"Id": "a4D41000000TaQ2EAK",
"vlocity_cmt_promotion__Translation__c": "Apr10_frNew",
"vlocity_cmt_promotion__StringId__c": "a4E41000000TqXjEAK",
"vlocity_cmt_promotion__LocaleCode__c": "fr"
},
{
"Id": "a4D41000000TaQ3EAK",
"vlocity_cmt_promotion__Translation__c": "Apr10_ruNew",
"vlocity_cmt_promotion__StringId__c": "a4E41000000TqXjEAK",
"vlocity_cmt_promotion__LocaleCode__c": "ru"
}
]

© 2021 Vlocity LLC, a Salesforce


company 959
CME CPQ

Example Response
{
"totalSize": 0,
"messages": [{
"code": "904",
"severity": "INFO",
"message": "Updated successfully."
}]
}

Validate Cart Action


Run validation and pricing for the items in the cart. This API runs the implementations defined in your org
under the product validation and pricing interfaces.

POST /v2/cpq/carts/{cart_ID}/validate

Vlocity provides multiple implementations for product validation and pricing interfaces. The product
validation implementation will typically run the configuration rules and the pricing implementations will run
the pricing rules.

Remote Method
runCartValidation

REST Handler
validate

Apex Remote Service


Class:

vlocity_cmt.CardCanvasController

Method:

global static Object doGenericInvoke(String sClassName, String sMethodName,


String input, String options)

Apex Remote Input Map


String sClassName: vlocity_cmt.CpqAppHandler
String sMethodName: runCartValidation
String input: {
"cartId": "8011N00000157LkQAI",
"methodName": "runCartValidation",
"price": true,

© 2021 Vlocity LLC, a Salesforce


company 960
CME CPQ

"validate": true
}
String options: {
"vlcClass": "vlocity_cmt.CpqAppHandler"
}

Package
Communication (vlocity_cmt)

API Parameters and Response Format


For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information
Response Format JSON
Resource URL /v2/cpq/carts/{cart_ID}/validate

Example: /services/apexrest/vlocity_cmt/v2/cpq/carts/801360000000oQ9/validate

Example Request
{
"cartId": "8011N00000157LkQAI",
"methodName": "runCartValidation",
"price": true,
"validate": true
}

Example Response
{
"totalSize": 0,
"messages": [],
"actions": {
"itemadded": {
"rest": {
"params": {},
"method": null,
"link": null
},
"remote": {
"params": {}
},
"client": {
"params": {
"items": [

© 2021 Vlocity LLC, a Salesforce


company 961
CME CPQ

{
"message": "Product Hier 6 Child 3 has been auto-added to the
cart.",
"Id": "8021N000006wtUCQAY"
}
]
},
"records": [
{
"messages": [],
"actions": {
"addtocart": {
"rest": {
"params": {
"items": [
{
"quantity": 1,
"parentId": "8021N000006wtU7QAI",
"itemId": "01u1N00000C1WAlQAN"
}
],
"cartId": "8011N00000157LkQAI",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
},
"method": "POST",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011N00000157LkQAI/items"
},
"remote": {
"params": {
"methodName": "postCartsItems",
"items": [
{
"quantity": 1,
"parentId": "8021N000006wtU7QAI",
"itemId": "01u1N00000C1WAlQAN"
}
],
"cartId": "8011N00000157LkQAI",
"price": true,
"validate": true,

© 2021 Vlocity LLC, a Salesforce


company 962
CME CPQ

"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
"updateitems": {
"rest": {
"params": {
"items": [
{
"itemId": "8021N000006wtU7QAI"
}
],
"filters": null,
"fields": null,
"cartId": "8011N00000157LkQAI",
"price": true,
"validate": true,
"includeAttachment": false,
"pagesize": 20,
"lastRecordId": null,
"query": null
},
"method": "PUT",
"link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/
8011N00000157LkQAI/items"
},
"remote": {
"params": {
"methodName": "putCartsItems",
"items": [
{
"itemId": "8021N000006wtU7QAI"
}
],
"filters": null,
"fields": null,
"cartId": "8011N00000157LkQAI",
"price": true,
"validate": true,
"includeAttachment": false,

© 2021 Vlocity LLC, a Salesforce


company 963
CME CPQ

"pagesize": 20,
"lastRecordId": null,
"query": null
}
},
"client": {
"params": {}
}
},
...
[EXAMPLE TRUNCATED FOR BREVITY]

Pre- and Post-Processing Logic for CPQ APIs


Each of the CPQ APIs provide an option to write custom pre- and post-processing logic (hooks) to
implement custom logic. Pre-hook logic is executed before the API is executed, while post-hook logic
executes after the API executes.

Follow these steps to implement pre- and post-hook logic for CPQ APIs:

1. Write the custom class to implement the pre and post hook. Below is a sample:

global with sharing class CPQCustomHookImplementation implements


vlocity_cmt.VlocityOpenInterface{

global Boolean invokeMethod(String methodName, Map<String, Object> input,


Map<String, Object> output, Map<String, Object> options) {
if( methodName.equalsIgnoreCase('getCartsItems.PreInvoke')) {
getCartsItems_PreInvoke(methodName, input, output,options);
return true;
}
if( methodName.equalsIgnoreCase('getCartsItems.PostInvoke')) {
getCartsItems_PostInvoke(methodName, input, output,options);
return true;
}
return false;
}

private void getCartsItems_PreInvoke(String methodName, Map<String,


Object> input, Map<String, Object> output, Map<String, Object> options) {
//This method gets called before getCartsItems
}

private void getCartsItems_PostInvoke(String methodName, Map<String,


Object> input, Map<String, Object> output, Map<String, Object> options) {
//This method gets called after getCartsItems
}

© 2021 Vlocity LLC, a Salesforce


company 964
CME CPQ

2. Create the Interface Implementation.

Interface Name = CpqAppHandlerHookInterface, Implementation


= CPQCustomHookImplementation

When invoking a CPQ API using a VIP, you must also create a custom setting with the same data as
the interface implementation. The custom setting name should be the name of the interface
implementation and the class should be the class name used in interface implementation.
For information about creating an interface implementation, see:
Interface Packages, Types, and Default Implementations
Working with Implementations
Adding a New Interface Implementation
For information about custom settings, see:
Vlocity Triggers
3. Make the interface implementation active. For information, see:
Working with Implementations

Overview of Creating a CpqAppHandler Hook


You can write custom Pre-invoke and Post-invoke hooks for an interface to implement custom logic. To
change the default behavior of a CPQ operation, you create a custom implementation of the
CpqAppHandler hook interface, CpqAppHandlerHook. The example used to illustrate the tasks is a
customization that prices products in Vlocity Cart based on a customer’s billing zip code.

Vlocity Communications, Media, and Energy and Energy & Utilities Cloud use the CpqAppHandler hook
interface.

Workflow for Creating a CpqAppHandler Hook


To create a custom implementation of CpqAppHandlerHook involves multiple tasks. These tasks include
setting up a matrix, editing the pricing plan, creating an Apex class, and modifying the Cart.

Example 42. Pricing Products Based on Zip Code


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

1. Review the uses of CpqAppHandlerHook.


2. Review the billing zip code custom field.
3. Create an attribute pricing matrix for billing zip code.
4. Create an attribute pricing procedure for billing zip code.
5. Create a custom pricing plan step for billing zip code.

© 2021 Vlocity LLC, a Salesforce


company 965
CME CPQ

6. Create a new Apex class.


7. Create the CpqAppHandlerHookImplementation.
8. Add a new column to Vlocity cart.
9. Add billing zip code as a custom field in Vlocity cart.
10. Test in Vlocity Cart.
11. Troubleshoot if necessary.

See Also
• Adding Pre- and Post-Processing Logic
• Pre- and Post-Processing Logic for CPQ APIs
• Pricing Variable Calculation Hook

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

About Hooks
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.

© 2021 Vlocity LLC, a Salesforce


company 966
CME CPQ

Vlocity 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.

CpqAppHandlerHook Input, Output, and Logic


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 to Invoke a Hook


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.

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

© 2021 Vlocity LLC, a Salesforce


company 967
CME CPQ

Things 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. Vlocity 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.

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 on 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.

© 2021 Vlocity LLC, a Salesforce


company 968
CME CPQ

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 Vlocity 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 Vlocity 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 the main example, 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 Vlocity Cart, so the user can see the values that affect the
price of the line item.

Review the Billing Zip Code Custom Field


In your training org we have created a custom field, Billing Zip Code, on the Order Product. The Billing Zip
Code field will be used throughout this example, 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 Field & Relationships from the navigation pane on the left.

© 2021 Vlocity LLC, a Salesforce


company 969
CME CPQ

5. Click Billing Zip Code.


6. Make a notation of the API name.
7. Make a notation of the formula.
8. Close the Setup browser tab.

What's Next
See Create an Attribute Pricing Matrix for the Billing Zip Code.

Create an Attribute Pricing Matrix for the Billing Zip Code


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

1. Using the Lightning App Launcher in the upper left, 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 Vlocity Calculation Matrices tab. You may need to click the More dropdown menu to
expand for additional tabs.
5. Click New.
6. On the New Vlocity Calculation Matrix dialog box, type
BillingZipCodeAttributePricingMatrix for the Calculation Matrix Name and click Save.

© 2021 Vlocity LLC, a Salesforce


company 970
CME CPQ

7. Click the Related tab, select BillingZipCodeAttributePricingMatrix v1.


8. On the Details tab, under the Table section, click Upload CSV.
9. Click Choose File, select the downloaded .csv file, and click Upload.
10. Ensure that seven records were uploaded successfully and click Close.
11. Edit the Header Information with the following:

Name Header Type


Source Product Name Input
Source Product Code Input
Characteristic Name Input
Characteristic Value Input
Billing_Zip_Code__c Input
MRC Output
NRC Output

12. Click Save Data.


13. Click the Edit Data button. Review the seven records uploaded from the .csv file.

14. Click the Edit button in the BillingZipCodeAttributePricingMatrix v1 header.


15. Select yesterday’s date from the calendar icon for the Start Date / Time Date field.

© 2021 Vlocity LLC, a Salesforce


company 971
CME CPQ

16. Check the Enabled box and Save.

What's Next
See Create an Attribute Pricing Procedure for the Billing Zip Code.

Create an Attribute Pricing Procedure for the Billing Zip Code


In this task, Felix 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 Vlocity Calculation Procedures tab. You may need to click the More dropdown menu
to expand for additional tabs.
2. Click New.
3. On the New Vlocity Calculation Procedure dialog box, select Declarative as the record type and
click Next.
4. Type BillingZipCodeAttributePricingProcedure for the Calculation Procedure Name and
click Save.
5. Click the Related tab, select BillingZipCodeAttributePricingProcedure v1.
6. In the Variables and Constants section of the Pricing Calculation, click Add Variable.
7. Enter the following:

Field Entry
Name REC_MNTH_STD_PRC
Data Type Currency
8. Click Add Variable to add the next variable.

Field Entry
Name OT_STD_PRC
Data Type Currency

9. Scroll to the Calculation Steps section of the Pricing Calculation.


10. Click Add Step.
11. Select the Matrix Lookup radio button.
12. In the Matrix Name field, type Billing.
13. Select BillingZipCodeAttributePricingMatrix.
14. Check the box Include in Calculation Output.

© 2021 Vlocity LLC, a Salesforce


company 972
CME CPQ

15. Notice the variables added to the Variables and Constants section of the procedure.
16. Click Add Step to add another Calculation Step.
17. Select the Calculation radio button.
18. Type MRC in the first box and select MRC (BillingZipCodeAttributePricingMatrix).
19. Type REC in the second box and select REC_MNTH_STD_PRC.
20. Check the box Include in Calculation Output.
21. Click Add Step to add another calculation step.
22. Select the Calculation radio button.
23. Type NRC in the first box and select NRC (BillingZipCodeAttributePricingMatrix).
24. Type OT in the second box and select OT_STD_PRC.
25. Check the box Include in Calculation Output.
26. Click Save Calculation Procedure.

27. Click OK to the message that the save was successful.


28. Scroll to the top of the page and click the Edit button in the header.
29. Check the Enabled box and Save.

What's Next
See Create a Custom Pricing Plan Step for the Billing Zip Code.

Create a Custom Pricing Plan Step for the Billing Zip Code
In this task, Felix 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.

© 2021 Vlocity LLC, a Salesforce


company 973
CME CPQ

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 (checked)

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


9. Click the + symbol to add the following parameters:

First Box Second Box


ProcedureName BillingZipCodeAttributePricingProcedure
MatrixName BillingZipCodeAttributePricingMatrix
RangeFields Billing_Zip_Code__c
10. Click Done.
11. Click Save in the General Properties pane.

© 2021 Vlocity LLC, a Salesforce


company 974
CME CPQ

What's Next
See Create a New Apex Class.

Create a New Apex Class


In this task, Felix 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. Navigate to the Setup icon and select Developer Console.


2. From the Developer Console, click File > New > Apex Class.
3. Name the Apex Class CpqAppHandlerHookImplementation and click OK.
4. Click here to download the CpqAppHandlerHookImplementation.txt file.
5. Paste the code from that file in the Enter Apex Code box. You will have 48 lines of code.

© 2021 Vlocity LLC, a Salesforce


company 975
CME CPQ

6. Click File > Save.


7. Review line 12. Note the String customFields API.
8. Close the Developer Console.

What's Next
See Create the CpqAppHandlerHookImplementation.

Create the CpqAppHandlerHookImplementation


In this task, Felix 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 Vlocity 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.

© 2021 Vlocity LLC, a Salesforce


company 976
CME CPQ

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.
8. Check the Active and Default box and Save.

What's Next
See Add a New Column to Vlocity Cart.

Add a New Column to Vlocity Cart


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

1. Using the Lightning App Launcher in the upper left, click the Vlocity Cards app.
2. In the Find in page field, enter cpq-product.
3. Expand cpq-product-cart and select Version 3.

© 2021 Vlocity LLC, a Salesforce


company 977
CME CPQ

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.
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.

© 2021 Vlocity LLC, a Salesforce


company 978
CME CPQ

13. In the Clone Card window, type cpq-product-cart-item as the Card Name.
14. Type your name for the Card Author.
15. Click Clone.

© 2021 Vlocity LLC, a Salesforce


company 979
CME CPQ

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.

© 2021 Vlocity LLC, a Salesforce


company 980
CME CPQ

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.
23. Delete <<Custom Field>> and replace it with the following:

Name Label
['Billing_Zip_Code__c']['value'] ['Billing_Zip_Code__c']['label']

© 2021 Vlocity LLC, a Salesforce


company 981
CME CPQ

IMPORTANT
The Name and Label field input must be entered exactly as displayed using straight
quotes and no space between brackets.

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

© 2021 Vlocity LLC, a Salesforce


company 982
CME CPQ

What's Next
See Add the Billing Zip Code as a Custom Field in Vlocity Cart.

Add the Billing Zip Code as a Custom Field in Vlocity Cart


In this task, Felix 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 Vlocity Cart.

© 2021 Vlocity LLC, a Salesforce


company 983
CME CPQ

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.
6. Enter the following for the new Field Setting:

Field Entry 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 (checked)
Object Name OrderItem API name of the object
Sequence 1

© 2021 Vlocity LLC, a Salesforce


company 984
CME CPQ

7. Click Save.
8. Close the Setup browser tab.

What's Next
See Test in Vlocity Cart.

Test in Vlocity Cart


Felix is ready to test the CpqAppHandlerHook in Vlocity Cart.

1. Navigate to the Orders tab and click New.


2. On the New Order, enter the following:

First Box Second Box


Order Name Adv Pricing Hooks Order
Account Name Acme
Order Start Date [Today’s date]
Price List B2B Price List
3. Click Save.
4. From the Actions toolbar, click Configure Order to invoke the Vlocity Cart.
5. Add a product to the cart.

© 2021 Vlocity LLC, a Salesforce


company 985
CME CPQ

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.
11. Click Acme.
12. Click on the Details tab.
13. Note the Billing Address zip code.
14. Close the Accounts tab.
15. Notice the new Billing Zip Code column in the cart and the billing zip code returned for Acme.

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

What's Next
If testing didn't work as expected, see CpqAppHandlerHook Troubleshooting Guide.

CpqAppHandlerHook Troubleshooting Guide


Use this guide to troubleshoot the CpqAppHandlerHook if it isn't working properly.

Attribute-Based Pricing
Is the product not displaying the correct price in the cart based on the BillingZipCodeAttributePricingMatrix?
Use the troubleshooting headings below to assist in your evaluation.

For BillingZipCodeAttributePricingMatrix:

• Verify all matrix headers are spelled correctly


• Verify all input/output data in the matrix has proper spacing, punctuation and correct spelling
• Verify the matrix is enabled and has the highest priority

© 2021 Vlocity LLC, a Salesforce


company 986
CME CPQ

For BillingZipCodeAttributePricingProcedure:

• Verify all variables has proper spacing, punctuation and correct spelling
• Verify the calculation steps
• Matrix lookup is pointing to the BillingZipCodeAttributePricingMatrix
• Matrix calculations are pointing to the MRC/NRC BillingZipCodeAttributePricingMatrix outputs
• Include in Calculation Output is checked
• Procedure is enabled
• Verify if the procedure is working using the Simulate button on the Vlocity Procedure page

For the custom billing zip code pricing plan step:

• Verify all data input is spelled correctly and has proper spacing
• Step is active

Modifying the Cart


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

For the billing zip code field setting:

• API names are spelled correctly with proper punctuation


• Correct CPQ API is linked

For the 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
• Layout and card are both activated
• Verified all the above and the column still isn’t displaying, clear your browser cacheEnd Bookmark for
Task Overview TOC.
• Start Bookmark for Task Overview TOC

CpqAppHandlerError Codes for Cart-Based APIs


Out of the box, error messages in CpqAppHandlerErrors.cls are based on custom labels. You define all
CpqAppHandler error messages in the CpqAppHandlerErrors class, then create the translations for these
messages.

Each error must have:

• A unique integer code.


• A default error message. You may use this message to construct the JSONMessage. The out of box
error messages defined in the CpqAppHandlerErrors class are not intended to be translated because the
error code is used to get the translated error message.

© 2021 Vlocity LLC, a Salesforce


company 987
CME CPQ

The following is the via_cpq/classes/CpqAppHandlerErrors.cls:

public class CpqAppHandlerErrors {

// General Cart Errors - 100


public static CpqAppHandlerError INVALID_CART_ID = new
CpqAppHandlerError('100', Label.CPQInvalidCartID);
public static CpqAppHandlerError NO_RESULTS_FOUND = new
CpqAppHandlerError('101', Label.CPQNoResultsFound);
public static CpqAppHandlerError INVALID_CATALOG_ID = new
CpqAppHandlerError('102', Label.CPQInvalidCatalogID);
public static CpqAppHandlerError INVALID_ACCOUNT_ID = new
CpqAppHandlerError('103', Label.InvalidAccountId);
public static CpqAppHandlerError INVALID_ASSET_ID = new
CpqAppHandlerError('104', Label.InvalidAssetId);
public static CpqAppHandlerError NO_PARAMS_FOUND = new
CpqAppHandlerError('105', Label.NoParamsFound);
public static CpqAppHandlerError NO_URL_PASSED = new
CpqAppHandlerError('106', Label.NoURLPassed);
public static CpqAppHandlerError KEY_GENERATION_ERROR = new
CpqAppHandlerError('107', Label.KeyGenerationError);
public static CpqAppHandlerError INVALID_PREMISES_ID = new
CpqAppHandlerError('108', Label.InvalidPremisesId);

// Product Errors - 120


public static CpqAppHandlerError INVALID_COMPARE_PRODUCT_ID = new
CpqAppHandlerError('120', Label.CPQNoValidProdID);
public static CpqAppHandlerError MIN_NUMBER_PRODUCT_COMPARE = new
CpqAppHandlerError('121', Label.CPQMinTwoProd);
public static CpqAppHandlerError INVALID_PBE_ID = new
CpqAppHandlerError('122', Label.CPQInvalidPBEID);

// Item Errors - 140


public static CpqAppHandlerError INVALID_ITEM_ID = new
CpqAppHandlerError('140', Label.CPQInvalidItemID);
public static CpqAppHandlerError VALIDATION_ERROR_DELETE = new
CpqAppHandlerError('141', Label.CPQItemCannotBeDeleted);
public static CpqAppHandlerError INVALID_QUANTITY = new
CpqAppHandlerError('142', Label.CPQInvalidQLI);

public static CpqAppHandlerError NO_ITEMS_TO_ADD = new


CpqAppHandlerError('143', Label.CPQNoItemsToAdd);
public static CpqAppHandlerError NO_ITEMS_TO_UPDATE = new
CpqAppHandlerError('144', Label.CPQNoItemsToUpdate);
public static CpqAppHandlerError NO_ITEMS_TO_DELETE = new
CpqAppHandlerError('145', Label.CPQNoItemsToDelete);

© 2021 Vlocity LLC, a Salesforce


company 988
CME CPQ

public static CpqAppHandlerError VALIDATION_ERROR_ADD = new


CpqAppHandlerError('146', Label.CPQNoItemsToDelete);
public static CpqAppHandlerError NO_ITEMS_TO_CLONE = new
CpqAppHandlerError('147', Label.CPQNoItemsToClone);

public static CpqAppHandlerError ADD_SUCCESSFUL = new


CpqAppHandlerError('150', Label.CPQAddSuccess);
public static CpqAppHandlerError UPDATE_SUCCESSFUL = new
CpqAppHandlerError('151', Label.CPQUpdateSuccessful);
public static CpqAppHandlerError DELETE_SUCCESSFUL = new
CpqAppHandlerError('152', Label.CPQDeleteSuccessful);
public static CpqAppHandlerError CLONE_SUCCESSFUL = new
CpqAppHandlerError('153', Label.CPQCloneSuccessful);

// Attribute Errors - 160


public static CpqAppHandlerError NO_ATTRIBUTE_FOUND = new
CpqAppHandlerError('160', Label.CPQNoAttributesFilters);
public static CpqAppHandlerError ATTRIBUTE_MODIFICATION_SUCCESSFUL = new
CpqAppHandlerError('161', Label.CPQAttributesModifySuccess);
public static CpqAppHandlerError NO_ATTRIBUTE_MODIFICATION = new
CpqAppHandlerError('162', Label.CPQNoAttributesToModify);
// Pricing Errors - 180
public static CpqAppHandlerError PRICELIST_INVALID = new
CpqAppHandlerError('181', Label.CPQInvalidPriceList);

// Other errors - 200


public static CpqAppHandlerError REQUIRED_FIELDS_MISSING = new
CpqAppHandlerError('200', Label.CPQReqFieldMissing);
public static CpqAppHandlerError INSERT_FAILED = new
CpqAppHandlerError('201', Label.CPQInsertFailed);
public static CpqAppHandlerError INVALID_OBJECT_TYPE = new
CpqAppHandlerError('202', Label.CPQInvalidObjectType);
public static CpqAppHandlerError VALUE_MISSING = new
CpqAppHandlerError('203', Label.CPQPleaseEnterValue);
public static CpqAppHandlerError REQUIRED_ATTR_MISSING = new
CpqAppHandlerError('204', Label.CPQAttributeMissing);
public static CpqAppHandlerError INVALID_PARAM = new
CpqAppHandlerError('205', Label.CPQInvalidParameter);
public static CpqAppHandlerError VALIDATION_INFO = new
CpqAppHandlerError('206', Label.CPQValidationInfo);
public static CpqAppHandlerError VALIDATION_WARN = new
CpqAppHandlerError('207', Label.CPQValidationWarning);
public static CpqAppHandlerError VALIDATION_ERROR = new
CpqAppHandlerError('208', Label.CPQValidationError);

// Generic catch all Error messages

© 2021 Vlocity LLC, a Salesforce


company 989
CME CPQ

public static CpqAppHandlerError GENERIC_PRODUCT_SERVICE_EXCEPTION = new


CpqAppHandlerError('209', Label.CPQProductServiceException);
public static CpqAppHandlerError GENERIC_ITEM_SERVICE_EXCEPTION = new
CpqAppHandlerError('210', Label.CPQItemServiceException);
public static CpqAppHandlerError GENERIC_PRICING_SERVICE_EXCEPTION = new
CpqAppHandlerError('211', Label.CPQPricingServiceException);

//Other errors continued


public static CpqAppHandlerError CLONE_FAILED = new
CpqAppHandlerError('212', Label.CPQCloneFailed);
public static CpqAppHandlerError UPDATE_FAILED = new
CpqAppHandlerError('213', Label.CPQUpdateFailed);
public static CpqAppHandlerError SUBMIT_FAILED = new
CpqAppHandlerError('214', Label.CPQSubmitFailed);
public static CpqAppHandlerError FDO_FAILED = new
CpqAppHandlerError('215', Label.CPQFdoFailed);
public static CpqAppHandlerError ACCOUNT_INACTIVE = new
CpqAppHandlerError('216', Label.CPQAccountInactiveOrExpired);

//Bundle Error/Warning messages - 220


public static CpqAppHandlerError BUNDLE_HAS_ERRORS = new
CpqAppHandlerError('220', Label.ThisBundleHasErrors);
public static CpqAppHandlerError BUNDLE_HAS_WARNINGS = new
CpqAppHandlerError('221', Label.ThisBundleHasWarnings);

//Promotion Service Errors - 300


public static CpqAppHandlerError GENERIC_PROMOTION_SERVICE_EXCEPTION = new
CpqAppHandlerError('310', Label.CPQPromotionServiceException);
public static CpqAppHandlerError MULTIPLE_CONTEXT_NODES_DETECTED = new
CpqAppHandlerError('320', Label.CPQMultipleNodesDetected);
public static CpqAppHandlerError CARDINALITY_EXCEPTION = new
CpqAppHandlerError('330', Label.CPQPromotionCardinalityException);
public static CpqAppHandlerError PAST_OR_ENDOFLIFE_PRODUCTS_EXCEPTION =
new CpqAppHandlerError('340', Label.CPQPastOrEndOfLifeProductException);
public static CpqAppHandlerError
PROMOTION_PAST_OR_ENDOFLIFE_PRODUCTS_EXCEPTION = new CpqAppHandlerError('340',
Label.CPQPromotionPastOrEndOfLifeProductException);

//Override Service Errors - 400


public static CpqAppHandlerError CARDINALITY_OVERRIDE_SERVICE_EXCEPTION =
new CpqAppHandlerError('410', Label.CPQCardinalityOverrideServiceException);
public static CpqAppHandlerError CART_UPGRADE_EXCEPTION = new
CpqAppHandlerError('420', Label.CPQCartUpgradeException);

public static CpqAppHandlerError GENERIC_PRODUCT_HIERARCHY_EXCEPTION = new


CpqAppHandlerError('230', Label.CPQIncorrectProdConfig);

© 2021 Vlocity LLC, a Salesforce


company 990
CME CPQ

public static CpqAppHandlerError RULE_CODE_FAIL_LEVEL_HARD_FAIL = new


CpqAppHandlerError('301', Label.CPQRuleConditionHardFail);
public static CpqAppHandlerError RULE_CODE_FAIL_LEVEL_SOFT_FAIL = new
CpqAppHandlerError('302', Label.CPQRuleConditionSoftFail);
public static CpqAppHandlerError RULE_CODE_FAIL_LEVEL_SOFT_PASS = new
CpqAppHandlerError('303', Label.CPQRuleConditionSoftPass);

public static CpqAppHandlerError CANNOT_CANCEL = new


CpqAppHandlerError('304', Label.CannotCancel);
public static CpqAppHandlerError CANCEL_SUCCESSFUL = new
CpqAppHandlerError('305', Label.CancelSuccessful);
public static CpqAppHandlerError CANCEL_FAILED = new
CpqAppHandlerError('306', Label.CancelFailed);
public static CpqAppHandlerError CANCEL_RETRY = new
CpqAppHandlerError('307', Label.CancelRetry);
public static CpqAppHandlerError CANCEL_ORDER_INVALID_SUBMIT_STATUS = new
CpqAppHandlerError('308', Label.CancelOrderInvalidSubmitStatus);
public static CpqAppHandlerError CANCEL_ACCEPTED = new
CpqAppHandlerError('309', 'Cancellation is accepted.');//CMT-5552 can not add
Custom label in patch. We can fix it in v105

// Discount messages - 500


public static CpqAppHandlerError DISCOUNT_ADD_SUCCESSFUL = new
CpqAppHandlerError('510', Label.CPQDiscountAddedSuccess);
public static CpqAppHandlerError DISCOUNT_CONFIGURE_SUCCESSFUL = new
CpqAppHandlerError('520', Label.CPQDiscountConfigSuccess);
public static CpqAppHandlerError DISCOUNT_CLONE_SUCCESSFUL = new
CpqAppHandlerError('530', Label.CPQDiscountCloneSuccess);
public static CpqAppHandlerError DISCOUNT_DELETE_SUCCESSFUL = new
CpqAppHandlerError('540', Label.CPQDiscountDeleteSuccess);
public static CpqAppHandlerError DISCOUNT_SUBMIT_SUCCESSFUL = new
CpqAppHandlerError('550', Label.CPQDiscountSubmitSuccess);

public static CpqAppHandlerError DISCOUNT_ADD_FAIL = new


CpqAppHandlerError('560', Label.CPQDiscountAddedFailed);
public static CpqAppHandlerError DISCOUNT_CONFIGURE_FAIL = new
CpqAppHandlerError('570', Label.CPQDiscountConfigFailed);
public static CpqAppHandlerError DISCOUNT_CLONE_FAIL = new
CpqAppHandlerError('580', Label.CPQDiscountCloneFailed);
public static CpqAppHandlerError DISCOUNT_DELETE_FAIL = new
CpqAppHandlerError('590', Label.CPQDiscountDeleteFailed);
public static CpqAppHandlerError DISCOUNT_SUBMIT_FAIL = new
CpqAppHandlerError('600', Label.CPQDiscountSubmitFailed);
public static CpqAppHandlerError DISCOUNT_UNAPPROVED = new
CpqAppHandlerError('610', Label.CPQDiscountUnapproved);

© 2021 Vlocity LLC, a Salesforce


company 991
CME CPQ

public static CpqAppHandlerError DISCOUNT_ALREADY_SUBMITTED = new


CpqAppHandlerError('620', Label.CPQDiscountAlreadySubmitted);

//Offer Migration Plans Errors - 700


public static CpqAppHandlerError GENERIC_OFFER_MIGRATION_PLAN_EXCEPTION =
new CpqAppHandlerError('710', Label.CPQOfferMigrationPlanServiceException);
public static CpqAppHandlerError CANNOT_REPLACE_SAME_OFFER_EXCEPTION = new
CpqAppHandlerError('720', Label.CPQCannotReplaceSameOfferException);
public static CpqAppHandlerError NO_REPLACEABLE_OFFER_IN_CART_EXCEPTION =
new CpqAppHandlerError('730', Label.CPQNoReplaceableOfferInCart);
public static CpqAppHandlerError ALL_DISCONNECTED_COMPONENTS_EXCEPTION =
new CpqAppHandlerError('740', Label.CPQAllDisconnectedComponents);

//Replace offer service errors - 800


public static CpqAppHandlerError GENERIC_REPLACE_OFFER_SERVICE_EXCEPTION =
new CpqAppHandlerError('810', Label.CPQReplaceOfferServiceException);
public static CpqAppHandlerError PROMOTION_ITEM_EXCEPTION = new
CpqAppHandlerError('820', Label.CPQPromotionItemException);
public static CpqAppHandlerError REPLACEMENT_SUCCESSFUL = new
CpqAppHandlerError('830', Label.CPQReplaceSuccess);
public static CpqAppHandlerError NO_REPLACEMENT_PERFORMED = new
CpqAppHandlerError('840', Label.CPQNoReplacementPerformed);

//Compare offer service errors - 900


public static CpqAppHandlerError GENERIC_COMPARE_OFFER_SERVICE_EXCEPTION =
new CpqAppHandlerError('910', Label.CPQCompareOfferServiceException);
public static CpqAppHandlerError TARGET_NOT_FOUND_EXCEPTION = new
CpqAppHandlerError('920', Label.CPQCompareTargetNotFoundException);

public class CpqAppHandlerError {


public String code;
public String message;

public CpqAppHandlerError(String code, String message) {


this.code = code;
this.message = message;
}
}
}

© 2021 Vlocity LLC, a Salesforce


company 992

You might also like