Sunday, 26 October 2025

Context Definition (RCA)


 What Is a Context Definition?

A Context Definition is a metadata-driven structure used to pass data into Revenue Cloud services in a consistent and reusable way. It is defined by a set of core building blocks -

  1. Nodes – Containers for attributes mapped to Salesforce objects. Each node can hold multiple attributes.
  2. Attributes – Containers for data, mapped directly to fields on an object.
  3. Context Tags – Simple aliases for nodes and attributes, used by consuming applications to query context data easily.
  4. Context Mappings – The link between nodes/attributes and input data sources. A single context definition can support multiple mappings to serve different use cases.

A context definition typically follows four stages:

  1. Creation (Design time) – Defining nodes, attributes, tags, and mappings.
  2. Hydration – Populating the definition with actual record data at runtime.
  3. Consumption – Querying or transforming hydrated data.
  4. Persistence – Writing any changes back into mapped objects.



Context Service APIs

The Context Service provides a set of Apex APIs to interact with context definitions. In this post, we’ll focus on hydration, retrieval, and querying.

  • Build: Load data into a context.
    • buildContext – Create a context instance at runtime.
    • getContext – Retrieve details of an existing context.
    • deleteContext – Delete a context instance.
  • Query: Explore data within the context.
    • queryContextRecordsAndChildren – Retrieve records and child records.
    • queryTags – Retrieve tag values.
  • Update: Modify an existing context.
    • updateContextAttributes – Update data in the context.
    • addRecordToContext – Add new data.
  • Persist: Save context data back to the database.
    • persistContext – Write hydrated context data to mapped objects.



Applications of Context Definitions

Context Definitions appear in many Revenue Cloud scenarios, including :

  • Pricing Procedures – Passing quote and product information into the pricing engine.
  • Product Discovery – Determining which products or services are eligible for a customer.
  • Contracts & Assets – Handling renewals, asset-based ordering, and related conditions.


Consuming Context Definitions from Apex

From a developer’s perspective, consuming a Context Definition directly in Apex is useful when:

  • Triggering Apex hooks within a procedure plan.
  • Testing or validating changes made to a Context Definition.
  • Building custom solutions that consume or share a hydrated context.

Instead of writing SOQL queries and reproducing mappings manually, you can rely on the Context Service APIs to tap into hydrated data directly.

Pricing Procedures in Salesforce Revenue Cloud Advance (RCA)

 Pricing procedures are customizable, ordered stacks of pricing elements that help calculate the final net price of a product. Using the Pricing Procedure Builder, businesses can transform their pricing policies into effective pricing procedures.


Prerequisites to Build Pricing Procedures

Before creating and configuring pricing procedures, ensure the following prerequisites are in place:


Use Context Definitions: Context definitions ensure efficient data access during the pricing process. These definitions include structures that define nodes, attributes, and context tags.


A) Configuring Your Pricing Procedure

Pricing procedures use preconfigured pricing policies to calculate discounts and determine the final net price for your products. When you create a pricing procedure, the first version (suffixed with v1) is a blank, usable version. To perform pricing calculations, you must add appropriate pricing elements that call the necessary lookup tables.


B) Simulating and Activating Your Pricing Procedure

Before activation, simulate the pricing procedure to verify the accuracy of the variables entered. If the procedure doesn’t perform as expected, edit the variables and rerun the simulation. Once satisfied with the results, activate the pricing procedure version.


C) Pricing Elements

Pricing elements are the foundational building blocks of a pricing procedure. Initially, a pricing procedure is blank, and each added element forms a step in the procedure. Select the available pricing elements to form logical steps in the pricing process.


D) Contract-Based Pricing

Contract-based pricing enables you to manage and apply special pricing deals based on previously negotiated agreements outlined in a contract.


E) Discovery Procedures for Pricing

Discovery procedures fetch the contributing factors needed to calculate a product's derived price. These factors are written into the context definition to ensure accurate data access during the pricing process.


F) Derived Price

