Make the Coveo Lightning components Lightning Locker compliant
Make the Coveo Lightning components Lightning Locker compliant
In Summer '17, Lightning Locker was auto-activated for all Salesforce organizations with no option to disable, meaning that Lightning Locker is automatically enabled for components using API version 40 onwards.
Since the May 2018 release of Coveo for Salesforce V3.10, Coveo for Salesforce Lightning components have gradually migrated to be compliant with Lightning Locker.
The following table shows the evolution of Lightning Locker compliance of Coveo for Salesforce Lightning components:
| Release package number | Migrated components |
|---|---|
|
|
As of the Coveo for Salesforce v4 release, the former Coveo Case Creation, Coveo Search, Coveo Searchbox, and Coveo Base components have been deprecated in favor of newer Lightning Locker compliant components. To learn how to leverage these new components, see Upgrading from v3 to v4. |
Making earlier versions of the Coveo for Salesforce Lightning components Lightning Locker compliant
While all components and pages created from Coveo for Salesforce 2.41 onwards are already Lightning Locker compliant out of the box, components and pages created earlier must be updated to become compliant.
|
|
|
Change data-condition to data-field
Previous versions of the Coveo-powered search page used data-condition to ensure that the right templates are loaded for the right type of document (see TemplateLoader - condition).
You must replace every data-condition with data-field.
One of your result template uses the following script tag.
<script id="SalesforceAccount" class="result-template" type='text/html' data-condition="raw.objecttype == 'Account'" >
You change the data-condition="raw.objecttype == 'Account'" to its data-field equivalent.
<script id="SalesforceAccount" class="result-template" type='text/html' data-field-objecttype="Account" >
Use static resources for your customization
Before Lightning Locker, the good practice to include custom code was to add it to a custom Lightning component that wraps the Coveo components.
While this is still a good practice, you should move the custom code in a static resource that you reference in the custom Lightning component (see Add JavaScript to the Coveo Lightning Aura components with custom code).
Once you have performed these steps, your Coveo for Salesforce integration should be Lightning Locker compliant.
Use HTML templates instead of Underscore templates
Underscore result templates aren’t supported when Lightning Locker is activated. You need to use HTML templates instead.