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.

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 users to quickly and easily consult the information they need and plan their daily activities.

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:

  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 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. The previous MyInsights LWC does not restrict display of HTML reports embedded in a Lightning page based on the profile_vod value. HTML reports display for anyone with the appropriate user permissions.

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.

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

  • Leave the HTML_Report_vod field blank to display all MyInsights pages for the available record type. All HTML report records display for that entry point for the current user's profile, subject to user permissions and visibility rules.
  • Select the appropriate HTML_Report_vod from a dropdown menu of available records. Only HTML report 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.