You are here:
Set Up Dynamic Usage Quantity
You can source the estimated usage quantity of a service at a service point, premises, subscriber, or service account 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.
Set up dynamic sourcing of usage quantity at a service point.
- Create a calculation matrix.
- Create a calculation procedure.
- Select the calculation procedure in the CPQ Configuration set up.
Create a Calculation Matrix for Dynamic Usage Quantity
You can set usage quantity for every line item of the service quotes or order under a group using the calculation matrix.
The calculation matrix consists of input and output columns. The input column identifies the line item for which usage quantity is required. The output column identifies the object field used to pick the usage data.
-
Define the input columns:
- Add an input column to identify the Cart line items, such as products or services, for which the usage quantity is required. For example, add an input column Product Code to identify the products.
- Add an input column to identify the line item attribute for which the usage quantity is required. For example, add an input column Attribute Code to specify the product line item attribute for which usage quantity needs to be added.
-
Define the output columns to identify the source from where the usage quantity is fetched.
- Add an output column named ServiceFieldAPIName. The value of this column is used to pick up usage data from objects such as premises, service-point, subscriber, or service account.
-
Optionally, add another output column named Target. The value of this column identifies the field where the usage data value is copied in the Cart line items. You must name the output columns ServiceFieldAPIName and Target for the calculation matrix to work.
-
UsageOnly - The usage data is copied to the usage quantity field of the Cart line item.
-
AttributeOnly - The usage data is copied to the attribute field of the Cart line item.
-
AttributeAndUsage - The usage data is copied to both the usage quantity and attribute fields of the Cart line item.
-
- Create the calculation matrix after you have defined the input and output columns.
- On the App Launcher, search for Vlocity Calculation Matrices, and open it.
- Click New.
- In the Calculation Matrix Name field, enter a name for the calculation matrix, for example, DynamicUsageQuantityMatrix.
- Click Save.
- On the Vlocity Calculation Matrix page, click the Related tab.
-
Click View all and select the calculation matrix version for which you want to create the matrix data.
The Details tab is displayed.
-
In the Table section, click Add Header. Enter the following details:
- Name: Enter a name for the column header, for example, Average Monthly Consumption.
- 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.
- Data Type: Select a data type, for example, Number.
- Matrix Display Order: Specify a number, for example, 2. It defines the sequence in which the column is displayed.
- Add more Header columns as required.
- Click Edit Data and enter appropriate data in the matrix.
- Click Save Data.
- Create a Calculation Procedure for Dynamic Usage Quantity.
Create a Calculation Procedure for Dynamic Usage Quantity
After creating a calculation matrix, create a calculation procedure to set up dynamic sourcing of usage quantity at a service point.
- From the App Launcher, open Vlocity Calculation Procedures.
- Click New.
- Select the Declarative record type and click Next.
- Enter a name for the calculation procedure, for example, Usage Quantity Pricing Procedure.
- Click Save.
- On the Vlocity Calculation Procedure page, click the Related tab.
- Click View all and select the calculation procedure that you created.
- (Optional) Click and expand the Preprocessor Class Name section.
- (Optional) In the Enter your pre-processor Apex class name below box, enter a pre-processor Apex class name, for example, UsageConfigPreProcessor.
-
Click and expand the Calculation Steps section.
- Click Add Step.
- Select Matrix Lookup.
- Enter the name of the calculation matrix you created, for example, DynamicUsageQuantityMatrix.
- Select Include in Calculation Output on the right.
- Go to the Calculation Setup section. Click the pencil icon and select Enabled.
- Click Save.
- Configure CPQ Configuration Setup for Usage Quantity.
Configure CPQ Configuration Setup for Usage Quantity
After creating a calculation procedure, complete the CPQ setup for usage quantity to finish dynamic sourcing of usage quantity at a service point.
- From the App Launcher, search for Vlocity CMT Administration, and open it.
-
Click CPQ Configuration Setup under Custom
Settings.
The CPQ Configuration Setup page opens.
- Scroll to the end of the page and click Add.
- In the Name column, enter UsageQuantityCalculationProcedureName.
- In the Setup Value column, enter the name of the calculation procedure you created in the previous task, for example, Usage Quantity Calculation Procedure.
- Click Save.


