Newer Version Available

This content describes an older version of this product. View Latest

ContextDefinition

Represents the details of a context definition that describe the relationship between the node structures within a context.

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Important

Parent Type

This type extends the Metadata metadata type and inherits its fullName field.

File Suffix and Directory Location

ContextDefinition components have the suffix .contextDefinition and are stored in the contextDefinitions folder.

Version

ContextDefinition components are available in API version 59.0 and later.

Special Access Rules

Enable Context Service to access the ContextDefinition metadata type.

Fields

Field Name Description
contextDefinitionVersions
Field Type
ContextDefinitionVersion[]
Description
Version of the context definition.
contextTtl
Field Type
int
Description

Duration to persist the data, which is loaded in the run-time context instances created by this context definition, in the cache.

The default value is 10 minutes.
description
Field Type
string
Description
Description of the context definition.
isProtected
Field Type
boolean
Description
Auto-generated value that doesn’t impact the behavior of the metadata type.
masterLabel
Field Type
string
Description

Required.

User-friendly name for the context definition, which is defined when the context definition is created.

title
Field Type
string
Description

Required.

Name of the context definition.

ContextDefinitionVersion

Represents details about the context definition version. Only one version can be active at a time.

Field Name Description
contextMappings
Field Type
ContextMapping[]
Description
Mapping of attributes and nodes to related objects.
contextNodes
Field Type
ContextNode[]
Description
Details of the structure of the nodes within the context.
endDate
Field Type
string
Description
Date and time when the context definition version becomes inactive.
isActive
Field Type
boolean
Description
Indicates whether the context definition version is active (true) or not (false).
The default value is false.
startDate
Field Type
string
Description

Required.

Date and time when the context definition version becomes active.
versionNumber
Field Type
int
Description

Required.

Version number of the context definition.

ContextMapping

Represents the mapping of attributes and nodes to related objects.

Field Name Description
contextNodeMappings
Field Type
ContextNodeMapping[]
Description
Mapping of the node in the context and values in the input schema.
default
Field Type
boolean
Description
Indicates whether the mapping for a context definition version is default (true) or not (false).
The default value is false.
description
Field Type
string
Description
Description of the context mapping.
title
Field Type
string
Description

Required.

Name of the context mapping.

ContextNodeMapping

Represents the relationship between the node in the context and values in the input schema.

Field Name Description
contextAttributeMappings
Field Type
ContextAttributeMapping[]
Description
Mapping of the attribute defined in the context and the values in the related objects.
contextNode
Field Type
string
Description
Context node record associated with the context node mapping.
object
Field Type
string
Description
Name of the object used for the mapping.

ContextAttributeMapping

Represents the relationship between the attributes defined in the context and the values in the related objects.

Field Name Description
contextAttrHydrationDetails
Field Type
ContextAttrHydrationDetail[]
Description
Details of the SOQL (database) queries that fetch data for a chosen attribute from the input schema.
contextAttribute
Field Type
string
Description
Context attribute record associated with the context attribute mapping.
contextInputAttributeName
Field Type
string
Description

Required.

Name of the input attribute.

ContextAttrHydrationDetail

Represents the SOQL (database) queries that fetch data for a chosen attribute from the input schema.

Field Name Description
contextAttrHydrationDetails
Field Type
ContextAttrHydrationDetail[]
Description
Details of the query that fetches the data for the specific query attribute.
objectName
Field Type
string
Description

Required.

Name of the object used for the attribute hydration detail.
queryAttribute
Field Type
string
Description

Required.

The SOQL query that is the source of the hydration.

ContextNode

Represents details of the structure of the nodes within the context. Each node can have other nodes related to them and attributes to describe the object. You can also define a hierarchy for the nodes.

Field Name Description
contextAttributes
Field Type
ContextAttribute[]
Description
Details of the attribute used to describe the context node.
contextTags
Field Type
ContextTag[]
Description
Unique identifier of the attribute or node.
title
Field Type
string
Description

Required.

Name of the context node.
transposable
Field Type
boolean
Description
Indicates whether the data in the Context Node record can be converted to field names (true) or not (false).
The default value is false.

ContextAttribute

Represents details of an attribute used to describe a context node. Each node can have one or many associated attributes.

Field Name Description
contextTags
Field Type
ContextTag[]
Description
Shortened name of the attribute or node.
dataType
Field Type
ContextAttributeDataType (enumeration of type string)
Description

Required.

Type of data that's stored in the context attribute.

Valid values are:

  • boolean
  • currency
  • date
  • datetime
  • number
  • percent
  • picklist
  • reference
  • string
domainSet
Field Type
string
Description
List of node references to show the parent-child relationship between the nodes in a definition.
fieldType
Field Type
ContextAttributeFieldType (enumeration of type string)
Description

Required.

List of node references to depict the parent-child relation between the nodes in a definition.

