---
schema_version: "1"
id: c646c4a72745595404881a46c9d7b9c5bf2df4620e6c7f0fefda20103147f9b5
title: Get Data Using Context Definition Action
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/health_cloud_object_reference/actions_obj_get_data_using_context_definition.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.health_cloud_object_reference.meta/health_cloud_object_reference/actions_obj_get_data_using_context_definition.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5b74a106674df0625c935bc9dc04951948d2dff54345121ce6403b2daace0766
description: Get data from a context service using a context definition and the associated context mapping.
---
# 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

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d304607e98">Input</th>

              <th class="featureTableHeader  " id="d304607e101">Type</th>

              <th class="featureTableHeader  " id="d304607e104">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d304607e98" data-title="Input">
                <span class="keyword parmname">contextDefinitionName</span>
              </td>

              <td class="entry" headers="d304607e101" data-title="Type">String</td>

              <td class="entry" headers="d304607e104" data-title="Description">Required<p class="p">The API name of the context definition to get the
                  data.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d304607e98" data-title="Input">
                <span class="keyword parmname">contextMappingName</span>
              </td>

              <td class="entry" headers="d304607e101" data-title="Type">String</td>

              <td class="entry" headers="d304607e104" data-title="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.</td>

            </tr>

            <tr>
              <td class="entry" headers="d304607e98" data-title="Input">
                <span class="keyword parmname">contextNodeApiName</span>
              </td>

              <td class="entry" headers="d304607e101" data-title="Type">String</td>

              <td class="entry" headers="d304607e104" data-title="Description">The API name of the root context node if it isn't the
                same as the context object API name.</td>

            </tr>

            <tr>
              <td class="entry" headers="d304607e98" data-title="Input">
                <span class="keyword parmname">contextNodesDataLimit</span>
              </td>

              <td class="entry" headers="d304607e101" data-title="Type">Integer</td>

              <td class="entry" headers="d304607e104" data-title="Description">The maximum number of records to retrieve.</td>

            </tr>

            <tr>
              <td class="entry" headers="d304607e98" data-title="Input"><span class="keyword parmname">contextNodesSortFieldName</span></td>

              <td class="entry" headers="d304607e101" data-title="Type">String</td>

              <td class="entry" headers="d304607e104" data-title="Description">The field name that’s used to sort the data.</td>

            </tr>

            <tr>
              <td class="entry" headers="d304607e98" data-title="Input"><span class="keyword parmname">contextNodesSortIsAscending</span></td>

              <td class="entry" headers="d304607e101" data-title="Type">Boolean</td>

              <td class="entry" headers="d304607e104" data-title="Description">The checkbox to sort the context nodes in ‌ascending
                order.</td>

            </tr>

            <tr>
              <td class="entry" headers="d304607e98" data-title="Input">
                <span class="keyword parmname">contextRecordId</span>
              </td>

              <td class="entry" headers="d304607e101" data-title="Type">String</td>

              <td class="entry" headers="d304607e104" data-title="Description">Required<p class="p">The ID of the context record associated with the context
                  object name that’s used to hydrate the data.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d304607e98" data-title="Input">
                <span class="keyword parmname">contextObjectName</span>
              </td>

              <td class="entry" headers="d304607e101" data-title="Type">String</td>

              <td class="entry" headers="d304607e104" data-title="Description">Required<p class="p">The API name of the standard object or a Data Cloud
                  object that’s associated with the root context node in
                  the context mapping.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d304607e98" data-title="Input">
                <span class="keyword parmname">timePeriodInWeeks</span>
              </td>

              <td class="entry" headers="d304607e101" data-title="Type">Integer</td>

              <td class="entry" headers="d304607e104" data-title="Description">The lookback period in weeks from the current date for
                fetching the data.</td>

            </tr>

          </tbody>

        </table>

## 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"
        }
      \]
    }
  \]
}