A derived price accurately calculates a product's price based on various contributing factors, or the prices of multiple source products. This price can be sourced from another pricing source such as a product or an asset.


G) Procedure Output Resolution

Procedure Output Resolution allows you to determine the best price when multiple pricing rules generate different outcomes. Define a pricing resolution strategy that can be applied to elements like the List Price or Price Tracking element within the pricing procedure to derive the most appropriate price or discount.


H) Decision Explainer for Salesforce Pricing

With the Decision Explainer tool, you can offer users clear explanations for the results generated by pricing elements when a pricing procedure is run. This feature helps in understanding the internal pricing process better.




Dynamic Attributes in Salesforce Revenue Cloud Advanced (RCA)

 Attributes represent the unique characteristics or properties of products and product classifications within Salesforce Revenue Cloud Advanced (RCA).


These attributes can be defined using various data types including:

Text

Number

Date

Date Time

Checkbox

Picklist

Currency

Percent


Picklists are especially important


They define all possible values an attribute can take, allowing users to select from predefined options when configuring or purchasing a product.


Key point:

You must define picklists before creating attributes of the data type picklist.

Derived Price (RCA)

 Derived Price accurately calculates a product's price from another pricing source, such as a product or an asset, based on various contributing factors or the prices of multiple source products.


To calculate the derived price of a product, you must specify the pricing source and the derived pricing scope. Pricing Source indicates the origin of the pricing information. Salesforce Pricing has two pricing sources.


Product   : The price of one or more products within a transaction.

Header   : The total price of products in a transaction cart.


The Derived Pricing Scope decides the method that’s used to calculate the derived price. Based on the pricing source that you select, select your derived pricing scope.


Transactional : Calculate the price of the derived product from a source product within the same or current transaction.


Non-Transactional : Calculate the price of the derived product from another asset, not within the same or current transaction.


Both: A combination of both transactional and non-transaction scopes.


Price Impacting (RCA)

 What does “Price Impacting” RCA?


When an attribute is marked as Price Impacting, it tells Salesforce to adjust the product price automatically based on the selected value of that attribute.


Ex : 


1 . A sales rep selects “Red” for a phone’s color → system applies a 10% discount. 

2 . A product size is selected as “XL” → system adds ₹500 to the base price. The adjustment happens in real-time and doesn’t require manual intervention.


Why use Price Impacting Attributes? 


1. To automate pricing based on product options. To reduce quoting mistakes and manual calculations. 


2. To simplify the sales process—sales reps just choose options, and the system calculates pricing dynamically.


Decision Matrix ( RCA)

 In Salesforce Revenue Cloud, a decision matrix is a table in the Business Rules Engine that uses multiple input conditions to look up and return a single corresponding output value. It is used to automate complex pricing and quoting scenarios by mapping specific inputs, such as customer demographics or product attributes, to a single outcome, like a discount percentage or fee.


Ex :

Example using a Lookup Table for family insurance premiums:

0 dependents → $5,000

1 dependent → $10,000

2 dependents → $15,000

3 dependents → $20,000

4 dependents → $25,000

5 dependents → $30,000


When customers apply via a public health portal, the system automatically references this decision matrix to calculate the appropriate premium.



When to Use a Decision Matrix in Salesforce Revenue Cloud?

A Decision Matrix is best used when you need to evaluate multiple input conditions and return a single output value — without writing complex code or formulas.

Understanding Context Service Run-Time Process(RCA)

 Use the Context Service run-time process to call Context Service APIs from your applications. You can build, query, update, and persist context data based on the context definitions and mappings created during design time.


How it works:


 1. After setting up context definitions and mappings in design time, digital processes invoke the Build APIs to create a run-time context instance.


 2. The instance extracts data from various objects as per the mappings and is stored in temporary transient data stores for fast access.


 3. Processes can interact with this instance efficiently, avoiding repeated database access.


 4. When updates are made, the modified instance can be persisted back to objects. You can even use one mapping to read data and a different one to write it back.


Efficient, flexible, and designed for fast data access.