--- title: Integrate a Coveo Insight Panel Lightning Component slug: '1028' canonical_url: https://docs.coveo.com/en/1028/ collection: coveo-for-salesforce source_format: adoc --- # Integrate a Coveo Insight Panel Lightning Component [.version.c4sf.c4sf-edition.c4sf-pro-enterprise] [Pro and Enterprise editions](https://docs.coveo.com/en/l2590456#salesforce) The Coveo [Insight Panel](https://docs.coveo.com/en/2898/) 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 such as Account, Opportunity, and more. ![Coveo Insight Panel sidebar listing recommendations for a case | Coveo for Salesforce](https://docs.coveo.com/en/assets/images/coveo-for-salesforce/insight-panel.png) > **Tip** > > Under the hood, the Coveo Insight Panel Lightning Component is a [Lightning Aura component](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/intro_framework.htm) that uses the [JavaScript Search Framework](https://docs.coveo.com/en/187/). > The [Coveo Hosted Insight Panel](https://docs.coveo.com/en/m7ed8015/), released as part of [Coveo for Salesforce v4.28](https://docs.coveo.com/en/3236#september-2022-release-v4-28), is a [Lightning Web Component (LWC)](https://developer.salesforce.com/docs/platform/lwc/guide) that uses the more modern [Quantic](https://docs.coveo.com/en/n9790069/) library. > Consider using the Coveo Hosted Insight Panel in your Lightning Console apps to benefit from the latest features and improvements. This article describes how to integrate the Coveo Insight Panel Lightning Component in a Lightning application. ## Prerequisites * Ensure you have a Lightning console app such as the [Lightning Service Console](https://help.salesforce.com/articleView?id=console_lex_service_intro.htm&type=5). * Ensure you've [set up a domain name](https://help.salesforce.com/s/articleView?id=sf.domain_name_setup.htm&type=5) for your organization. * Ensure you've installed and configured Coveo for Salesforce v4 or a later package (see [Get started with Coveo for Salesforce](https://docs.coveo.com/en/1158/)). ## Step 1: Add the Coveo Insight Panel Lightning Component in Salesforce ### Add a Coveo Insight Panel Lightning Component to a case record page . In Salesforce, access your Lightning console app. . Open any case record. . At the upper-right corner of the page, click the **Setup** icon button (![Cogwheel icon in Salesforce](coveo-for-salesforce/cogwheel.png)), and then select **Edit Page**. . In your case record page, ensure you have the **Record Detail** [Lightning component](https://help.salesforce.com/articleView?id=lightning_page_components.htm&type=5). > **Leading practice** > > For an optimal page configuration, you should use the **Pinned Left Sidebar** [Lightning page layout](https://help.salesforce.com/articleView?id=console_lex_custom_pages.htm&type=5) for your case 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. . Drag the **Coveo Insight Panel** component to the right side section of the page. ![Coveo Insight Panel Lightning component animation | Coveo for Salesforce](https://docs.coveo.com/en/assets/images/coveo-for-salesforce/insight-panel-animated.gif) > **Note** > > Depending on the case record page you're modifying, the Coveo Insight Panel Lightning Component may display warnings such as: > > ```text Invalid field definition: Case_Subject ``` > > By default, the component **Record Fields** value is set to: > > ```text Case_Subject, Case_Description ``` > > To perform contextual search, specify the fields that are relevant for your specific object type. > For example, with **Opportunity**, you should set the **Record Fields** value to: > > ```text Opportunity_Name, Opportunity_Description ``` > > For more information on adding object context on a search interface in Salesforce Lightning, see [Adding object context](https://docs.coveo.com/en/3290#adding-object-context-in-the-salesforce-lightning-console). . At the upper right, click **Save**. . Activate the new page, if not already done. ![Activate new Salesforce page option](https://docs.coveo.com/en/assets/images/coveo-for-salesforce/new-page.png) .. Click **Assign as Org Default**. > **Note** > > You can make these changes available as default, or edit the assignment rules to only activate this page for specific users or profiles. ![Salesforce Assign as Org Default dialog](https://docs.coveo.com/en/assets/images/coveo-for-salesforce/assign-as-org-default.png) .. Once you're done with the assignment rules, click **Save**. ![Review assignment panel in Salesforce](https://docs.coveo.com/en/assets/images/coveo-for-salesforce/save-assignment.png) . Now that your page is saved, at the upper-right corner of the page, select **Back**. . Select the **Coveo Insight Panel** component, and then click **Set Up a Search Page**. > **Note** > > The **Set Up a Search Page** button is only displayed the first time you integrate this component. . Choose the tabs you want to have in your panel, and then select **Create Page**. You can always change the tabs later. ## Step 2: Configure your Coveo Insight Panel Lightning Component in Coveo . [Create a Coveo Machine Learning (Coveo ML) Automatic Relevance Tuning (ART) model](https://docs.coveo.com/en/3397#create-an-art-model). . [Associate the ART model](https://docs.coveo.com/en/l1ca1038/) with the [query pipeline](https://docs.coveo.com/en/180/) used by your Coveo Insight Panel Lightning Component. You must associate the model twice. The first association aims at optimizing the model when a [large query expression (`lq`)](https://docs.coveo.com/en/214/) is populated, while the second aims at optimizing the model when a [basic query expression (`q`)](https://docs.coveo.com/en/178/) is populated. .. For the first association, enable the [**Comply with Intelligent Term Detection (ITD)**](https://docs.coveo.com/en/l1ca1038#comply-with-intelligent-term-detection-itd) option, and then add the following [condition](https://docs.coveo.com/en/1959/): `Large Query Is populated`. .. For the second association, disable the [**Comply with Intelligent Term Detection (ITD)**](https://docs.coveo.com/en/l1ca1038#comply-with-intelligent-term-detection-itd) option, and then add the following [condition](https://docs.coveo.com/en/1959/): `Large Query Is not populated`. > **Tip** > > By default, the Coveo Insight Panel Lightning Component uses the **Default** query pipeline. > However, we recommend [creating a specific pipeline](https://docs.coveo.com/en/1791#create-a-query-pipeline) for this audience and using a [condition](https://docs.coveo.com/en/2793/) based on the Coveo Insight Panel Lightning Component [searchHub](https://docs.coveo.com/en/1342/) (see [Set the search hub](https://docs.coveo.com/en/365#set-the-search-hub)). . On the [**Query Pipelines**](https://platform.cloud.coveo.com/admin/#/orgid/search/pipelines/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/search/pipelines/)) page, click the query pipeline used by your Coveo Insight Panel Lightning Component, and then click **Edit components** in the Action bar. . On the subpage that opens, select the **Advanced** tab, and then click **Query parameters** on the left side of the page. . On the **Query Parameters** tab, add rules overriding the [basic query expression (q)](https://docs.coveo.com/en/13#operation/searchUsingPost-q) and [large query expression (lq)](https://docs.coveo.com/en/13#operation/searchUsingPost-lq) parameter values: .. Click **Add a query parameter rule**. .. On the **Add a query parameter rule** subpage, select **q (basic query expression)**, and then click **Next**. .. Under **q (basic query expression)**, enter `<@+ $context.Case_Subject +@>`. > **Important** > > * If the [query syntax is enabled](https://docs.coveo.com/en/3411#enable-query-syntax), remove the `<@\+` and `+@>` markers from the rule as follows: > > `$context.Case_Subject` > > * When using syntax block markers (for example, `<@\+` and `+@>`) or when the query syntax is enabled, special characters in the context value (for example, `()`, `[`, `]`, or `_`) may be interpreted as query syntax elements instead of plain keywords. > This could cause query syntax errors or cause the [Partial match feature](https://docs.coveo.com/en/414/) to not work as expected, either of which could lead to partial or even no results. > We therefore recommend using [query extensions](https://docs.coveo.com/en/1462/) to remove them from the context. > > For example: > > `<@+ $allKeywords(keywords: $joinValues(values:$replaceInValues(values: $splitValues(text: $context.Case_Subject), regex: '[_.$%&?/#|\\]', replacement: '\ '))) +@>` > > Adding query extensions ensures that the query is properly formatted and that the results are relevant. .. Under **Condition**, select or [create](https://docs.coveo.com/en/1959#create-a-condition) a `Query is empty` condition. .. Click **Add rule** .. To add a rule overriding the large query expression (lq) parameter value, click **Add a query parameter rule** once again. .. On the **Add a query parameter rule** subpage, select **lq (large query expression)**, and then click **Next**. .. Under **lq (large query expression)**, enter `<@+ $context.Case_Description +@>`. > **Important** > > When using syntax block markers (for example, `<@\+` and `+@>`) or when the query syntax is enabled, special characters in the context value (for example, `()`, `[`, `]`, or `_`) may be interpreted as query syntax elements instead of plain keywords. > This could cause query syntax errors or cause the [Partial match feature](https://docs.coveo.com/en/414/) to not work as expected, either of which could lead to partial or even no results. > We therefore recommend using [query extensions](https://docs.coveo.com/en/1462/) to remove them from the context. > > For example: > > `<@+ $allKeywords(keywords: $joinValues(values:$replaceInValues(values: $splitValues(text: $context.Case_Subject), regex: '[_.$%&?/#|\\]', replacement: '\ '))) +@>` > > Adding query extensions ensures that the query is properly formatted and that the results are relevant. .. Under **Condition**, select or [create](https://docs.coveo.com/en/1959#create-a-condition) a `Query is empty` condition. .. Click **Add rule**. Your **Query Parameters** rules should look like this: ![Query parameter rules output | Coveo](https://docs.coveo.com/en/assets/images/coveo-for-salesforce/query-parameter-rules.png) > **Note** > > Depending on your use case, you can add custom dimensions to make the search and click events metadata available in your usage analytics reports (see [Manage dimensions on custom metadata](https://docs.coveo.com/en/1522/)). ## Step 3: Customize the Coveo Insight Panel Lightning Component options After having added your Coveo Insight Panel Lightning Component, you may want to customize some options covered in this section. ![Panel displaying the Coveo Insight Panel Lightning Component customizable options | Coveo for Salesforce](https://docs.coveo.com/en/assets/images/coveo-for-salesforce/insight-panel-options-updated.png) ### Change the name of the component - **As of the Coveo for Salesforce v5 release** The name of the `Page Content` record that contains the HTML code of your search interface. - **Prior Coveo for Salesforce versions** The name of the Visualforce component that contains the HTML code of your search interface. If that component doesn't exist in your organization, you'll be prompted to create it. Default value is `coveoLightningInsightPanel`. ### Modify 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. ### Add 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. > **Note** > > 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 find the formatted field names in your Salesforce organization through the [**Object Manager**](https://help.salesforce.com/s/articleView?id=sf.extend_click_find_objectmgmt_lex.htm&type=5). > Access the desired object, and then select the **Fields & Relationships** tab. > > On the **Fields & Relationships** tab, use the format of the desired field as written in the **Field Name** column. > > ![Salesforce Object Manager Fields and Relationships page](:https://docs.coveo.com/en/assets/images/coveo-for-salesforce/fields-and-relationships.png) > > To declare the field, prefix the field name by the name of the object as follows: > > `_` > > Where you replace: > > `` with the name of the object. > > `` with the name of the field as written in the **Field Name** column. ### Modify the Full Search component name The name of the component that opens when the **Full Search** button (icon:external-link[alt=external-link,width=16]) is clicked. The value for this option should follow the `myNamespacePrefix__myComponentName` syntax. Only modify this value if you want to use a custom Full Search component. Otherwise, leave this option empty. > **Note** > > You can also [customize the Full Search button options](https://docs.coveo.com/en/3092/). ### Add 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. ### Exclude custom actions > **Available since** > > This feature was introduced in the March 2022 release of Coveo for Salesforce version [4.23](https://docs.coveo.com/en/3236#march-2022-release-v4-23). An exclusion filter to hide custom actions (based on `type` or `value`) from the [User Activity Timeline](https://docs.coveo.com/en/3129#session-summary-and-user-activity-timeline). In some cases, you may want to exclude custom actions that provide no value from being displayed in the User Activity Timeline (for example, if they're too numerous or don't have relevant [metadata](https://docs.coveo.com/en/218/)). Uses the format `value1, value2, value3`. The filter's default values are `ticket_create_start, ticket_field_update, ticket_next_stage, ticket_classification_click` because they don't display relevant or valuable data for the agent. ## Optimize the Coveo Insight Panel Lightning Component configuration for cases The Coveo Insight Panel Lightning Component offers some functionalities that are specific to the Case object type. You should perform this additional step to get the best of the component. Since the case you're currently working on doesn't need to appear in your results, you can filter it out by following these steps: . On the Case page, click **Setup** and then select **Edit Page**. . After clicking anywhere in the Coveo Insight Panel Lightning Component, in the **Record Fields**, add `Case_CaseNumber`. . In your Coveo Administration Console, on the **Filters** tab, click **Add a filter rule**. .. On the **Add a filter Rule** page, under **Query parameter**, select **cq (constant query)**. .. Under **Query Filter**, add the following code: ```javascript NOT @sfcasenumber=$context.Case_CaseNumber ``` .. Click **Add Rule**.