Viewing MyInsights Content in Lightning
- Browser (Lightning)
To create dynamic page layouts, admins can embed MyInsights content in Lightning pages, including territory-level content and content visible only for specific records. This allows Lightning users to view and interact with MyInsights content online alongside standard Salesforce Lightning components.
For example, Sarah Jones uses Veeva CRM on a desktop computer. She has two territory-level MyInsights visualizations, one for pre-call planning and one for administrative tasks. To allow Sarah to view MyInsights visualizations online, an admin adds both visualizations to her home page in Lightning. Sarah can start her day by consulting both visualizations online and planning her daily activities.
Considerations
- Developers can create MyInsights content for Lightning with integrated Nitro data using the queryVDSRecord method
- Developers must include the <!DOCTYPE html> header in the index.html file
- If multiple MyInsights Lightning web components display on the same page and are not using the updated JavaScript library, query performance may be degraded and using the getDataForCurrentObject JavaScript method to retrieve data about the HTML_Report_vod object from CRM may return incorrect data. Veeva recommends ensuring all content uses the updated MyInsights JavaScript library.
- In Lightning, the Territory Insights can query up to 4500 accounts across all territories to which the user has access
Configuring MyInsights Content for Lightning
To enable MyInsights content for Lightning:
- Ensure MyInsights and Viewing MyInsights Content on Classic are configured.
- Grant end users access to the MyInsightsService Apex class.
- Navigate to Setup > Security > CSP Trusted Sites.
- Add the org’s Salesforce domain as a trusted site. The Salesforce domain can be found in the My Domain settings.
When defining the trusted site, make sure to select the Allow site for connect-src check box in the CSP Directives section.
- Navigate to Setup > Security > CORS.
- Add the org’s Lightning domain to the CORS Allowed Origins List. The Lightning domain can be copied from the browser’s address bar when viewing Veeva CRM in Lightning.
- Navigate to the appropriate HTML_Report_vod record.
- Select Lightning for the Platform_vod field.
- Ensure HTML_Report_vod and Attachment VMOCs with platform-specific WHERE clauses for mobile platforms are enabled. For example, the HTML_Report_vod VMOCs for the iPad and Windows Tablet platforms include the following criterion in the WHERE clause:
- Platform_vod__c includes ('Mobile_Device_vod')
- Deactivate HTML_Report_vod and Attachment VMOCs without platform-specific WHERE clauses to prevent Lightning only content from syncing to mobile devices.
Adding MyInsights Content to Lightning Pages
To view MyInsights content in Lightning, admins must add the MyInsights Lightning web component (LWC) to the appropriate Lightning page via the Lightning App Builder. Multiple MyInsights LWCs can be added to a page.
Admins can also add MyInsights LWC as tabs in a Tabs LWC. However, if a user does not have visibility to the MyInsights content in a tab, an empty tab displays. To avoid empty tabs, Veeva recommends adding MyInsights content with limited visibility as independent MyInsights LWCs on a Lightning page.
The following Lightning page types support the MyInsights LWC and can display different MyInsights content depending on the HTML_Report_vod record types:
Lightning Page |
Available HTML_Report_vod Record Types |
---|---|
Home Page |
|
App Page |
|
Account Record Page |
|
Account Plan Record Page |
|
Inventory Monitoring Record Page |
|
Order Record Page |
|
All other record pages |
|
After adding the MyInsights LWC to the page layout, admins can select the content to display from a dropdown menu of the available HTML_Report_vod records. Only HTML_Report_vod records with the appropriate record types display.
Optionally, admins can also define the maximum height of the component in pixels. If defined, the content never exceeds the maximum height, even when resized.
When using out-of-the-box visualizations not supported on the iPhone platform, ensure the LWC has sufficient horizontal space to allow the content to display fully.
Since the LWC is responsive, if users resize their browser window, the content also resizes appropriately. To allow MyInsights content to dynamically resize, developers must use the updated MyInsights JavaScript library and must not use the following CSS styles on the html tag:
- height: 100%
- max-height: 100%