Search code examples
dynamics-crmliquidadxstudio-portals

How to add a filter to entityview in Liquid template


I'm using entityview to retrieve records from CRM using a liquid template. This is the code I use.

{% entityview logical_name:'new_consul', name:"Most Recent Consul" %}
{% assign cons = entityview.records %}
{% for item in cons %}

But I would like to add a filter to limit to 5 the results, so if I use this code:

{% assign count = count | default: 5 %}
{% assign recent_cons = entityview.records | recent: count %}

I get following error: Liquid syntax error: Error - Filter 'recent' does not have a default value for 'lang' and no value was supplied

What makes me think that filter should is applied correctly, so I then tried with:

{% assign languagecode = 'English' %}
{% assign recent_cons = entityview.records | recent: count,languagecode %}

But then I get this error: Liquid error: Missing a valid input parameter. Parameter name: input

How can I apply the filter to this entitiview query correctly?


Solution

  • Ok, found it on the adxstudios Portal documentation.

    https://community.adxstudio.com/products/adxstudio-portals/documentation/configuration-guide/liquid-templates/tags/crm-entity-tags/#page_size

    {% entityview logical_name:'new_consul', name:"Most Recent Consult", page_size:5 %}