Christmas & New Year Special – Get 50% OFF on FileTranz

Claim Your Offer

Getting Started with Context Service in Revenue Cloud

A beginner-friendly guide to Salesforce Revenue Cloud Context Service, covering Context Definitions, and Context Mapping.

By Kishore Selvakumar
Salesforce Developer

Getting Started with Context Service in Revenue Cloud

Introduction

To ensure consistent and efficient data access, Revenue Cloud uses Context Service, a centralized data abstraction layer. Through Context Definitions and Context Mapping, it provides a standardized way to retrieve, organize, and share data across multiple applications. This reduces direct dependencies on Salesforce objects, improves performance, and creates a unified data model for the entire quote-to-cash process. In this blog, we'll explore how Context Service works and how its core components help build scalable Revenue Cloud solutions.

Context Service

Context Service is a powerful data abstraction layer within Salesforce Revenue Cloud that acts as an intermediary between your business applications and Salesforce data.

Instead of every application directly querying Salesforce records, Context Service gathers the required data once, organizes it into a structured business context, and makes it available to multiple Revenue Cloud services. This creates a single source of truth that can be reused across different business processes.

Think of Context Service as a centralized data hub that ensures all Revenue Cloud components are working with the same information at the same time.

When a Revenue Cloud process is triggered, Context Service:

  1. Retrieves the required data from Salesforce objects.
  2. Maps the data into a predefined Context Definition.
  3. Makes the structured context available to downstream services.
  4. Allows multiple applications to consume the same dataset without repeatedly querying Salesforce.

This approach improves efficiency while ensuring consistency throughout the quote-to-cash lifecycle.

Why Context Service is Used

As Revenue Cloud implementations grow in complexity, different services often require access to the same customer, product, pricing, and asset information. Without Context Service, each application would retrieve this data separately.

By introducing a common context layer, organizations can streamline data access and improve overall system performance.

Centralized data access

  • One of the biggest advantages of Context Service is its ability to retrieve data once and reuse it across multiple applications.
  • For example, customer information used during Product Configuration can also be consumed by Pricing Procedures and Order Orchestration without additional database calls.

Improved performance

  • Performance is critical in pricing and configuration scenarios where large volumes of data need to be processed quickly.
  • Without Context Service, multiple applications may independently query the same records several times during a transaction. Context Service minimizes these repetitive calls by providing shared access to a common dataset.

Data consistency

  • When different applications retrieve data independently, there is always a risk of using outdated or inconsistent information.
  • Context Service ensures that all business processes operate on the same set of data, reducing discrepancies and helping teams maintain accurate business outcomes.

Key Components of Context Service

  1. Context Definition
  2. Context Mapping

Context Definition

A Context Definition is the blueprint that tells Context Service what data should be collected and how that data should be structured.

It defines:

  • Which Salesforce objects should be included.
  • The relationships between those objects.
  • Which fields should be exposed to downstream services.
  • How the data is organized within the context hierarchy.

In simple terms, if Context Service is the engine, then Context Definitions are the instructions that tell the engine what data to retrieve and assemble.

  • Nodes: Represent the business entities or objects, such as Quote, Quotelineitem, Order, OrderItem, etc.
  • Attributes: Individual data fields or properties within a node, like quantity, unit price, or Account Name.
  • Context Tags: Aliases that allow pricing procedures and applications to reference attributes.
  • Context Mapping: Connection between the source object fields and corresponding nodes and attributes. 

Why Context Definition Is Used

  • It provides a common data structure across Revenue Cloud applications such as Pricing Procedure, Business Rule, Product Discovery, etc.
  • Eliminates direct dependencies on Salesforce objects in pricing and orchestration logic.
  • Enables pricing procedures, product discovery, billing, and transaction management to work with the same data model.

Context Mapping

Context Mapping is the mechanism in Salesforce Revenue Cloud that connects Salesforce objects and fields to the nodes and attributes defined in a Context Definition.

It Defines:

  • Where data should be retrieved from
  • How data should be represented within the context
  • How data should be transferred between contexts
  • Where updates should be saved back in Salesforce

In simple terms, Context Mapping serves as the translator between Salesforce data and Revenue Cloud applications.

Why Context Mapping is Used

Revenue Cloud doesn't work directly with objects such as Quote, Quote Line Item, Order, and Order Item. Instead, it uses Context Definitions as an abstraction layer to fetch data from the source objects. Context Mapping tells Revenue Cloud where the data comes from and where it should be saved.

Types of Context Mapping

Salesforce Revenue Cloud supports multiple mapping approaches depending on how data needs to be exchanged.

sObject Mapping
  • sObject Mapping is the most common type of mapping.
  • It connects Salesforce object fields directly to attributes in a Context Definition.
Cross-Context Mapping
  • Cross-Context Mapping allows data to move between multiple Context Definitions.
  • This is useful when one business process needs information that already exists in another context.
Context Definition Mapping
  • Context Definition Mapping connects one Context Definition to another Context Definition structure.
  • It helps organizations standardize data movement between business processes while preserving a common business model.

Mapping Intents

When configuring a Context Mapping, you must specify how the mapped field will be used. This behavior is controlled through Mapping Intents.

Think of Mapping Intents as instructions that tell Revenue Cloud what action to perform on the data.

Hydration
  • Hydration is used to read data from Salesforce and populate the Context Definition.
  • This is the most commonly used mapping intent.
