Filter EntityList with Liquid

1.4k views Asked by At

Being new to liquid and entitylists, I see this as the SQL equivalent to select * from vehicle and am trying to work out how to add a where clause to make select * from vehicle where keeper = {{userid}} and for the life of me, I can't find how to do that.

Is there an easy way to apply a simple filter?

    {% entitylist name:"Vehicle" %}
      {% entityview %}
        <p>Found {{ entityview.total_records }} records</p>
        <table class="table">
          <tbody>
            {% for e in entityview.records -%}
              <tr>
                <td>
                    <p>Keeper <strong>{{ e.keeper }}</strong></p>
                    <p>Name <strong>{{ e.vehiclemake }}</strong></p>
                    <p>Fuel Card <strong>{{ e.vehiclemodel }}</strong></p>
                    <p>VRM <strong>{{ e.vehicleregistration }}</strong></p>
                </td>
              <tr>
            {% endfor -%}
          </tbody>
        </table>
      {% endentityview %}
    {% endentitylist %}

In the link on the answer from Arun, it is suggested to filter the entity list by the currently logged in user, which seems to be obvious, but when I went to the list, to try that, I don't hvae the option to add Contact (parentcontactid)

enter image description here

1

There are 1 answers

0
Arun Vinoth-Precog Tech - MVP On

There are different ways to filter the entity list in portal, using portal user/parent contact attribute configuration or even fetchxml tag in liquid template.

The trick from Nick is another no-code configuration only solution.

Basically we can create a dummy contact, use it to filter the view and let the portal engine replace the current portal user in runtime.

enter image description here