Skip to main content
MindTouch Success Center

Integrate a link-to-case feature (legacy)

This page applies to:MindTouch (current)

This article explains how to extend the MindTouch search experience into your CRM with a Link to Case integration. In addition to the benefits of a  search integration, agents can link MindTouch articles to a current case. This makes it easy to track how effectively articles are solving customer issues.


This is a legacy integration. To integrate with our latest technology, visit our Touchpoint for CRM guide.


Why should I add a link-to-case feature to my search integration?

The primary benefits for the organization are:

  • Agent enablement. Agents can quickly find and recommend the most relevant content 
  • Standardized agent messaging. Agents provide customers with branded, authoritative links instead of 1-off replies which may be off-message
  • Drives self-services. Customers are shown how to find knowledge in the help center
  • Improves quality of support. Customers are sent to the official content with the most up-to-date information
  • Lowers costs. Agents improve their Mean Time To Resolution by quickly linking to content instead of writing a new response
  • Better analytics. Support managers can view reports on how effectively cases are being solved by various articles.

How do my agents benefit?

Key features for agents include:

  • Instant access to knowledge, as search results appear while you type
  • Results are identical to the main search experience, including search recommendations
  • Fast search refinements, with dynamic dropdowns to filter results to a category
  • Quick access to more results, with a single button to load additional results
  • Link knowledge to cases, allowing analytics to show what content is most effective.


In order to set up this integration, you should have:

  • A CRM that can run HTML code
  • Basic familiarity with Javascript
  • Basic familiarity with CSS (if styling customization is desired)

Step 1: Download the sample code

  1. Download this sample file to your computer.
  2. Open the file and verify you can perform searches. For example, search for "SSO" and verify results load.
  3. Verify that clicking "Link case" toggles the button state. (Note: this is a temporary association and is not persisted.)

Step 2: Set configuration variables

In the downloaded sample file, modify the following settings:

  • SITE_URL - the MindTouch site to connect to (connect to the HTTPS version of the site, since most CRM systems are HTTPS themselves)
  • WIDGET_SOURCE - the name that should appear in your site usage report
  • DEFAULT_SEARCH - the string that should be auto-searched when the integration is opened. This is often populated with the ticket subject, if available.
var MindTouch = {};
MindTouch.SITE_URL = "";
MindTouch.WIDGET_SOURCE = 'MT-custom-search';
MindTouch.DEFAULT_SEARCH = "";

Step 3: Verify the search interface

Verify the search interface works and that results load.

Step 4: Integrate the code with your CRM software

The last step is to integrate the code into your CRM. Using the HTML widget functionality, copy the widget HTML code into the appropriate location. A few caveats:

  • Single sign-on (SSO): The search widget uses the API and no SSO is performed. If the user has an existing session with MindTouch, it will be re-used by these API requests (more on setting up SSO with MindTouch).
  • jQuery: The widget code uses a version of jQuery hosted by Google, and is stored as $j in noConflict mode. If the CRM has an existing jQuery library, this can be used instead.
        <!-- PREREQUISITE: jQuery -->
        <script src=""></script>
  • API requests: The widget makes direct API calls using jQuery's $.ajax() function. If the CRM provides its own AJAX library, this can be used instead.
    var url = self.siteUrl + '@api/deki/site/query?dream.out.format=jsonp&dream.out.pre=?';
        url: url,
        data: params,
        dataType: 'jsonp'
  • Custom behavior: The code was written to be modular. There are methods for finding links to existing cases, checking case link status, relating a page to a case, and unrelating a page to a case.
    _findCaseLinks: function() {
        /* Lookup associations using the CRM's API.
        Typically, you will populate self.cases[pageId] with an entry for each linked page
        for each MindTouch page linked to current case...
            this.cases[pageId] = true;
    _isLinked: function(pageId) {
        /* Return true or false if incoming page is linked to the case. Most often, just return cases.pageId
        return false;
    _relateCase: function(result, button) {
        /* Create page/case association, using the CRM's API. Useful fields:
   - MindTouch PageId
            result.title - Title of page
            result.uri - URI to page 
        var labels = this.labels;
        var $button = j$(button);
        if(button) { 
    _unRelateCase: function(result, button) {
        /* Remove page/case relationship using the CRM's API.*/
        var labels = this.labels;
        var $button = j$(button);
        if(button) { 
  • Storing relationships: Typically, the page/case associations are stored inside the CRM so analytics can be performed. Ensure a many-to-many relationship is setup, where a single case can have many associated pages, and a page can be associated with many cases.

    For example, there may be a CRM object for cases, a CRM object for pages, and another CRM object (i.e. a join table) to track each page-to-case association. When storing page data, store as many fields in the API response as possible, such as the page title, URL and even the original author. This helps make analytics more useful.
  • Template-driven responses: In your CRM, you may wish to generate a templated email for the customer based on the linked case relationships.
  • Custom styling: The CSS at the bottom of the integration can be modified to style the integration.

Step 5: Verify your integration

Verify your link-to-case runs inside your search integration in your CRM sidebar:


  • Was this article helpful?