> For the complete documentation index, see [llms.txt](https://docs.omnata.com/omnata-product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.omnata.com/omnata-product-documentation/omnata-sync-for-snowflake/apps/sfmc.md).

# Salesforce Marketing Cloud

## Authentication methods

Marketing Cloud uses a complicated mix of credentials and keys, depending on which features you use:

[OAuth for APIs, SFTP for file transfer with GPG on outbound](/omnata-product-documentation/omnata-sync-for-snowflake/apps/sfmc/oauth-for-apis-ssh-for-sftp-and-gpg-payload-encryption.md)

[OAuth for APIs, SFTP for file transfer](/omnata-product-documentation/omnata-sync-for-snowflake/apps/sfmc/oauth-for-apis-ssh-for-sftp-without-payload-encryption.md)

[OAuth for APIs, Cloud Storage for file transfer](/omnata-product-documentation/omnata-sync-for-snowflake/apps/sfmc/oauth-for-apis-ssh-for-sftp-without-payload-encryption-1.md)

## Inbound Syncs

The following are available as inbound streams:

* Data Extensions (Full Refresh only)
* Journey History (Incremental only, beginning 30 days prior to sync start)

## Outbound Syncs

### Supported Targets

* Data Extensions

### Supported Sync Strategies

<table><thead><tr><th width="168.12890625">Strategy</th><th>SFMC ImportDefinitionUpdateType</th></tr></thead><tbody><tr><td>Create</td><td><strong>AddAndDoNotUpdate</strong></td></tr><tr><td>Upsert</td><td><strong>AddAndUpdate</strong></td></tr><tr><td>Replace</td><td><strong>Overwrite</strong><br>Note that although Salesforce does not require a primary key for this operation, Omnata Sync Engine still requires one in order to properly track the full life cycle of records from the source table over time.</td></tr><tr><td>Mirror</td><td><strong>AddAndUpdate</strong> if no deletes, otherwise <strong>ColumnBased</strong></td></tr></tbody></table>

These operations are described [here](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitionupdatetype.html).

## Functions

### CREATE\_OR\_UPDATE\_DATA\_EXTENSION

Creates a Data Extension in Salesforce Marketing Cloud if it does not exist, otherwise adds any missing fields and updates its properties.

Parameters:

* CONNECTION\_SLUG (VARCHAR): The slug of the connection
* EXTENSION\_NAME (VARCHAR): The name of the Data Extension
* EXTENSION\_CUSTOMER\_KEY (VARCHAR): The customer key to assign when creating the Data Extension
* EXTENSION\_FIELDS (ARRAY): The fields (columns) of the Data Extension. Each element is an object with at least Name and FieldType, plus optional MaxLength, Scale, IsPrimaryKey and IsRequired. The full set of field options are documented [here](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionfield.html).
* EXTENSION\_PROPERTIES (OBJECT): Additional Data Extension properties, e.g. IsSendable, SendableSubscriberField, SendableDataExtensionField. CategoryID is set from EXTENSION\_CATEGORY\_ID. The full set of field options are documented [here](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextension.html).
* EXTENSION\_CATEGORY\_ID (VARCHAR): The category (folder) ID to create the Data Extension in

Examples:

```sql
select OMNATA_SALESFORCE_MARKETING_CLOUD_PLUGIN.UDFS.CREATE_OR_UPDATE_DATA_EXTENSION(
   CONNECTION_SLUG=>'my-smfc-connection',
   EXTENSION_NAME=>'Test DE',
   EXTENSION_CUSTOMER_KEY=>'test-de',
   EXTENSION_FIELDS=>[
    {
      'Name': 'Field 1',
      'FieldType': 'Text',
      'MaxLength': 25,
      'IsPrimaryKey': true,
      'IsRequired': true
    },
    {
      'Name': 'Field 2',
      'FieldType': 'Number',
      'MaxLength': 25,
      'Scale': 5,
      'IsRequired': false
    }
   ],
  EXTENSION_PROPERTIES => {
    'IsSendable': false
  },
  EXTENSION_CATEGORY_ID => 0
);
```

### FETCH\_DATA\_EXTENSIONS

Fetches a list of Data Extensions.

Parameters:

* CONNECTION\_SLUG (VARCHAR): The slug of the connection

Examples:

```sql
select *
from table(OMNATA_SALESFORCE_MARKETING_CLOUD_PLUGIN.UDFS.FETCH_DATA_EXTENSIONS(
                'my-sfmc-connection'));
```

### FETCH\_DATA\_EXTENSION\_RECORDS

Fetches records from a Data Extension.

Note that currently this function requires a connection method with FTP credentials.

Parameters:

* CONNECTION\_SLUG (VARCHAR): The slug of the connection
* DATA\_EXTENSION\_NAME (VARCHAR): The name of the data extension

Examples:

```
select *
from table(OMNATA_SALESFORCE_MARKETING_CLOUD_PLUGIN.UDFS.FETCH_DATA_EXTENSION_RECORDS(
                'my-sfmc-connection',
                'My Data Extension'));
```

### FETCH\_DATA\_EXTRACT\_DEFINITION

Fetches an individual data extract definition.

Parameters:

* CONNECTION\_SLUG (VARCHAR): The slug of the connection
* DEFINITION\_ID (VARCHAR): The ID of the data extract definition

Examples:

```
select OMNATA_SALESFORCE_MARKETING_CLOUD_PLUGIN.UDFS.FETCH_DATA_EXTRACT_DEFINITION(
                'my-sfmc-connection',
                'a1bcda25-8359-4c32-9876-452c530c196a');
```

### FETCH\_DATA\_EXTRACT\_DEFINITIONS

Fetches all data extract definitions.

Parameters:

* CONNECTION\_SLUG (VARCHAR): The slug of the connection

Examples:

```
select *
from table(OMNATA_SALESFORCE_MARKETING_CLOUD_PLUGIN.UDFS.FETCH_DATA_EXTRACT_DEFINITIONS(
                'my-sfmc-connection'));
```

### FETCH\_DATA\_EXTRACT\_TYPES

Fetches all data extract types.

Parameters:

* CONNECTION\_SLUG (VARCHAR): The slug of the connection

Examples:

```
select *
from table(OMNATA_SALESFORCE_MARKETING_CLOUD_PLUGIN.UDFS.FETCH_DATA_EXTRACT_TYPES(
                'my-sfmc-connection'));
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.omnata.com/omnata-product-documentation/omnata-sync-for-snowflake/apps/sfmc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
