Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

Portal Knowledge Base Articles - sort order

(0) ShareShare
ReportReport
Posted on by 50

Hi,

We make use of Categories for our articles in our Customer Self-Service Portal.

On the Knowledge Base Home page, our categories are listed as we want (in accordance with the sort order set against each category).

However, when drilling into the category it shows related articles, but they seem to be in KA Number order.  We want them alphabetical by Article title.

I think I need to tweak  the Category Details Web Template, but don't quite know where to start!

I assume it will be the addition of an "Order by" somewhere?

If anyone can help it would be appreciated.

Many thanks,

Mark

  • Suggested answer
    cloflyMao Profile Picture
    25,208 on at
    RE: Portal Knowledge Base Articles - sort order

    Hi Mark,

    If you had found the answer resolved your issue, please kindly mark as verified, it would be greatly appreciated.

    Thanks,

    Have a good day. :)

    Regards,

    Clofly

  • Suggested answer
    Mark.Fletcher Profile Picture
    50 on at
    RE: Portal Knowledge Base Articles - sort order

    Hi Clofly,

    Your supplement provided the answer. 

    Updated the default value in the Category Details Web Template:

    <order attribute="articlepublicnumber" descending="false" />
    to read:
    <order attribute="title" descending="false" />
    Result!
    Thanks
  • cloflyMao Profile Picture
    25,208 on at
    RE: Portal Knowledge Base Articles - sort order

    Hi Mark,

    From a previous thread below:

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/234082/portal-liquid-undefined-functions-on-customer-self-service-demo?pifragment-97030=1#responses

    It seems that system default 3 sort top, recent, popular couldn't be changed.

    If you would like to make a custom "Order by" for your published knowledge articles,

    you could instead write your own fetchXML with sort type you like with Liquid JS (a javascript template engine used on Portal page) tag to render custom result on Portal page, 

    then hide the default section.

    and due to you said you want to change Knowledge Base Home page, so my example is based on the KB Home page.

    5078.x001.PNG

    code:

    <div>

    {% fetchxml my_query %}
    <fetch version="1.0" mapping="logical" count="10">
    <entity name="knowledgearticle">
    <attribute name="title" />
    <order attribute="title" />
    </entity>
    </fetch>
    {% endfetchxml %}

    <h3 style="padding: 7px">Knowledge Articles order by title</h3>
    {% for result in my_query.results.entities %}
    <div name="content" style="padding: 7px;font-size: 16px; clear: both;">
    <span> {{ result.title | escape }} </span>     
    </div>
    {% endfor %}

    </div>

    > You could build fetchXML in Advanced Find

    > Tutorial:

    http://dyn365apps.com/2017/09/14/dynamics-365-portals-liquid-templates-part-3-retrieve-data-using-fetchxml/

    https://colinvermander.com/2017/04/17/dynamics-365-portals-use-liquid-to-return-json-or-xml/

    https://dynamics365authority.com/Blog/d365-crm-portal-retrieve-data-using-liquid-templates-and-fetchxml

    > Be sure that the entity you want to retrieve is available on your web page.

    Supplement: 

    HI Mark,

    It seems I misunderstood the page you refer,

    Does your Category Detail page mean below ?

    5078.x002.PNG

    If so, now that you've found the Category Details Web Template,

    then just modify the order by attribute to any specific field(set it "title" if you would like to sort them by title) of knowledgearticle entity in fetchXML:

    x003.PNG

    Regards,

    Clofly

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans