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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Related Articles | Related liquid filter usage.

(0) ShareShare
ReportReport
Posted on by

Hi!

Im trying to figure out how the related liquid filter is working, with not much success. So the example im working based on is this (related categories web template contains this):

{% if categoryguid %}
  {% assign relatedcategories = knowledge.categories | related: categoryguid, limit %}
  {% if relatedcategories.size > 0 %}
    ... some stuff ...
  {% endif %} 
{% endif %}

The code i wrote uses the exact formula:

{% assign relatedarticles = knowledge.articles | related: article.knowledgearticleid, limit %}

{{ article.knowledgearticleid }} is a valid article id

But it gives me 2 various errors

1) Limit given: Liquid error: Missing a valid input parameter. Parameter name: input 

2) No limit given: Liquid syntax error: Error - Filter 'related' does not have a default value for 'pageSize' and no value was supplied

Main question:

How can i make related filter work?

Bonus questions:

What object is knowledge (entitylist, entityView, just a random magic object adx provieded)?

Is it possible to dump an objects content somehow on screen/js console/ somewhere? Would be usefull to see what is inside an object

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    ThomasN Profile Picture
    3,190 on at

    Hi csonthejjas, thanks for reaching out.

    I am just as turned around as you with these liquid objects and the obscure nature in how they are handled. But nevertheless we will make it work.

    1. Limit should just say Limit:10 or whatever number you want. Not sure about your sample but I found some of those have typos. The limit determines when the liquid will exit a loop. If you plan on returning more than 10 related records, then increase the number. Also if it is very large then you will need to insert some pagination logic. Which can be copied from the sample on the help page for portals. (Click ? on web template page in CRM)

    2. Because there is no pageSize the limit is required. So putting a number should fix that.

    As for the 'knowledge' it is a mystery object created by adx, as far as I can tell. I have not found a way to print to console or lookup what any liquid object is made of, because they disappear when the DOM is created. I would guess knowledge is a combination of all the entities related to knowledge management. So you could reference one and access all the attributes, but not tested that theory.

    I would recommend changing the knowledge.articles with the field for the relationship your looking to match your valid article guid. {% assign relatedarticles = knowledgearticle.parentarticlecontentid | article.knowledgearticleid , limit:10 %}

    Saying give me articles where the parent article guid matches | the given article guid, and stop after 10 are returned. Hope this helps.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans