Skip to main content

Notifications

Service | Customer Service, Contact Center, Fie...
Suggested answer

Dynamics Portal: filter knowledge search results by category in same results page

Posted on by

Hi

I have a requirement in Dynamics Portal to show knowledge articles search list that users can then filter by category. I'm want to achieve something similar to https://www.samsung.com/uk/support/model/SM-G991BZIGEUA/ where the left side bar contains categories that then dynamically filter the displayed articles list - all on same page.

I know this will be a custom page and can use FetchXML to get the articles and their categories but are not sure how to implement the filtering feature. Any help on how to achieve this (if possible including code) is greatly appreciated.

Thanks in advance.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics Portal: filter knowledge search results by category in same results page

    Hi JasR

    Look at what is actually being done for the Customer Self Service.  There are 2 main Web templates being utilised:

    Knowledge Base - Home: this lists the categories and creates URLs that pass the category number to the child page

    Category Details: this receives the category number in the id parameter, which is then used to end up getting the GUID of the actually category (this is then substituted into the FetchXML query to retrieve the collection of articles).

    These are two pieces of code that involve categories as well as knowledge base articles, maybe you can refer it:

    {% extends 'layout_1_column' %}
    
    {% block main %}
      {% include 'Page Copy' %}
      {% assign category_url = sitemarkers['Category'].url %}
      {% assign count = count | default: 0 %}
      {% assign categories = knowledge.categories | top_level: count %}
      {% if categories %}
        
    {% for category in categories %} {{ category.title }} {% endfor %}
    {% endif %} {% endblock %}

    {% extends 'Layout 1 Column' %}
    
    {% block breadcrumbs %}
      {% assign categoryid = request.params['id'] %}
      
      {% if categoryid %}
        {% assign category = knowledge.categories | category_number: categoryid %}
        {% if category %}
          {% assign pagetitle = category.title %}
          {% assign categoryguid = category.categoryid %}
        {% else %}
          {% assign pagetitle = resx["Knowledge_Article_Unavailable"] %}
        {% endif %}
      {% endif%}
      {% include 'Breadcrumbs' title: pagetitle %}
    {% endblock %}
    
    {% block title %}
      {% include 'Page Header' title: pagetitle %}
    {% endblock %}
    
    {% block main %}
      {% include 'Page Copy' %}
    
      {% assign category_url = sitemarkers['Category'].url %}
      
      {% assign portallanguagecode = website.selected_language.code %}
      
      {% if categoryguid %}
        {% fetchxml knowledgearticlecategory_query %}
          
            
              
              
              
              
              
              
                
                
                
              
                       
                  
                    
                           
              
              {% if portallanguagecode %}
              
                  
                    
                  
                
              {% endif %}
            
          
        {% endfetchxml %}
        
        {% assign articles = knowledgearticlecategory_query.results.entities %}
        {% if articles.size > 0 %}
          
        {% endif %}
        
        {% include 'Category - Related Categories' categoryguid: categoryguid %}
      {% else %}
        
    {% editable snippets "KnowledgeManagement/ArticleUnavailableMessage" %}
    {% endif %} {% endblock %}

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans