You are here:
Create a Context Definition
Create a context definition by choosing nodes, defining their relationship, adding attributes, and applying context tags.
Required Editions
| Available in: Lightning Experience |
| Available in: Developer, Enterprise, Professional, and Unlimited editions for Industries clouds where Context Service is enabled |
| User Permissions Needed | |
|---|---|
| To create context definitions: | Context Service Admin |
Use the context definition that meets your business requirements. For example, to optimize the pricing performance, use a context definition to cache the data required at multiple steps of a pricing procedure. Identify the data required by various pricing elements and define a structure by creating nodes and attributes. When you use the pricing procedure, these nodes, attributes, and context tags help you get the right data from the context definition. You can set a transposable node to handle a scenario where you want to use a single attribute to store different values.
- All nodes, attributes, and context tag names must be unique. The names must begin with a letter, and can't contain any special characters except for underscores. The names can’t begin with a number, can’t include spaces, can’t end with an underscore, and can’t contain two consecutive underscores.
- Standard definitions are inherently Active, which means you can’t deactivate or delete them. You can only extend or clone a standard definition.
- You can activate, clone, edit, or delete a custom context definition.
- The Effective From and Effective To dates determine how long the context definition stays active. If you don’t specify an Effective To date, the context definition stays active forever. If you don't provide an Effective From date, the context definition is effective from the current date and time.
- From Setup, in the Quick Find box, enter Context Service, and then select Context Definitions.
- Click New.
-
Specify the context definition details.
- Name your context definition.
- In Description, enter additional details about the context definition, if necessary.
- Select the effective date range.
-
In Time to Live, select how long you want the data that’s loaded in your context
instance to live.
Note The duration that you specify here takes effect in certain applications that can support longer Time to Live. Usually the context definition lives for the duration of your request, which is typically a few seconds. - If you want other definitions to refer this definition, select Reference Definition.
- To link two other definitions that act as reference definitions, click +Add Reference Definition.
- Click Next.
-
Configure a structure to define a relationship between the nodes by adding child and
sibling nodes, as necessary.
Note A reference data type attribute is generated when you define a parent-child relationship between nodes. -
Specify the node details.
- Give your node a name.
-
To add child nodes, click
.
-
To add sibling nodes, click
.
-
To convert the node’s record to a field name, click
, and select Mark as Transposable.
-
To remove a node, click
, and select Delete.
- To automatically generate and manage data for nodes and attributes, select System Information Node.
Note- The parent-child nodes help determine the hierarchy in which data is consumed.
- The deletion of a parent node deletes the child nodes associated with it.
- Click Next.
-
Add attributes for each node by choosing an input type, the data type, and values if
you have a key-value pair.
Attribute Type Description Persistence INPUT Read-Only Select INPUT type when data is hydrated by Context Service (e.g., Salesforce objects) and only needs to be read by the consuming application.
Typically not persisted in the database, except for REFERENCE attributes. OUTPUT Write Select OUTPUT type when data must be written to or modified by the consuming application or a subsequent process.
Data is written back to from context definition to Salesforce Objects. INPUT OUTPUT Read and Write Select the INPUT OUTPUT type when you want to hydrate the context definition initially, but the consuming application must update that data later in the process.
Data is written back to from context definition to Salesforce Objects.
Note REFERENCE attributes, which establish links between nodes, can only have the INPUT type. Attributes marked as transient are explicitly skipped during context persistence, so their values are stored temporarily in the context without being saved to the database. -
Click Add Attributes and specify the attribute’s details.
Note- A key and value column appears for an attribute only if you marked its node as transposable.
- Context Service returns all data and time attributes in the UTC time zone. The consuming application can convert it to any time zone that suits the user or organization.
- To store changes made to an attribute temporarily in the cache without saving them to the database,select Transient on the Add Attributes page.
- Click Next.
-
Generate the contex tags.
- To generate tags for all the nodes and attributes at one go, select Generate All Tags.
- To generate a tag for a single node or attribute, select Generate Node Tags.
- To generate new tags for the selected node and its attributes, including nodes and attributes with tags, select Regenerate All.
- To generate tags only for the selected node and attributes without tags, select Retain and Generate.
- On the Create Attribute tags page, click Generate All Tags or Generate Node Tags.
-
In the Generate Tags window, click Regenerate All or
Retain and Generate.
- Save your context definition.
The created context definition is listed on the Context Definitions page, under the Custom Definitions tab. To start the mapping process, click the context definition . After you complete the mapping, activate it.

