---
schema_version: "1"
id: 6b8d67d0e4252ef78164bc02ef5e16a2a810687692a62b4d1fa3d1207519125c
title: Calculation Procedures Overview (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_calculation_procedures_overview.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_calculation_procedures_overview.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: fa67c1662a8e1a8d4b509405506974cbb5c7c185dbf09ea11c9b444b1b9cd91d
description: For the managed package runtime, a Calculation Procedure is a series of calculations performed using matrix lookups and user-defined variables and constants. A calculation procedure can call Apex classes for pre- and post-calculation custom logic. Calculation procedures are part of pricing rules.
products:
  - Omnistudio
release: "264"
---
# Calculation Procedures Overview (Managed Package)

For the managed package runtime, a Calculation Procedure is a series of calculations performed using matrix lookups and user-defined variables and constants. A calculation procedure can call Apex classes for pre- and post-calculation custom logic. Calculation procedures are part of pricing rules.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

There are two types of calculation procedures:

- [Class-based](https://help.salesforce.com/s/articleView?id=xcloud.os_use_apex_to_define_pricing_logic.htm&release=264.0.0&type=5 "For the managed package runtime, to use Apex to define pricing logic, create a class-based Calculation Procedure. The Calculation Procedure name and action class name must be the same as the name of the Apex class. (To define pricing logic without using an Apex class, create a declarative Calculation Procedure.)"): Pricing logic is written in an Apex class.
- [Declarative](https://help.salesforce.com/s/articleView?id=xcloud.os_declarative_calculation_procedures.htm&release=264.0.0&type=5 "For the managed package runtime, declarative calculation procedures are a key component of the ratings engine. Along with calculation matrices, calculation procedures are the key components of any or ratings engine. Calculation procedures take an input JSON and run through a series of matrix lookups (calling values from calculation matrices) and calculations to calculate ratings for policy products."): Pricing logic is implemented using matrix lookups, variables, constants, and basic math operations.

Declarative calculation procedures are associated with Omnistudio Data Mapper mappings. Declarative calculation procedures use Data Mappers to read and save data from Salesforce objects. You can add variables from the Data Mapper extract, such as Original Price (Currency) and Quantity (Number). For example, you can add a currency variable named UnitPrice as a calculation output that can be used in a Data Mapper load to update a field in a Salesforce object.

A calculation procedure can use two types of steps.

- Matrix: If you have enabled Calculation Matrices, a calculation procedure can include a Calculation Matrix in the calculation steps. For more information about Calculation Matrices, see [Calculation Matrices](https://help.salesforce.com/s/articleView?id=xcloud.os_calculation_matrices.htm&release=264.0.0&type=5 "For the managed package runtime, calculation matrices are one of the key elements of a Vlocity rating engine. Vlocity uses calculation matrices to look up inputs, match them to outputs, and provide the outputs to calculation procedures.").
- Formula: For example, you can specify the UnitPrice variable as output. If you are using Data Mapper mappings, the calculation procedure output variable name must match the Data Mapper Load input variable name

Each step in a Calculation Procedure can have a condition that must be met in order for the step to be executed. See [Conditional Steps For Calculation Procedures](https://help.salesforce.com/s/articleView?id=xcloud.os_conditional_steps_for_calculation_procedures.htm&release=264.0.0&type=5 "For the managed package runtime, for each step in the Calculation Procedure, you can define a condition that must be met in order for the step to be executed. The step is only executed when the condition is met.").

In the Preprocessor Class Name section of the calculation procedure, you must specify the class that implements a nameSpace.VlocityOpenInterface calculation method.

To include the output from a calculation step in the final output, select **Include in output**.

- **[Use Cases for Calculation Procedures (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_use_cases_for_calculation_procedures.htm&release=264.0.0&type=5)**  
    For the managed package runtime, here are ways to set up the possible use cases for calculation procedures that use or don't use attribute-based pricing or volume-based pricing.
- **[Use Apex to Define Pricing Logic (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_use_apex_to_define_pricing_logic.htm&release=264.0.0&type=5)**  
    For the managed package runtime, to use Apex to define pricing logic, create a class-based Calculation Procedure. The Calculation Procedure name and action class name must be the same as the name of the Apex class. (To define pricing logic without using an Apex class, create a declarative Calculation Procedure.)
- **[Clone a Calculation Procedure (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_clone_a_calculation_procedure.htm&release=264.0.0&type=5)**  
    For the managed package runtime, the Clone action button isn't present for calculation procedures by default, but you can add it. When you clone a calculation procedure, you're cloning all of its versions, steps, variables, and constants.
- **[Variables and Constants in Calculation Procedures (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_variables_and_constants_in_calculation_procedures.htm&release=264.0.0&type=5)**  
    For the managed package runtime, you must create variables, constants, and matrices before you can use them in a Calculation Procedure. After you create them, they will be available to use in Calculation Procedures.
- **[Conditional Steps For Calculation Procedures (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_conditional_steps_for_calculation_procedures.htm&release=264.0.0&type=5)**  
    For the managed package runtime, for each step in the Calculation Procedure, you can define a condition that must be met in order for the step to be executed. The step is only executed when the condition is met.
- **[Functions for Calculation Procedures (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_functions_for_calculation_procedures.htm&release=264.0.0&type=5)**  
    For the managed package runtime, the following functions are supported in calculation procedures.