---
schema_version: "1"
id: 0b44a5540ee7b76afd09c09f4b92b4f2fecd607b6c6fba9775576367948aeb2c
title: Calculation Action (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_action.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_calculation_action.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: c27199730173dd57dec0cb0ce28622d9b8ecd28b4a3062e35fd9a0fe9c5a84cf
description: For the managed package runtime, call a Vlocity Calculation Procedure directly from an Omniscript using the Calculation Action.
products:
  - Omnistudio
release: "264"
---
# Calculation Action (Managed Package)

For the managed package runtime, call a Vlocity Calculation Procedure directly from an Omniscript using the Calculation Action.

![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).

When the action executes, inputs from the form are sent to the Procedure—either directly or through an Omnistudio Data Mapper pretransform service—and the output is returned to the Omniscript—either directly or through a Data Mapper post-transform service.

Before you Begin

Create a Calculation Procedure. See [Calculation Procedures and Matrices (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_calculation_procedures_and_matrices.htm&release=264.0.0&type=5 "For the managed package runtime, a calculation procedure is a series of calculations performed on matrix lookups and user-defined variables and constants. A calculation matrix is a table that looks up information using multiple input dimensions and returns the corresponding output value.").

1. Add a **Calculation Action** to the Omniscript canvas, and add a **Name**.
2. In Remote Properties, in the **Remote Class** field, enter NS.PricingMatrixCalculationService, and replace NS with the namespace of your Vlocity package.
    
    ![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/lwc_designer_calculation_action.png)
3. In the **Remote Method** field, enter calculate.
4. In the **Configuration Name** field, enter the name of a Calculation Procedure.
5. (Optional) In the **Pre-Transform Data Mapper Interface** field, enter a Data Mapper that transforms the jSON node names being sent to the Calculation procedure. This step is not necessary if the existing JSON matches the Calculation Procedure's Variable Ids.
6. (Optional) In the **Post-Transform Data Mapper Interface** field, enter a Data Mapper that transforms the response from the Calculation Procedure to match elements in the Omniscript. This step is not necessary if the response JSON matches elements in the Omniscript. For more information on prefiling, see [Populate Elements (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_populate_elements.htm&release=264.0.0&type=5 "For the managed package runtime, populate subsequent input elements with values from data JSON, formula operators, functions, concatenations, and static values. Prefill an element directly from an Omnistudio Data Mapper or Action response whenever possible. When a previous element assigns a value to a subsequent input element's Name, the subsequent input element is populated with the assigned value.").
7. (Optional) Check **Include Inputs** if the Omniscript elements sent to the calculation procedure are at the Step level of the Omniscript.
8. (Optional) Check **Match Input Variables** to debug and ensure the input data being sent to the Calculation Procedure matches the input variables in the procedure. If an input variable is missing an exception is thrown.
9. To test this Calculation:
    1. Run the script in Preview mode or launch it from a Contact record.
    2. Answer the questions as follows:
        
        ![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/publicsector_screening_regionofpeel.png)
    3. Fill out the Eligibility step as follows:
        
        ![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/publicsector_eligibility_income.png)

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/images/icon_example.png)

Example

The example Omniscript below uses a Calculation Action (Call Calculation Procedure) to calculate the discounted Base and Adjusted monthly rental charges that the applicant is eligible to receive. The name of the Calculation Procedure is entered in the configurationName property.

![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/lwc_designer_calculation_action.png)

Eligibility data from the form, such as income, program type, and number of family members is passed into the HEPreTransform Data Mapper transform interface, where it is transformed into the Input JSON that the Calculation procedure is expecting. Click the link icon next to HEPreTransform to view the Data Mapper interface:

![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/salesforce_datamappings.png)

When the Calculation Action executes, the Procedure (Calculate Housing Benefit) runs and returns a JSON that fills the results into the script. Any variable in the Procedure that is included in the Calculation Output will be sent back to the Omniscript.

Here are the Calculation Steps in the Calculate Housing Benefit Procedure:

![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/salesforce_calculationsteps_housingbenefit.png)

...and the returned JSON (this can be found by clicking **Simulate** on the Procedure. See the Matrices for correct inputs):

![image](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/omnistudio_for_managed_packages/images/salesforce_calculationresults_simulateresults.png)

If the elements on the Omniscript that are being sent to the Calculation Procedure exactly match the Variable Ids in the procedure and are at the Step level of the Omniscript (not in a block), you don't need to create a Pre-Transform interface. Otherwise, implement a Pre-Transform interface to format the JSON for the calculation procedure.

If the elements that will be filled by the output of the script are located in a step or block called "output" with a nested block called "calculationResults" with Variable Id's that match the Omniscript elements, you don't need to create a Post-Transform interface. Otherwise, implement a Post-Transform interface to format the JSON coming from the Calculation Procedure to match the JSON structure of the Omniscript.

- **[Calculation Action Properties (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_calculation_action_properties.htm&release=264.0.0&type=5)**  
    For the managed package runtime, this page contains information on Calculation Action Properties.