web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Using the Display Order field to order categories on Knowledge Base page doesn't seem to work

(0) ShareShare
ReportReport
Posted on by 75

I was working with the categories and wanted to use the category Display Order (sequencenumber) field to order the categories on the page, however the portal doesn’t seem to have access to it - see red text below:

 

My ‘Knowledge Base Home’ template:

 {% 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 | order_by: 'sequencenumber' %}

  {% if categories %}

    <div class="list-group unstyled">

    {% for category in categories %}

      <a href="{{ category_url | add_query: 'id', category.categorynumber }}" class="list-group-item">

        {{ category.title }}

      </a>

    {% endfor %}

    </div>

  {% endif %}

{% endblock %}

 

If I order by the title field, that works. 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Chris Vitacek Profile Picture
    55 on at
    RE: Using the Display Order field to order categories on Knowledge Base page doesn't seem to work

    According to this documentation ([View:https://docs.microsoft.com/en-us/dynamics365/customer-engagement/portals/liquid-objects#category-object:750:50]) only categorynumber, name and title are available directly from the Category Object.  I solved this same issue with the Entity object and the following code (notice the FetchXML order tag).  This also allows you to access other entity fields like description.

    {% block main %}
    {% include 'Page Copy' %}
    {% fetchxml categories_query %}
    <fetch mapping="logical">
    <entity name="category">
    <attribute name="categorynumber" />
    <attribute name="title" />
    <attribute name="description" />
    <attribute name="categoryid" />
    <attribute name="sequencenumber" />
    <order attribute="sequencenumber" />
    </entity>
    </fetch>
    {% endfetchxml %}

    {% assign category_url = sitemarkers['Category'].url %}
    {% assign categories = categories_query.results.entities %}
    {% if categories %}
    <div class="list-group">
    <ul class="list-group unstyled">
    {% for category in categories %}
    <li class="list-group-item">
    <a href="{{ category_url | add_query: 'id', category.categorynumber | escape }}" class="title">{{ category.title | escape }}</a>
    <p class="description">{{ category.description | escape }}</p>
    <img src="{{ category_url | escape }}{{ category.categorynumber | escape }}.png" alt="{{ category.title | escape }}" class="img-category">
    </li>
    {% endfor%}
    </ul>
    </div>
    {% endif %}

    {% endblock %}

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans