Viewing MyInsights Content in Lightning

  • Browser

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 custom MyInsights content online alongside standard Salesforce Lightning components, or display content using individual tabs on the selected page.

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.

For example, to enable a user to view all their available MyInsights pages, admins can add them as tabs to the user’s home page in Lightning. This allows the user to quickly and easily consult the information they need and plan their 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:

  1. Ensure MyInsights and Viewing MyInsights Content Online are configured.
  2. Grant end users access to the MyInsightsService Apex class.
  3. Navigate to Setup > Security >Trusted URLs.
  4. Select New Trusted URL.
  5. Add the org’s Salesforce domain as a trusted site. The Salesforce domain can be found in the My Domain settings.
  6. Select the connect-src (scripts) check box in the CSP Directives section.
  7. Select Save.
  8. Navigate to Setup > Security > CORS.
  9. 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.
  10. Navigate to the appropriate HTML_Report_vod record.
  11. Select Lightning for the Platform_vod field.
  12. 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')
  13. 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

  • Territory_Insights_vod
  • Territory_Insights_Default_vod

App Page

  • Territory_Insights_vod
  • Territory_Insights_Default_vod

Account Record Page

  • Account_Profile_Override_vod
  • KOL_Profile_vod
  • Account_Reports_vod
  • Territory_Insights_vod
  • Territory_Insights_Default_vod

Account Plan Record Page

  • Account_Plan_vod
  • Account_Profile_Override_vod
  • KOL_Profile_vod
  • Account_Reports_vod
  • Territory_Insights_vod
  • Territory_Insights_Default_vod

Inventory Monitoring Record Page

  • Inventory_Monitoring_vod
  • Account_Profile_Override_vod
  • KOL_Profile_vod
  • Account_Reports_vod
  • Territory_Insights_vod
  • Territory_Insights_Default_vod

Order Record Page

  • Orders_vod
  • Account_Profile_Override_vod
  • KOL_Profile_vod
  • Account_Reports_vod
  • Territory_Insights_vod
  • Territory_Insights_Default_vod

All other record pages

  • Territory_Insights_vod
  • Territory_Insights_Default_vod

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.

To enable users to view MyInsights content in Lightning, admins must add the myInsights V2 Lightning web component (LWC) to the appropriate page using the Lightning App Builder. Multiple LWCs can be added to a page.

The previous LWC version, MyInsights LWC, can still be used, however Veeva recommends using the new myInsights V2 LWC.

There are two options for using the myInsights V2 LWC. After adding an LWC to the page layout:

  • Leave the HTML_Report_vod record type field blank to display all MyInsights pages for the available record type. All HTML Report records that the user has access to, subject to all visibility rules, display using individual tabs on the selected page for end users.
  • Select the HTML_Report_vod record type to display from a dropdown menu of the available records. Only HTML_Report_vod records with the appropriate record types and an External Id display for end users.

Lightning Page

HTML_Report_vod Record Types displayed when no HTML report is selected

HTML_Report_vod Record Types available for selection

Home Page

  • Territory_Insights_vod
  • Territory_Insights_Default_vod
  • Territory_Insights_vod
  • Territory_Insights_Default_vod

App Page

  • Territory_Insights_vod
  • Territory_Insights_Default_vod
  • Territory_Insights_vod
  • Territory_Insights_Default_vod

Account Record Page

  • Account_Profile_Override_vod
  • KOL_Profile_vod
  • Account_Reports_vod
  • Account_Profile_Override_vod
  • KOL_Profile_vod
  • Account_Reports_vod
  • Territory_Insights_vod
  • Territory_Insights_Default_vod

Account Plan Record Page

  • Account_Plan_vod
  • Account_Plan_vod
  • Account_Profile_Override_vod
  • KOL_Profile_vod
  • Account_Reports_vod
  • Territory_Insights_vod
  • Territory_Insights_Default_vod

Inventory Monitoring Record Page

  • Inventory_Monitoring_vod
  • Inventory_Monitoring_vod
  • Account_Profile_Override_vod
  • KOL_Profile_vod
  • Account_Reports_vod
  • Territory_Insights_vod
  • Territory_Insights_Default_vod

Order Record Page

  • Orders_vod
  • Orders_vod
  • Account_Profile_Override_vod
  • KOL_Profile_vod
  • Account_Reports_vod
  • Territory_Insights_vod
  • Territory_Insights_Default_vod

All other record pages

n/a

  • Territory_Insights_vod
  • Territory_Insights_Default_vod

Adjusting the LWC Display

Since the LWC is responsive, if users resize their browser window, the content also resizes appropriately.

To allow the LWC to dynamically match the height of the MyInsights content, the MyInsights content must use the Veeva JavaScript library.

Admins can define the maximum height of the component in pixels. If defined, the content never exceeds the maximum height, even when resized.

When using MyInsights page templates not supported on the iPhone platform, ensure the LWC has sufficient horizontal space to allow the content to display fully.