Case Deflection component

The {coveo-case-deflection} component lets you display relevant content that dynamically changes depending on the content of a request.


The Coveo Case Deflection component requires Zendesk v0.0.2 or later.

Use the Coveo Case Deflection component

For steps on accessing the folders in the Customize design window of Zendesk, see Customizing your help center theme.

  1. Go to your theme customization page and click Edit Code.

  2. Locate the page template that corresponds to the new request page (generally new_request_page.hbs).

  3. Enter your page template code where indicated in the code block.

      <!-- Replace this comment with your page template -->

Use Coveo hosted search pages for case deflection

The Coveo Case Deflection component can be used in conjunction with the {coveo-hosted-search-page} component. To do so, you must replace your page template with the Coveo Hosted Search Page component.

  <CoveoHostedSearchPage data-page-name='ZendeskCaseDeflection' />

When you save and reload the page, you’ll see the results displayed on your new request page.


For increased accessibility, you can modify the layout to display the form and the results side by side. For example:

<div id="main-content" style="display:flex;">
  <div style="flex: 50%;">

  	<CoveoCaseDeflection style="flex: 50%">
  	<CoveoHostedSearchPage data-page-name='ZendeskCaseDeflection' />

Filter results with request context

Once the component is in place, you can see additional context sent with every Coveo query request. Upon opening the browser developer tool, you can locate a REST query going to

By scrolling to the bottom, you’ll see the context parameter. This parameter sends a JSON with the attributes of the request and should look like this:

context: {"subject":"Issues with my widget","description":"My widget is broken"}

The keys in this JSON are useful for configuring your Case Deflection component where you’ll configure your query pipeline. Any key in this JSON can be used in your query pipeline. For example:


Configure your Case Deflection component

  1. In your Coveo organization, select or create the query pipeline used by your Case Deflection component.

  2. In the Machine Learning tab, add a new Coveo ML model, such as an Automatic Relevance Tuning (ART) model, with the Enable Intelligent Term Detection (ITD) option selected. See Configure an Automatic Relevance Tuning model for Case Deflection or Case Assist Document Suggestions for instructions on how to create a Coveo ML ART model that’s optimized for case deflection.

  3. In the Query Parameters tab, add rules overriding the basic query expression (q) and the large query expression (lq) parameter values.

  4. Click Menu, and then select Add rule with code.

  5. On the Add a Rule With Code subpage, in the form editor box, enter the following rules:

    override query q:"<@+ $context.subject +@>"
    override query lq:"<@+ $context.description +@>"
  6. Click Add With Code.

  7. Back in the Query Parameters tab, click the created rules, and then click Edit in the Action bar.

  8. On the Edit a Query Parameter Rule subpage that opens, under Condition, select or create a condition that applies when an empty query is performed.

  9. Click Save.


If you enabled the query syntax in your Case Deflection component, you must remove the <@` and `@> markers from the query parameter rule overriding the q. When the query syntax is enabled, you must enter the following rules:

override query q:"$context.subject"
override query lq:"<@+ $context.description +@>"