Configure a Content Selector From Scratch

If you prefer to create your own content selector for Salesforce CMS that connects an external content system, these are the main steps involved.

  1. Define the DgtAssetMgmtProvider type, which provides basic provider information.
  2. Create a LightningComponentBundle that implements a user interface for the external content provider in the CMS content editor.
  3. Configure the DgtAssetMgmtPrvdLghtCpnt type, which links the external provider to the component.
  4. Set up DgtAssetMgmtProviderInstance for the runtime configuration. See CMS Digital Asset Management Providers in the Connect REST API Developer Guide.
  5. Deploy and test the complete integration.

To create a provider instance, you can use Apex code. You can create multiple provider instances, each using its own URL and Lightning web component, but there can be only one default instance.

In this Apex example:

  • Replace yourProviderLabel with the name of your provider’s label.
  • Replace the value assigned to input.namewith the name of your instance.
  • Replace the value assigned to input.instanceUrl with the URL of your instance.

A JSON object with the following context property shape is set on the custom Lightning component instance when created from the component definition.

NameValuePreview Available
AudioAUDIOYes
DocumentDOCUMENTNo
ImageIMAGEYes
VideoVIDEOYes
PropertyTypeDescriptionConstraints
spaceIdstringCMS Enhanced Workspace IDStandard 18 characters
mediaTypestringRequested media typeOne of Media Type values
instanceKeystringA key that uniquely identifies the Digital Asset Provider instanceMax 255 characters
isBuilderbooleanIndicator to determine whether the context is launched from Experience Builder

When the user selects an external asset, your custom Lightning web component must fire an assetselected event with a payload that can be associated with the CMS content item, such as in this example.

EventPropertyTypeRequiredConstraints
assetselectedurlstringYesMax 2000 chars.
contentInfo.titlestringYesMax 255 chars
contentInfo.altTextstringNoMax 255 chars
contentInfo.externalIdstringNoMax 255 chars. Every asset click will be treated as new content if externalId is not provided.
contentInfo.urlNamestringNoMax 255 chars, alphanumeric content slug with lowercase letters, and without spaces (use hyphen instead). Will be derived from title if not provided