---
schema_version: "1"
id: 3d249152b31b5312b5707fa07a660e8fea9ae700e6e99e0bf4f7e35187e06a73
title: Data Sources in Marketing Cloud Next
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/handlebars/guide/mcn-handlebars-guide-data-sources.md
canonical_url: https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/guide/mcn-handlebars-guide-data-sources.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: ca687e38fa87d8809ab07e8d68da99f7878568bbb99cd8be88f8e14d1c5a5ea9
products:
  - Handlebars for Marketing Cloud Next
  - Marketing Cloud
---
# Data Sources in Marketing Cloud Next

In Marketing Cloud Next, you can use several sources of data to create your messages. Each of these sources operates differently.

## Custom Data Sources

Custom data sources are data sources that you create yourself. For more information about creating a data source, see _Salesforce Help_: [Data Source Configuration in Data 360](https://help.salesforce.com/s/articleView?id=data.c360_a_connection_tasks.htm).

| Data Source Type   | Description                                                                                                                                          | Limitations                                                           |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| Profile Data Graph | Data provided from a data graph based on the Unified Individual object. This type of data source is helpful for storing personalization data.        | Your account can use only one data graph at a time.                   |
| Activation         | Data provided from an Activation set up in Data 360. This type of data source provides an Activation payload, which can be used for personalization. | A message can use only one event or activation data source at a time. |
| Event              | Data provided from an event definition in Marketing Cloud Next. A flow passes event data to the content. Each event has its own schema.              | A message can use only one event or activation data source at a time. |
| Apex Class         | Data provided from an Apex-defined resource and its schema.                                                                                          | A message can use only one Apex Class data source at a time.          |

### Profile Data Graph

One of the primary data sources in Marketing Cloud Next is the data graph. For more information, see [Understanding Data Graphs in Marketing Cloud Next](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/guide/mcn-handlebars-guide-data-graph-understanding.md).

### Activation

An alternative to building a message by using data from a data graph is to use activation data. Activations occur when a segmentation action occurs in Data 360, which creates an enriched list of recipients for a campaign with nested attributes for each recipient. This example shows an activation payload for a recipient.

```json
{
  "TitleName": "",
  "PersonName": "Erica Douglass",
  "FirstName": "Erica",
  "Id": "7471ce0c3b44998ffb8342eabdf2c02b",
  "LastName": "Douglass",
  "EmailAddress": "erica.douglass@example.com",
  "BookStoreProfile": [
    {
      "LoyaltyTier": "Bronze",
      "RewardPoints": 80.0,
      "Locale": "de-DE",
      "MemberId": "003Ws00000QxpYzIAJ",
      "FavoriteGenre": "Fantasy",
      "LastVisitedStoreId": "2121",
      "BookStore": [
        {
          "StoreHoursDays": "Mon - Sun",
          "StoreHoursTime": "8am - 8pm",
          "StoreId": "2121",
          "StoreAddress": "331 Town Square Drive, Decatur GA, 30012",
          "StoreName": "RL at Town Square",
          "BookStoreEvent": [
            {
              "EventDate": "2026-07-15T20:00:00.000Z",
              "EventDescription": "Monthly book club for young adults",
              "EventName": "Young Adult Book Club"
            },
            {
              "EventDate": "2026-07-20T19:00:00.000Z",
              "EventDescription": "Lively storytelling for the little ones!",
              "EventName": "Weekly Storytime"
            },
            {
              "EventDate": "2026-07-22T20:00:00.000Z",
              "EventDescription": "Guest visit from an author",
              "EventName": "Monthly Author Visit"
            }
          ]
        }
      ]
    }
  ]
}
```

You give the activation a name when you create it. This example uses the name `NewsletterRecipient`. Access the data by using the name that you gave the activation, followed by the path to the data you want to access. For example, to output the recipient's first name, use this code:

```handlebars
{{NewsletterRecipient.FirstName}}
```

**important:** The same message can’t have both an activation data source and an event data source.

### Event

Events are a type of data source that binds data to an automation event-triggered flow. When you create a data source from the event list, you can select from several built-in and custom event options. Each event has a schema that ties back to the underlying engagement data model object (DMO) that drives the event itself. Similar to an activation, use the name you give the event to reference it in your message template.

**important:** The same message can’t have both an activation data source and an event data source.

### Apex Class

Apex-defined data sources use an Apex class that represents an incoming JSON payload. This data source defines an incoming JSON structure. See _Salesforce Help_: [Create Apex-Defined Type](https://help.salesforce.com/s/articleView?language=en_US&id=platform.flow_concepts_apex_type.htm).

In transactional emails, it’s helpful for the incoming data to be simple and easy to use. You can use an Apex class to define the structure of the JSON payload, as shown in this example.

```java
public class BookingConfirmationPayload {
    @AuraEnabled
    public String IndividualId;

    @AuraEnabled
    public String ReservationID;

    @AuraEnabled
    public String FirstName;

    @AuraEnabled
    public String LastName;

    @AuraEnabled
    public String HotelName;

    @AuraEnabled
    public String HotelAddress;

    @AuraEnabled
    public String HotelPhone;

    @AuraEnabled
    public Date CheckInDate;

    @AuraEnabled
    public Date CheckOutDate;

    @AuraEnabled
    public String RoomType;

    @AuraEnabled
    public Number GuestCount;
}
```

This class definition produces a JSON payload with a structure that resembles this example.

```json
{
  "Booking": {
    "IndividualId": "003Ws00000QxiFnIAJ",
    "ReservationID": "0023AB",
    "FirstName": "Erica",
    "LastName": "Douglass",
    "HotelName": "The Hornet of Chicago",
    "HotelAddress": "320 N Dearborn St, Chicago, IL 60660",
    "HotelPhone": "(312) 555-7200",
    "CheckInDate": "2026-02-06",
    "CheckOutDate": "2026-02-09",
    "RoomType": "Traditional Guest Room",
    "GuestCount": "1"
  }
}
```

When you load this data source into a content item, you give it a name, such as `Booking`. Reference the fields in the payload by using the name that you gave the data source, followed by the path to the data you want to access. For example, to output the recipient’s first name, use this code:

```handlebars
{{Booking.FirstName}}
```

## Built-in Data Sources

Marketing Cloud Next includes a few built-in data sources, which have specific reserved names.

| Data Source                      | Description                                                         |
| -------------------------------- | ------------------------------------------------------------------- |
| `{!$organization.Address}`       | The physical address of the organization that is sending the email. |
| `{!$link.EmailAddressOptOutUrl}` | The URL for the recipient to unsubscribe from the email.            |
| `{!$link.PreferenceCenterUrl}`   | The URL for the recipient to manage their email preferences.        |

## Other Data Sources

You can connect several other data sources to your content. For more information about other data sources, see _Salesforce Help_: [Data Sources in Marketing Cloud Next](https://help.salesforce.com/s/articleView?id=mktg.mktg_content_personalization_data_sources.htm).