Persistence
  • Persistence writes data from the Context Definition back to Salesforce.
  • Once Revenue Cloud completes its processing, updated values can be saved to the source records.
Translation
  • Translation is used when data must be transformed from one context structure into another.
  • The source and target attributes may have different names, formats, or structures.
Association
  • Association is used to establish relationships between records or contexts.
  • Instead of transferring values, it creates references that connect related business entities.

Hands-on Demo

Consider a business scenario, whenever a product is added to a quote, its Warranty Period should automatically appear on the corresponding Quote Line from the Product.

Since Salesforce Revenue Cloud uses Context Service as its data abstraction layer, the solution isn't just about creating fields. We need to extend the Context Definitions and configure the required mappings so the data can flow seamlessly from the Product record to the Quote Line.

Step 1: Create the Warranty Period Field

The first step is to create the custom field that will store the warranty information.

Create a Number field named Warranty_Period__c on both:

  • Product (Product2)
  • Quote Line Item

Configure the required field length, field-level security, and page layouts.

Once the field exists on both objects, Revenue Cloud can begin exposing and transferring the value through Context Service.

Step 2: Extend the Product Discovery Context

To make the Warranty Period available in Context Service, create a new custom Context Definition based on the standard Product Discovery context.

  1. Navigate to Setup → Context Definitions.
  2. Create a new custom Context Definition by extending ProductDiscoveryContext__stdctx.


     
  3. Open the newly created Context Definition, BrowseProductsCtxDefinition.
  4. Click Edit and proceed to the structure configuration screen.

     
     

This custom Context Definition will be responsible for exposing Product data to downstream Revenue Cloud processes.

Step 3: Add the Product Node and Warranty Attribute

Now we need to tell Context Service which Product information should be included.

Under the Category node:

  1. Create a new child node called Product.


     
  2. Navigate to the Edit Attributes screen.
  3. Create a new attribute named Warranty_Period__c within the Product node.


     

At this point, the Context Definition knows that Warranty Period is part of the Product business context.

Step 4: Create an Attribute Tag

Attribute Tags make attributes useful to applications.

On the Edit Attribute Tags screen:

  1. Select the Product node.
  2. Create a new tag for Warranty_Period__c.
  3. Save the configuration.


     

This tag acts as a business-friendly reference that Revenue Cloud processes can use without directly referencing Salesforce field names.

Step 5: Map the Product Field to the Context Definition

The Context Definition now knows about the Warranty Period attribute, but it doesn't yet know where the value comes from.

To solve this, we create an sObject Mapping.

  1. Open the Map Data tab.
  2. Select ProductDiscoveryMapping.
  3. Click Edit SObject Mapping.
  4. Select the Product node.
  5. Map the Product field Warranty_Period__c to the corresponding Context Definition attribute.
  6. Click Save and Publish.


     

The Product Discovery Context is now capable of retrieving the Warranty Period value from Product records.

Step 6: Extend the Sales Transaction Context

Next, make the Warranty Period available in the Sales Transaction Context Definition that powers Pricing Procedures and Quote processing.

  1. Open the active Rev_SalesTransactionContext Context Definition.
  2. Click Edit and proceed to the Edit Attributes screen.


     
  3. Select the SalesTransactionItem node.
  4. Create a new attribute named Warranty_Period__c.


     
  5. Continue to the Edit Attribute Tags screen.
  6. Create an attribute tag for the new field.


     
  7. Save the changes.

The Sales Transaction Context can now hold the Warranty Period value at the Quote Line Item level.

Step 7: Map the Quote Line Item Field

Now we need to map the Sales Transaction Context attribute to the Quote Line Item field.

  1. Open the Map Data tab in Rev_SalesTransactionContext.
  2. Select QuoteEntitiesMapping.
  3. Click Edit SObject Mapping.
  4. Choose the SalesTransactionItem node.
  5. Map the Warranty_Period__c attribute to the Quote Line Item custom field.
  6. Click Save and Publish.



    You have successfully mapped the custom field on the QuoteEntitiesMapping Map Data! At this stage, the Sales Transaction Context knows how to store the value on the Quote Line Item.

Step 8: Configure Cross-Context Mapping

The final piece of the puzzle is connecting the Product Discovery Context to the Sales Transaction Context.

This is where Cross-Context Mapping comes into play.

  1. Open Rev_SalesTransactionContext.
  2. Navigate to the Map Data tab.
  3. Open ProductDiscoveryContextMapping.
  4. Select the SalesTransactionItem node.
  5. Choose BrowseProductsCtxDefinition as the source Context Definition.




     
  6. Map:
    1. SalesTransactionItem → Product
    2. Warranty_Period__c → Warranty_Period__c




       
  7. Click Save and Publish.

This configuration enables data to flow from the Product Discovery Context into the Sales Transaction Context during quote creation.

Conclusion

Context Service is a key foundation of Salesforce Revenue Cloud, enabling applications to work with a common and reusable business data model. Context Definitions define how data is structured, while Context Mapping determines how data is retrieved, transformed, and persisted. Together, they provide consistency, improve system performance, and simplify maintenance across Revenue Cloud processes. By understanding these concepts, administrators and developers can design more scalable, efficient, and future-ready quote-to-cash implementations. Mastering Context Service is an essential step toward unlocking the full potential of Revenue Cloud. Context Service: The foundation of seamless quote-to-cash.


free-consultation