Skip to main content
MindTouch Success Center

Link search to your cases

This article explains how to extend the Mindtouch search experience in your SAP platform to include Link to Case. In addition to the benefits of the regular search, agents can link articles in MindTouch to the current case. This makes it easy to track how effectively articles are solving customer issues.

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.

After completing this how-to you will have a search interface similar to the following running inside your existing application.:

This sample code brings the power of the full MindTouch Search experience into your CRM/CEM. The 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 setup this integration, you should have:

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

Step 1: Download the sample code

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

Step 2: Set configuration variables

The sample code is configured to use the MindTouch Success Center at In the top of the file, modify the following settings:

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

After modifying the variables, verify the search interface works and results load.

Step 3: Integrate the code with your CRM/CEM 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.
  • jQuery: The widget code uses a version of jQuery hosted by Google, and is stored as $j in noConflict mode. If the CRM/CEM 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/CEM 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/CEM 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/CEM, 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 widget can be modified to restyle the widget.
  • Was this article helpful?