
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)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 %}