Loading
Salesforce now sends email only from verified domains. Read More
Context Service
Create a Context Definition

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.

Important
Important
  • 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.
  1. From Setup, in the Quick Find box, enter Context Service, and then select Context Definitions.
  2. Click New.
  3. Specify the context definition details.
    1. Name your context definition.
    2. In Description, enter additional details about the context definition, if necessary.
    3. Select the effective date range.
    4. In Time to Live, select how long you want the data that’s loaded in your context instance to live.
      Note
      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.
    5. If you want other definitions to refer this definition, select Reference Definition.
    6. To link two other definitions that act as reference definitions, click +Add Reference Definition.
    Context Definition Details
  4. Click Next.
  5. Configure a structure to define a relationship between the nodes by adding child and sibling nodes, as necessary.
    Note
    Note A reference data type attribute is generated when you define a parent-child relationship between nodes.
  6. Specify the node details.
    1. Give your node a name.
    2. To add child nodes, click Child Node icon.
    3. To add sibling nodes, click Sibling node.
    4. To convert the node’s record to a field name, click More icon, and select Mark as Transposable.
    5. To remove a node, click More icon, and select Delete.
    6. To automatically generate and manage data for nodes and attributes, select System Information Node.
    Note
    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.
    Add Nodes
  7. Click Next.
  8. 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
    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.
  9. Click Add Attributes and specify the attribute’s details.
    Note
    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.
    Add Attributes
  10. Click Next.
  11. 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.
  12. On the Create Attribute tags page, click Generate All Tags or Generate Node Tags.
  13. In the Generate Tags window, click Regenerate All or Retain and Generate.Generate Context Tags
  14. 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.

 
Loading
Salesforce Help | Article