Loading
Upcoming Mandatory Changes to Public Key Infrastructure (PKI)Read More
Salesforce Enforces New Security Requirements in Summer 2026Read More
Marketing Cloud Next
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Extend Preview and Test in Marketing Cloud Next

          Extend Preview and Test in Marketing Cloud Next

          Preview and Test is a built-in feature in Marketing Cloud Next for reviewing your message content before sending. From the Preview and Test modal, you can see how your email, SMS, or WhatsApp message appears to recipients, personalize the preview with specific segment members, and validate merge fields. The modal includes dedicated tabs for previewing rendered content and running test sends.

          Required Editions

          Available in: Salesforce Enterprise and Unlimited Editions with Marketing Cloud Next Growth or Advanced Edition, and in Starter and Pro Suite Editions. Your edition determines the options that you have.
          User Permissions Needed
          To preview and test content: Marketing Cloud Manager permission set AND any CMS workspace contributor role

          You can extend Preview and Test by adding custom tabs to the modal. Each custom tab is powered by a Lightning Web Component (LWC) that you build and deploy to your org. The tab receives live preview data, including channel type, content, and merge field values, so you can build custom validation tools, rendering previews, or integration checks directly in the Preview and Test experience.

          The extension mechanism is based on a metadata type UiPreviewMessageTabDef. When you create and activate a UiPreviewMessageTabDef record, your custom tab appears alongside the standard Preview and Test tabs in the modal.

          • Understand the previewData Object
            Your custom LWC receives a previewData object that contains contextual information about the message being previewed. The fields available in previewData vary by channel.

          Step 1: Create and Deploy a Lightning Web Component

          Create an LWC and deploy it to your org. The component provides the content that appears in your custom tab. Use the directory structure and file contents specified in the procedure.

          1. Create a directory structure for your component:
            
            lwc/
              customTab/
                customTab.html
                customTab.js
                customTab.js-meta.xml
            package.xml
            
          2. Add this markup to customTab.html:
            
            <template>
              <div style="padding: 20px;">
                <div>This content appears in the custom tab.</div>
                <div>previewData.channelType: {previewData.channelType}</div>
                <div>previewData.content: {previewData.content}</div>
                <div>previewData.contentKey: {previewData.contentKey}</div>
                <div>previewData.emailSubject: {previewData.emailSubject}</div>
                <div>previewData.emailPreheader: {previewData.emailPreheader}</div>
              </div>
            </template>
            
          3. Add this code to customTab.js:
            
            import { LightningElement, api } from "lwc";
            export default class CustomTab extends LightningElement {
                @api previewData;
            }
            
          4. Add this metadata to customTab.js-meta.xml:
            <?xml version="1.0" encoding="UTF-8"?>
            <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
                <apiVersion>64.0</apiVersion>
                <isExposed>true</isExposed>
                <capabilities>
                    <capability>lightning__dynamicComponent</capability>
                </capabilities>
            </LightningComponentBundle>
                 
          5. Add this content to package.xml:
            
            <?xml version="1.0" encoding="UTF-8"?>
            <Package xmlns="http://soap.sforce.com/2006/04/metadata">
                <types>
                    <members>*</members>
                    <name>LightningComponentBundle</name>
                </types>
                <version>64.0</version>
            </Package>
            
          6. Deploy the component to your org.

          Step 2: Create a UiPreviewMessageTabDef Entry

          After you deploy your LWC, create a UiPreviewMessageTabDef record to register your custom tab.

          1. In your org, click the setup icon and select Developer Console.
          2. In the Developer Console, click the Query Editor tab.
          3. At the bottom of the Query Editor, select the Use Tooling API checkbox.
          4. Enter the following query, and then click Execute:
            SELECT Id, DeveloperName, TabName, IsActive, SupportedChannel, LightningComponentDefId
            FROM UiPreviewMessageTabDef
            
          5. Click Insert Row and provide values for each required field. For field descriptions, see UiPreviewMessageTabDef.
          6. To get the ID of the LWC you deployed, run the following query in the Query Editor:
            SELECT Id, DeveloperName, IsExposed, NamespacePrefix
            FROM LightningComponentBundle
            WHERE IsExposed = true
            
          7. Copy the Id value from your component and enter it in the LightningComponentDefId field.
          8. Click Save Rows.

          After you save the UiPreviewMessageTabDef record with IsActive set to true, your custom tab appears in the Preview and Test modal next to the standard Preview and Test tabs. The previewData object passed to your component updates automatically when the preview context changes, such as when a user selects a different segment member or switches between personalized and non-personalized views.

          Step 3: Package your Extension

          To distribute your Preview and Test extension through AppExchange, include both the LightningComponentBundle and UiPreviewMessageTabDef records in your managed package.

          Users who install your package can control whether the custom tab appears in their Preview and Test modal by modifying the IsActive field on the installed UiPreviewMessageTabDef record.

           
          Loading
          Salesforce Help | Article