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.
This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.
There are two types of calculation procedures:
-
Class-based: Pricing logic is written in an Apex class.
-
Declarative: 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.
-
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.
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)
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)
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)
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)
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)
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)
For the managed package runtime, the following functions are supported in calculation procedures.