Change the default Quick view in Coveo for Salesforce
Change the default Quick view in Coveo for Salesforce
In your result templates, you can choose to show a Quickview control, allowing users to see a preview of a result without leaving the search page.
By default, the Quickview uses the item body
field in the index to display the preview.
You will oftentimes want to adapt the default Quickview to fit your needs.
There are two ways to do so:
-
Building a custom body for your items in the index (see Add or edit a body mapping).
This method is only available with Coveo for Salesforce Pro and Enterprise.
-
Specifying a Quickview template to control how to display the preview (see Coveo Quickview Component (CoveoQuickview)).
Each method presents their own advantages:
Changing the indexed Quick view | Specifying a Quick view template |
---|---|
|
|
Changing the indexed Quick view
Pro and Enterprise editions only Integrators usually prefer to change the indexed Quick view when they can.
To do this, you need to change the body
field (see View or Edit a Salesforce object body), which affects both the Quick view and the excerpt.
Specifying a Quick view template
While not the preferred approach for users with Coveo for Salesforce Pro or Enterprise, adding a Quick view template is the ideal solution to add Quick views if you have a particular use case.
To add a Quick view template, you need to add it in the code of your page.
- Access the Coveo for Salesforce Interface Editor.
- At the top of the page, select the Code View tab.
-
At the end of your result template list, add a template that you will use as your Quick view.
An example template for an account could look like this:
<script id="accountQuickview" type="text/html" class="result-template"> <div class="coveo-result-frame"> <div class="coveo-result-row"> <span class="CoveoFieldValue" data-field="@sfname"></span> </div> <div class="coveo-result-row"> <span class="CoveoFieldValue" data-field="@sfindustry"></span> </div> <div class="coveo-result-row"> <span class="CoveoFieldValue" data-field="@sfdescription"></span> </div> <div class="coveo-result-row"> <span class="CoveoFieldValue" data-field="@sfannualrevenue" data-helper="currency"></span> </div> <div class="coveo-result-row"> <span class="CoveoFieldValue" data-field="@sfaccountnumber"></span> </div> <div class="coveo-result-row"> <span class="CoveoFieldValue" data-field="@sfcreateddate" data-helper="date"></span> </div> </div> </script>
For more information on how to build result templates, see Configure JavaScript search result templates.
- Select UI View at the top of the page.
- Edit the result template of one of your results that should use the Quick view you just added. Hover over it and click Edit that appears in its upper-right corner.
- Click Layout.
- Drag and drop the Quick View component where you want to put it on your page.
- In the Quickview Options window, ensure that the Always show checkbox is checked.
- Select Save.
- Select the Code View tab again.
-
Search for your newly added
Quickview
component. It should look like this:<span class="CoveoQuickview" data-always-show="true"></span>
The
CoveoQuickview
component isn’t compliant with Lightning Locker. Therefore, in Coveo for Salesforce v3.16 and up (Lightning Experience), you must use theCoveoSalesforceQuickview
component instead. -
Add a reference to the template id that the Quick view should use.
According to our previous example, your
CoveoQuickview
component would now look like this:<span class="CoveoQuickview" data-always-show="true" data-template-id="accountQuickview"></span>
- Repeat these steps for all the objects on which you want to add Quick views.