Integrating a Coveo Insight Panel Lightning Component

Lightning Experience

Pro and Enterprise editions only

Coveo for Salesforce 3 (May 2018)

The Coveo Insight Panel Lightning Component is a search interface that’s meant to be included in the sidebar of your Lightning applications. This panel is typically used to propose contextually relevant information to your support agents alongside their cases. However, you can also use it with other Salesforce object types (e.g., Account, Opportunity, etc).

InsightPanel

It’s the Lightning Experience equivalent of the Coveo Insight Panel Classic Component.

This article shows the recommended way of integrating the Coveo Insight Panel Lightning Component in a Lightning application.

Prerequisites

  1. Ensure that you have a Lightning application (e.g., Lightning Service Console, Sales, etc).

  2. Ensure that you have set up a domain name for your organization (see Set Up My Domain).

  3. Ensure that you have installed and configured the Coveo for Salesforce V3 or later package (see Installing the Coveo for Salesforce Application).

Step 1: Add the Coveo Insight Panel Lightning Component in Salesforce

Adding a Coveo Insight Panel Lightning Component to a Record Page

  1. In Salesforce, access your Lightning Application (e.g., Lightning Service Console, Sales), and then open any record (e.g., Case, Opportunity, Account).

  2. At the top right of the page, click Setup Cogwheel icon, and then select Edit Page.

  3. In your record page, ensure you have the Record Detail Lightning component. The Record Detail component should be placed in the left side of the page.

    For an optimal page configuration, you should use the Pinned Left Sidebar Lightning page layout for your record pages. This layout allows your agents to see the record details while they perform other actions such as using the Coveo Insight Panel Lightning Component or drafting a knowledge article.

  4. Drag and drop the Coveo Insight Panel component to the right side panel (beside the Record Detail component).

    InsightPanel

    Depending on the record page you’re modifying, the Coveo Insight Panel Lightning Component may display warnings such as:

     Invalid field definition: Case_Subject
    

    By default, the component Record Fields value is set to:

     Case_Subject, Case_Description
    

    In order to perform contextual search, you must specify the fields that are relevant for your specific object type. For example, with Opportunity, you should set the Record Fields value to:

     Opportunity_Name, Opportunity_Description
    

    For more information on adding object context on a search interface in Salesforce Lightning, see Adding Object Context.

  5. At the top right, click Save.

  6. Activate the new page, if not already done.

    activate-new-page

    1. Click Assign as Org Default.

      You can make these changes available as default, or edit the assignment rules to only activate this page for specific users or profiles.

      assign-as-org-default

    2. Once you’re done with the assignment rules, click Save.

      save-assignment

  7. Now that your page is saved, at the top right of the page, select Back.

  8. Select the Coveo Insight Panel component, and click Set Up a Search Page.

  9. Choose the tabs you want to have in your panel, and select Create Page. You can always change the tabs later.

Step 2: Configure Your Coveo Insight Panel Lightning Component in Coveo Cloud

  1. Create an Automatic Relevance Tuning (ART) model.
  2. Associate the ART model with the query pipeline used by your Coveo Insight Panel Lightning Component.

    Ensure to select the Comply with Intelligent Term Detection (ITD) check box when associating the model.

    By default, your Coveo Insight Panel Lightning Component uses the Default query pipeline. However, you should create a specific pipeline for this audience and use a condition based on the Coveo Insight Panel Lightning Component search hub (see Set the Search Hub).

  3. On the Query Pipelines page, select the query pipeline used by your Coveo Insight Panel Lightning Component and then in the Action bar, click Edit components.
  4. On the subpage that opens, select the Advanced tab, and then click Query parameters on the left side of the page.
  5. Add a rule overriding the large query (lq) parameter value with the context object. This rule allows the Coveo Insight Panel Lightning Component to display items that are relevant to the current Salesforce object before a query is sent.

    1. Click advanced menu, and then select Add query parameters rule with code.

      1. On the Add a Rule With Code subpage, enter a rule that uses the record fields defined in Step 1.

        For example, if the record fields are Case_Subject and Case_Description, then the rule will look like this:

        override query lq:"<@+ $context.Case_Subject $context.Case_Description +@>"
        
      2. Click Add with code.

    2. Add a condition to the rule you just created that’s applied when a query is empty. This condition ensures that the context of the current Salesforce object will only apply to the automatic queries that are made by the Coveo Insight Panel Lightning Component.

      Your Query Parameters rule should now look like this:

      Query parameter rule

Depending on your use case, you must add custom dimensions to make the search and click events metadata available in your usage analytics reports (see Manage Dimensions on Custom Metadata).

Most of the time, it would make sense to add dimensions that match the record fields. If those fields are Case_Subject and Case_Description, the dimension names would be respectively context_case_subject and context_case_description.

Step 3: Customize the Coveo Insight Panel Lightning Component Options

After having created your Coveo Insight Panel Lightning Component, you may want to customize some of its options. This article explains the different options of the Coveo Insight Panel Lightning Component.

Changing the Name of the Component

The name of the Visualforce component to use as your search interface for the component.

If that component doesn’t exist in your organization, you will be prompted to create it.

The default value is coveoLightningInsightPanel.

Modifying the Search Hub

The name of the search hub to enforce when authenticating a query with this search token, which can also be used in query pipeline condition statements.

Adding Record Fields

The record fields to send with every query to be used in query pipeline rules.

This option expects a comma-separated list of Salesforce field names.

By default, the Case_Subject and Case_Description fields are used.

While the Subject and Description fields are used by default, you may want to declare other fields to better contextualize the search experience.

You can easily find the formatted field names in your Salesforce organization through the Object Manager. Access the desired object, and then select the Fields & Relationships tab.

In the Fields & Relationships tab, use the format of the desired field as written in the Field Name column.

fields-and-relationships

To declare the field, you must prefix the field name by the name of the object as follows:

<OBJECT_NAME>_<FIELD_NAME>

Where you replace:

<OBJECT_NAME> with the name of the object

<FIELD_NAME> with the name of the field as written in the Field Name column.

Modifying the Full Search Component Name

The name of the Visualforce component that should open when clicking Full Search.

The value for this option should follow the myNamespace:myComponent syntax.

When empty, the default search page is used.

This option is empty by default.

Adding the Debug Mode

Whether to load the non-minified versions of the resources. This enables more logging, and should only be used when troubleshooting the custom code in your component.

By default, this option is unchecked.

What’s Next?

If you’re integrating the Coveo Insight Panel Lightning Component in a Case record page, see Configuring a Coveo Insight Panel Lightning Component for Cases.

With the option panel, you can:

You can also:

Recommended Articles