Valid values are:

  • input
  • inputoutput
  • output
key
Field Type
boolean
Description
Indicates whether the attribute is a key attribute in the node (true) or not (false).
The default value is false.
title
Field Type
string
Description

Required.

Name of the context attribute.
value
Field Type
boolean
Description
Indicates whether the attribute identifies as a value in a node (true) or not (false).
The default value is false.

ContextTag

Represents a unique identifier of an attribute or node instead of a fully qualified tag structure name.

Field Name Description
title
Field Type
string
Description

Required.

Name of the context tag.

Declarative Metadata Sample Definition

The following is an example of a ContextDefinition component.

1<?xml version="1.0" encoding="UTF-8"?>
2<ContextDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
3    <fullName>SampleContextDefinition</fullName>
4    <contextDefinitionVersions>
5        <contextMappings>
6            <contextNodeMappings>
7                <contextAttributeMappings>
8                    <contextAttrHydrationDetails>
9                        <objectName>CustomAccount__c</objectName>
10                        <queryAttribute>Name</queryAttribute>
11                    </contextAttrHydrationDetails>
12                    <contextAttribute>AccountName</contextAttribute>
13                    <contextInputAttributeName>AccountName</contextInputAttributeName>
14                </contextAttributeMappings>
15                <contextAttributeMappings>
16                    <contextAttrHydrationDetails>
17                        <objectName>CustomAccount__c</objectName>
18                        <queryAttribute>CustomAccountName__c</queryAttribute>
19                    </contextAttrHydrationDetails>
20                    <contextAttribute>CustomAccountName</contextAttribute>
21                    <contextInputAttributeName>CustomAccountName</contextInputAttributeName>
22                </contextAttributeMappings>
23                <contextNode>SampleContextNode</contextNode>
24                <object>CustomAccount__c</object>
25            </contextNodeMappings>
26            <default>true</default>
27            <title>CustomAccountMapping</title>
28        </contextMappings>
29        <contextMappings>
30            <contextNodeMappings>
31                <contextAttributeMappings>
32                    <contextAttrHydrationDetails>
33                        <objectName>Account</objectName>
34                        <queryAttribute>Name</queryAttribute>
35                    </contextAttrHydrationDetails>
36                    <contextAttribute>AccountName</contextAttribute>
37                    <contextInputAttributeName>AccountName</contextInputAttributeName>
38                </contextAttributeMappings>
39                <contextAttributeMappings>
40                    <contextAttrHydrationDetails>
41                        <objectName>Account</objectName>
42                        <queryAttribute>CustomAccountName__c</queryAttribute>
43                    </contextAttrHydrationDetails>
44                    <contextAttribute>CustomAccountName</contextAttribute>
45                    <contextInputAttributeName>CustomAccountName</contextInputAttributeName>
46                </contextAttributeMappings>
47                <contextNode>SampleContextNode</contextNode>
48                <object>Account</object>
49            </contextNodeMappings>
50            <description>Account Mapping</description>
51            <default>false</default>
52            <title>AccountMapping</title>
53        </contextMappings>
54        <contextNodes>
55            <contextAttributes>
56                <contextTags>
57                    <title>AccountName</title>
58                </contextTags>
59                <dataType>string</dataType>
60                <fieldType>inputoutput</fieldType>
61                <key>false</key>
62                <title>AccountName</title>
63                <value>false</value>
64            </contextAttributes>
65            <contextAttributes>
66                <dataType>string</dataType>
67                <fieldType>inputoutput</fieldType>
68                <key>false</key>
69                <title>CustomAccountName</title>
70                <value>false</value>
71            </contextAttributes>
72            <contextTags>
73                <title>SampleContextTag</title>
74            </contextTags>
75            <title>SampleContextNode</title>
76            <transposable>false</transposable>
77        </contextNodes>
78        <endDate>2097-05-10 00:00:00</endDate>
79        <startDate>2023-05-10 00:00:00</startDate>
80        <versionNumber>1</versionNumber>
81        <isActive>true</isActive>
82    </contextDefinitionVersions>
83    <description>Sample Description</description>
84    <contextTtl>10</contextTtl>
85    <isProtected>false</isProtected>
86    <masterLabel>Sample Label</masterLabel>
87    <title>Sample Title</title>
88</ContextDefinition>

The following is an example package.xml that references the previous definition.

1<Package xmlns="http://soap.sforce.com/2006/04/metadata">
2    <types>
3        <members>Test</members>
4        <name>ContextDefinition</name>
5    </types>
6    <types>
7        <members>Account.CustomAccountName__c</members>
8        <name>CustomField</name>
9    </types>
10    <types>
11        <members>CustomAccount__c</members>
12        <name>CustomObject</name>
13    </types>
14    <version>59.0</version>
15</Package>

Wildcard Support in the Manifest File

This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.