How to
Adding email and SMS message previews
Overview
The package ships two LWC components for rendering Message__c records and a pre-built record page that wires them together. After installation, one manual activation step is required before they become visible to users.
Included Components
Email Message Renderer (Pendula4E__emailMessageRenderer)
Renders email messages stored on Message__c records. Displays:
- Subject, From, To, and Reply-To addresses
- Message timestamp and delivery status badge (delivered, opened, sent, failed)
- HTML email body with automatic XSS sanitization via
lightning-formatted-rich-text - Toggle between HTML and plain text views
Target: lightning__RecordPage on Message__c only
SMS Message Renderer (Pendula4E__smsMessageRenderer)
Renders SMS messages stored on Message__c records. Displays:
- Inbound and outbound messages as styled chat bubbles
- Error details for failed message deliveries
Target: lightning__RecordPage on Message__c only
Included Record Page
Message Record Page (Message_Record_Page)
A pre-built Lightning record page for the Message__c object. Layout:
| Tab | Content | Visibility condition |
|---|---|---|
| Email Preview | emailMessageRenderer | Channel__c = 'Email' |
| SMS Preview | smsMessageRenderer | Channel__c = 'SMS' |
| Details | Standard detail panel | Always |
| Related | Standard related lists | Always |
| Activity | Activity panel (default active) | Always |
The Email Preview and SMS Preview tabs are conditionally shown based on the record's Channel__c field, so only the relevant renderer is visible for a given message.
Activation Steps
1. Activate the record page in Lightning App Builder (required)
The Message_Record_Page flexipage is deployed with the package but is not automatically assigned. It must be activated manually:
- Go to Setup → User Interface → Lightning App Builder
- Locate Message Record Page in the list
- Click Edit, then click Activation...
- Choose the assignment scope:
- Org Default — applies to all users viewing
Message__crecords - App Default — restricts to a specific Lightning app
- App, Record Type, and Profile — for fine-grained control
- Org Default — applies to all users viewing
- Save the activation
Until this step is completed, Salesforce uses the system default record page and neither renderer will appear.
2. Post-install handler (automatic — no action required)
On a fresh install, the PostInstallHandlerV2 Apex class automatically creates the default Settings__c custom settings record for the org. This requires no manual action.
3. Configure CSP Trusted Sites for external email images (conditional)
Salesforce's Content Security Policy blocks externally hosted images by default. If Message__c records contain email bodies with <img src="https://..."> URLs from external domains, those images will not render until the domains are trusted.
To enable external image display:
- Go to Setup → Security → CSP Trusted Sites
- Click New Trusted Site
- Enter a name and the image domain (e.g.
https://images.example.com) - Enable the Connect directive
- Save, then refresh the Message record page
Image format support:
| Format | Works without CSP config? |
|---|---|
Base64 data URIs (data:image/png;base64,...) | Yes |
| HTTPS URLs from a CSP Trusted Site | Yes (after configuration) |
| External HTTPS URLs without CSP config | No |
| HTTP URLs | No (blocked by Salesforce) |
If CSP configuration is not desired, images can be converted to base64 data URIs in Apex before the Message__c record is created or updated, which requires no CSP changes.
Adding Renderers to a Custom Record Page
If the included Message_Record_Page is not used, both components can be placed manually on any Message__c record page via Lightning App Builder:
- Open the target record page in Setup → Lightning App Builder
- In the component panel, search for Email Message Renderer or SMS Message Renderer (under the Pendula4E namespace)
- Drag the component to the desired region
- Optionally add a visibility rule on
Channel__cto show only the relevant renderer - Save and activate the page