
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)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.