Skip to main content

Deploying ContextDefinition using Gearset

A guide on how to retrieve and deploy ContextDefinition

Jacob Joshua avatar
Written by Jacob Joshua
Updated over 2 weeks ago

What is ContextDefinition?

ContextDefinition is part of Salesforce’s Context Service. In the context of RLM, it helps different parts of the Revenue Lifecycle Management (RLM) process talk to each other by passing along important context, like what quote a user is working on or which product they’re interacting with.

You can think of it as a way for Salesforce to keep track of what’s going on as someone moves through steps like quoting, pricing, or renewals. Each ContextDefinition defines what kind of information needs to be carried around and how it should be used.

Custom vs Standard ContextDefinition

Salesforce provides some standard ContextDefinition out of the box these are built-in and can't be retrieved or deployed using metadata tools.

You can only retrieve and deploy custom ContextDefinition ones that have been created or extended specifically for your org.

How to retrieve ContextDefinition

You need to include ContextDefinition metadata in your metadata filter and run a comparison as below to be able to retrieve them from your source and target.

The specific example shown here below is from a Revenue Cloud Org.

How to deploy ContextDefinition

From the comparison above, select your items and click on "Next".

When deployed individually, it usually comes without Problem analyser suggestions which you'll find onto the next page.

To deploy ContextDefinition click on "Deploy now" when arrived on this step.


Errors we have seen while deploying ContextDefinition

We have found a couple of common errors when deploying ContextDefinition.


Error 1

An error has occurred retrieving the metadata from Salesforce: Could not retrieve metadata: UNKNOWN_EXCEPTION - DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): AsyncRequestFFXResult, original object: ContextDefinitionSync

Error 2

inheritedFromVersion changed for definition Rev_SalesTransactionContext new value: XX previous value: YY


The sample XML will show similar to this below when encountering this error:


For both errors though, the ContextDefinition in the target org was out of sync.

The resolution to this was therefore to go to the Context Service page in the target org, click Sync, and then try the deployment again.

Sync extended definitions

Please refer to this Salesforce article for step-by-step instructions.

After syncing, the validation was successful as below.

And voilà! Congratulations on successfully deploying your ContextDefinition!

Did this answer your question?