Configure Lightning web components for Context Panel#
To use a Lightning Web Component (LWC) with Revenue Grid, you need to configure it so it can be loaded in the Context Panel and receive data.
This guide walks you through the required configuration steps.
The examples in this guide use a sample component for illustration. Update component names, properties, and logic to match your implementation.
Prerequisites#
Before you begin, ensure the following:
A component is available in your Salesforce org (deployed and ready to use).
Revenue Grid is already set up and connected to your Salesforce org.
You have System Administrator permissions in Salesforce.
Configure the component#
Configure the Lightning web component so it can be used in the Context Panel and receive data:
Important
After updating the component, deploy the changes to your Salesforce org before proceeding with the integration steps.
Make the component available for Outlook and Gmail#
Update the component configuration file to make it available in email applications.
Add the
<target>lightning__Inbox</target>target.Set
<isExposed>totrue.
Example:
<?xml version="1.0" encoding="UTF-8" ?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<!-- Expose the component so it can be used in Lightning App Builder -->
<isExposed>true</isExposed>
<targets>
<!-- Optional targets for standard Lightning usage -->
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
<target>lightning__Tab</target>
<!-- Allows the component to be used in email side panels -->
<target>lightning__Inbox</target>
</targets>
<description>Item Properties</description>
</LightningComponentBundle>
Expose integration properties#
Declare public properties in your component to receive context data from Context Panel.
These properties provide information about the current email or event (for example, source, subject, or participants).
For the full list of supported properties, see the Lightning web components integration properties reference.
Example:
import { LightningElement, api } from 'lwc';
export default class ItemProperties extends LightningElement {
// Public properties exposed via @api receive context data from Revenue Grid.
// Replace or extend these properties based on your use case.
@api source;
@api mode;
}
You can use these properties in your template:
<template>
<div>
<!-- Example usage of context properties passed from Context Panel -->
<!-- Replace this markup with your component UI and logic -->
<p><b>Source:</b> {source}</p>
<p><b>Mode:</b> {mode}</p>
</div>
</template>
Make the component responsive to width#
Ensure the component adapts to the Context Panel layout.
Declare
flexipageRegionWidthas a public property:import { LightningElement, api } from "lwc"; export default class ItemProperties extends LightningElement { // Provided by the container (Salesforce page or Context Panel). // Use this value to adjust layout based on available width. @api flexipageRegionWidth; // Context properties passed from Revenue Grid @api source; @api mode; }Use it in the template to adjust layout dynamically.
<template> <!-- Example: apply width-based class for responsive layout --> <!-- Implement your own styling based on flexipageRegionWidth values --> <div class={flexipageRegionWidth}> <p><b>Source:</b> {source}</p> <p><b>Mode:</b> {mode}</p> </div> </template>
Context Panel passes width information to the component, allowing it to adjust its UI.
Enable integration with Revenue Grid#
Configure Salesforce settings required for Revenue Grid to load and display the component in the Context Panel:
Create a Lightning Out dependency app#
Create a Lightning Out app to allow the component to be loaded outside Salesforce.
Open Developer Console.
Select File > New > Lightning Application.
Enter a name (no spaces or special characters, follow
c:componentNameformat)
Select Lightning Out Dependency App.
Click Submit.
Update the application:
Add
access="GLOBAL"to<aura:application>Add a dependency:
<aura:application extends="ltng:outApp" access="global"> <!-- Allows Revenue Grid (Lightning Out) to load this component --> <!-- Replace c:itemProperties with your component name --> <aura:dependency resource="c:itemProperties"/> </aura:application>
Save the application.
Create a CORS entry#
Allow Revenue Grid to access your Salesforce resources.
Open Salesforce Setup.
In the Quick Find field, enter CORS, and open the page.
Under the Allowed Origins List, click New.
Enter your Revenue Grid tenant URL.
Click Save.
Request integration activation#
After completing the configuration, contact Revenue Grid Support and provide:
Component title to be displayed in the Context Panel (up to 10 characters to avoid truncation)
Component icon (Base64
data:URL)Lightning dependency app name (for example,
c:lightningOutForRG)Lightning web component name (for example,
c:itemProperties)
After activation, refresh Context Panel to display the component.
Optional: enable token-based authentication (MacOS)#
To ensure compatibility with Safari:
Open Salesforce setup.
Go to Session Settings.
Under Session Settings, enable When embedding a Lightning application in a third-party site, use a session token instead of a session cookie.
Save changes.
If not enabled, Context Panel may fail to load the component with the following error: “Failed to load lightning component within timeout. Please check its configuration.”
For more details, see Microsoft’s guide on cross-site tracking.