Get Data Using Context Definition Action

Get data from a context service using a context definition and the associated context mapping.

This action is available in API version 64.0 and later.

Supported REST HTTP Methods

URI
/services/data/v66.0/actions/custom/contextDataProvider/DefaultContextDataProvider
Formats
JSON, XML
HTTP Methods
GET
Authentication
Authorization: Bearer token

Inputs

Input Details
contextDefinitionName
Type
String
Description
Required
The API name of the context definition to get the data.
contextMappingName
Type
String
Description
The name of the context mapping that’s used to hydrate the data in the context definition. In the absence of a name, the default mapping name is used.
contextNodeApiName
Type
String
Description
The API name of the root context node if it isn't the same as the context object API name.
contextNodesDataLimit
Type
Integer
Description
The maximum number of records to retrieve.
contextNodesSortFieldName
Type
String
Description
The field name that’s used to sort the data.
contextNodesSortIsAscending
Type
Boolean
Description
The checkbox to sort the context nodes in ‌ascending order.
contextRecordId
Type
String
Description
Required
The ID of the context record associated with the context object name that’s used to hydrate the data.
contextObjectName
Type
String
Description
Required
The API name of the standard object or a Data Cloud object that’s associated with the root context node in the context mapping.
timePeriodInWeeks
Type
Integer
Description
The lookback period in weeks from the current date for fetching the data.

Outputs

Output Details
contextData
Type
String
Description
The data retrieved from a context service.

Example

GET

This sample request is for the Get Data using Context Definition action.

1
2{
3  "inputs": [
4    {
5      "contextDefinitionName": "AccountOpportunity__stdctx",
6      "contextMappingName": "AccountOpportunityMappings",
7      "contextId": "02ixx0000005yLxxAI",
8      "contextObjectName": "Account"
9    }
10  ]
11}

This sample response is for the Get Data using Context Definition action.

1
2{
3  "Account": [
4    {
5      "AccountName": "Acme",
6      "Opportunity": [
7        {
8          "CreatedDate": "2025-01-20T00:00:00.000+0000",
9          "ParentReference": "001xx00000pfHIsxxM",
10          "OpportunityName": "Acme - 600 Widgets",
11          "OpportunityStage": "Needs Analysis",
12          "OpportunityCloseDate": "2023-01-03T00:00:00.000+0000"
13        },
14        {
15          "CreatedDate": "2025-01-20T00:00:00.000+0000",
16          "ParentReference": "001xx00000pfHIsxxM",
17          "OpportunityName": "Acme - 1,200 Widgets",
18          "OpportunityStage": "Value Proposition",
19          "OpportunityCloseDate": "2022-11-07T00:00:00.000+0000"
20        },
21        {
22          "CreatedDate": "2025-01-20T00:00:00.000+0000",
23          "ParentReference": "001xx00000pfHIsxxM",
24          "OpportunityName": "Acme - 200 Widgets",
25          "OpportunityStage": "Prospecting",
26          "OpportunityCloseDate": "2023-03-08T00:00:00.000+0000"
27        }
28      ]
29    }
30  ]
31}