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/vXX.X/actions/custom/contextDataProvider/DefaultContextDataProvider

Where XX.X is the latest API version.

Formats: JSON, XML

HTTP Methods: GET

Authentication: Authorization: Bearer TOKEN

Where TOKEN is your OAuth access token.

Inputs 

InputTypeDescription
contextDefinitionNameStringRequired
The API name of the context definition to get the data.
contextMappingNameStringThe 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.
contextNodeApiNameStringThe API name of the root context node if it isn’t the same as the context object API name.
contextNodesDataLimitIntegerThe maximum number of records to retrieve.
contextNodesSortFieldNameStringThe field name that’s used to sort the data.
contextNodesSortIsAscendingBooleanThe checkbox to sort the context nodes in ‌ascending order.
contextRecordIdStringRequired
The ID of the context record associated with the context object name that’s used to hydrate the data.
contextObjectNameStringRequired
The API name of the standard object or a Data Cloud object that’s associated with the root context node in the context mapping.
timePeriodInWeeksIntegerThe lookback period in weeks from the current date for fetching the data.

Outputs 

OutputTypeDescription
contextDataStringThe data retrieved from a context service.

Example 

GET

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

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

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

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