Newer Version Available

This content describes an older version of this product. View Latest

CMSConnectSource

Represents the connection information for external content management systems that feed content to Communities. This type extends the Metadata metadata type and inherits its fullName field.

For use with Change Sets, CMSConnectSource is a dependent of Network and Community.

Note

File Suffix and Directory Location

CMSConnectSource components have the suffix .cmsConnectSource and are stored in the cmsConnectSource folder. In that folder, separate files exist for each network (for example, networkname.sourcedevelopername.cmsConnectSource). Each file represents a CMS connection.

Version

CMSConnectSource components are available in API version 43.0 and later.

Special Access Rules

The CMS Connect org permission must be enabled.

Fields

Field Name Field Type Description
cmsConnectAsset CMSConnectAsset[] Represents CSS or JavaScript defined for the connection.
  • 0–10 for CSS
  • 0–10 for JavaScript
cmsConnectLanguage CMSConnectLanguage[] 0 to more. Represents language mappings defined for the connection.
cmsConnectPersonalization CMSConnectPersonalization[] 0 or 1. This represents personalization defined for the connection. Only for use when type is AEM.
cmsConnectResourceType CMSConnectResourceType[] 0–5. This represents JSON definitions defined for the connection.
connectionType CMSSourceConnectionType(enumeration of type string) Required. Type of authentication being used with outside system. Valid values are:
  • Public
  • Authenticated
cssScope string The class name used to prefix and scope the CSS rules.
developerName string Required. API name of the CMSConnectSource entity.
languageEnabled string Required. Valid values are:
  • Y to enable language mapping for connection.
  • N if no language mapping is needed.
masterLabel string Required. Connection name
namedCredential string Required when the connectionType is Authenticated. API name of namedCredential. Before deploying namedCredential, it must exist on the destination org.
personalizationEnabled string Required. Valid values are:
  • Y to enable personalization mapping for connection.
  • Otherwise N.
rootPath string Required. Root path.
sortOrder int Required. Defines the load order of the connection when multiple connections defined on page. The load order begins with 1.
status CMSConnectionStatus(enumeration of type string) Required. Status of connection. Valid values are:
  • ACTIVE
  • INACTIVE
type CMSConnectionSourceType(enumeration of type string) Required. The identification of the source connection system. Valid values are:
  • AEM
  • Drupal
  • WordPress
  • SDL
  • Sitecore
  • Other
websiteUrl string Required if connectionType is Public

Because there may be existing connections when a package comes in, there is some INSERT or UPDATE logic that should be taken into account:

  • If developerName is found in the destination, then update the existing collection with all details form source.
  • namedCredential is handled through developerName. If namedCredential with developerName is not found, then an error is generated.
  • If sortOrder from the source is not in the destination, then insert/update with the source sortOrder.
  • If sortOrder from the source is already in the destination, then increase the source sortOrder by 1 for connections such that the destination sortOrder > sortOrder from the source.

Note

CMSConnectAsset

CMSConnectAsset defines the location, types, and order of assets necessary to support the incoming content, such as JavaScript and CSS files.

Because there may be existing connections when a package comes in, there is some INSERT or UPDATE logic that should be taken into account:

  • If assetPath exists in the destination, then update the existing record, else the new assetPath will be inserted.
  • Always keep the sortOrder from the source and adjust the destination accordingly.

Note

Field Name Field Type Description
assetPath string Relative path of the asset.
assetType string

When used in Apex, this can be sent as an enum, otherwise, this has a field type of string.

Allowed values as string
  • CSS
  • Javascript

Allowed values as enum

  • CSS
  • Javascript
sortOrder int Loading sequence on the page.

CMSConnectLanguage

CMSConnectLanguage components determine the presented language of the content.

Field Name Field Type Description
cmsLanguage string When a language placeholder is in the URL path, this value is used to replace it.
language string Salesforce supported language.

CMSConnectPersonalization

CMSConnectPersonalization is only used in conjunction with Adobe Experience Manager (AEM).

Because there may be existing connections when a package comes in, there is some INSERT or UPDATE logic that should be taken into account. If personalization is not enabled in the source system, but it is enabled in the destination, the destination is disabled. The record for the connection is deleted from the table.

Note

Field Name Field Type Description
connectorPage string The path to the JSP file that you created and installed in AEM.
connectorPageAsset string The path to your Javascript file. Providing this path allows you to run scripts dynamically.

CMSConnectResourceType

CMSConnectResourceType is for use only to define JSON connections.

Because there may be existing connections when a package comes in, there is some INSERT or UPDATE logic that should be taken into account. If the developer name was found in the destination, then update the existing record with all details from the source.

Note

Field Name Field Type Description
cmsConnectResourceDefinition cmsConnectResourceDefinition[] 0–10 allowed per CMSConnectResourceType.
developerName string API name of CMSConnectResourceType.
masterLabel string Content type name.
resourceType string The only allowed value is JSON.

CMSConnectResourceDefinition

cmsConnectResourceDefinition is used to define JSON connections.

Because there may be existing connections when a package comes in, there is some INSERT or UPDATE logic that should be taken into account:

  • If developerName is found in the destination, then the existing record is updated with all details from the new source, else the new value is inserted.
  • If the current source is DETAIL and the destination has DETAIL with a different name, then the destination is updated to LIST and the source inserted as DETAIL.

Note

Field Name Field Type Description
developerName string Required. API name of CMSConnectResourceDefinition.
masterLabel string Required. developerName of Content Item or Content List.
options int Required. Identifies whether the content from the external source is a single item or a list.

0 for Content List

1 for Content Item

