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

Input Type Description
contextDefinitionName String Required

The API name of the context definition to get the data.

contextMappingName String 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 String The API name of the root context node if it isn't the same as the context object API name.
contextNodesDataLimit Integer The maximum number of records to retrieve.
contextNodesSortFieldName String The field name that’s used to sort the data.
contextNodesSortIsAscending Boolean The checkbox to sort the context nodes in ‌ascending order.
contextRecordId String Required

The ID of the context record associated with the context object name that’s used to hydrate the data.

contextObjectName String 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 Integer The lookback period in weeks from the current date for fetching the data.

Outputs

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

Example

GET

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


{
  "inputs": [
    {
      "contextDefinitionName": "AccountOpportunity__stdctx",
      "contextMappingName": "AccountOpportunityMappings",
      "contextId": "02ixx0000005yLxxAI",
      "contextObjectName": "Account"
    }
  ]
}

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


{
  "Account": [
    {
      "AccountName": "Acme",
      "Opportunity": [
        {
          "CreatedDate": "2025-01-20T00:00:00.000+0000",
          "ParentReference": "001xx00000pfHIsxxM",
          "OpportunityName": "Acme - 600 Widgets",
          "OpportunityStage": "Needs Analysis",
          "OpportunityCloseDate": "2023-01-03T00:00:00.000+0000"
        },
        {
          "CreatedDate": "2025-01-20T00:00:00.000+0000",
          "ParentReference": "001xx00000pfHIsxxM",
          "OpportunityName": "Acme - 1,200 Widgets",
          "OpportunityStage": "Value Proposition",
          "OpportunityCloseDate": "2022-11-07T00:00:00.000+0000"
        },
        {
          "CreatedDate": "2025-01-20T00:00:00.000+0000",
          "ParentReference": "001xx00000pfHIsxxM",
          "OpportunityName": "Acme - 200 Widgets",
          "OpportunityStage": "Prospecting",
          "OpportunityCloseDate": "2023-03-08T00:00:00.000+0000"
        }
      ]
    }
  ]
}