payloadType string Required. The only valid value is JSON.
resourceIdPath string Relative path to ID. Required for Content Item.
resourceNamePath string Relative path to resource name. Required for Content Item.
resourcePath string Required. JSON resource path.
rootNodePath string Only for Content List and collection. Defines the initial starting path for a collection or list.

Declarative Metadata Sample Definition

The following is an example of a CMSConnectSource definition.

1<?xml version="1.0" encoding="UTF-8"?>
2<CMSConnectSource xmlns="http://soap.sforce.com/2006/04/metadata">
3    <cmsConnectAsset>
4        <assetPath>etc/designs/capricorn/app-prefixed.min.css</assetPath>
5        <assetType>CSS</assetType>
6        <sortOrder>1</sortOrder>
7    </cmsConnectAsset>
8    <cmsConnectAsset>
9        <assetPath>etc/designs/capricorn/w3data.js</assetPath>
10        <assetType>Javascript</assetType>
11        <sortOrder>1</sortOrder>
12    </cmsConnectAsset>
13    <cmsConnectLanguage>
14        <cmsLanguage>en</cmsLanguage>
15        <language>en_US</language>
16    </cmsConnectLanguage>
17    <cmsConnectLanguage>
18        <cmsLanguage>fr</cmsLanguage>
19        <language>fr</language>
20    </cmsConnectLanguage>
21    <cmsConnectPersonalization>
22        <connectorPage>content/salesforceConnector.js</connectorPage>
23        <connectorPageAsset>content/js/capricorn/assets.js</connectorPageAsset>
24    </cmsConnectPersonalization>
25    <cmsConnectResourceType>
26        <cmsConnectResourceDefinition>
27            <developerName>Details</developerName>
28            <masterLabel>Details</masterLabel>
29            <options>0</options>
30            <payloadType>JSON</payloadType>
31            <resourceIdPath>ID</resourceIdPath>
32            <resourceNamePath>title</resourceNamePath>
33            <resourcePath>rest/v1.1/sites/cmstry.wordpress.com/posts/{component}</resourcePath>
34        </cmsConnectResourceDefinition>
35        <cmsConnectResourceDefinition>
36            <developerName>List</developerName>
37            <masterLabel>List</masterLabel>
38            <options>1</options>
39            <payloadType>JSON</payloadType>
40            <resourcePath>rest/v1.1/sites/cmstry.blog.wordpress.com/posts?number={itemsPerPage}&amp;page={pageNumber}</resourcePath>
41        </cmsConnectResourceDefinition>
42        <developerName>Posts</developerName>
43        <masterLabel>Posts</masterLabel>
44        <resourceType>JSON</resourceType>
45    </cmsConnectResourceType>
46    <connectionType>Public</connectionType>
47    <cssScope>capricorn</cssScope>
48    <developerName>Capricorn</developerName>
49    <languageEnabled>Y</languageEnabled>
50    <masterLabel>Capricorn</masterLabel>
51    <personalizationEnabled>Y</personalizationEnabled>
52    <rootPath>content/capricorn/{language}</rootPath>
53    <sortOrder>11</sortOrder>
54    <status>ACTIVE</status>
55    <type>AEM</type>
56    <websiteUrl>https://public-api.wordpress.com</websiteUrl>
57</CMSConnectSource>

The following is an example package.xml.

1<Package xmlns="http://soap.sforce.com/2006/04/metadata">
2    <types>
3        <members>NetworkA.*</members>
4        <name>CMSConnectSource</name>
5    </types>
6    <version>43.0</version>
7</Package>

To retrieve a specific connection:

1<Package xmlns="http://soap.sforce.com/2006/04/metadata">
2    <types>
3        <members>NetworkA.DeveloperName</members>
4        <name>CMSConnectSource</name>
5    </types>
6    <version>43.0</version>
7</Package>

Usage

The INSERT or UPDATE logic for the incoming information is always UPSERT. If data is not in the entity, then it is inserted, otherwise the current data is updated.

Before doing upsert, the content from the package is validated against the maximum limits for the following:

  • CSS assets <= 10
  • JavaScript assets <= 10
  • Resource types < =5
  • Resource definitions for each type <=10

For example

  1. The validation on a new connection only totals the elements in the incoming package.
  2. Validation of existing connections totals the existing assets and new elements to assess validity. For example, if a connection on the destination org already has six CSS definitions, and the incoming package has defined seven CSS definitions (four new + three existing). The new total will be the six current from the database, ignoring the three repeated in the package, and adds four new definitions from the incoming package, totaling 10 definitions, which is at or below the 10 asset threshold and it passes validation.

Refer below for more details for each entity how is handled while saving the details from package to destination org:

Type Description
CMSConnectSource
  • If developerName is found in the destination, then update the existing collection with all details form source.
  • namedCredential is handled through developerName. If namedCredential with developerName is not found, then an error is generated.
  • If sortOrder from the source is not in the destination, then insert/update with the source sortOrder.
  • If sortOrder from the source is already in the destination, then increase the source sortOrder by 1 for connections such that the destination sortOrder > sortOrder from the source.
CMSConnectAsset
  • If assetPath exists in the destination, then update the existing record, else the new assetPath will be inserted.
  • Always keep the sortOrder from the source and adjust the destination accordingly.
CMSConnectPersonalization If personalization is not enabled in the source system, but it is enabled in the destination, the destination is disabled. The record for the connection is deleted from the table.
CMSConnectResourceType If the developer name was found in the destination, then update the existing record with all details from the source.
CMSConnectResourceDefinition
  • If developerName is found in the destination, then the existing record is updated with all details from the new source, else the new value is inserted.
  • If the current source is DETAIL and the destination has DETAIL with a different name, then the destination is updated to LIST and the source inserted as DETAIL.