简体   繁体   中英

How to dynamically change fetchxml filters in Dynamics Portal using Liquid templates?

Based on querystring I need to change FetchXML filters for dynamics portals using liquid. I tried below but it throws exceptin; Unknown tag 'endif' . Please help to make the filters dynamic.

{% fetchxml fetchActivities %}
    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
        <entity name="xyz_testentity">
          <attribute name="xyz_testentityid" />
          <attribute name="xyz_name" />
          <order attribute="xyz_name" descending="false" />
          <filter type="and">
            {{% if {{ RecordId }} %}}
            <condition attribute="xyz_tempattr" operator="eq" value="{{RecordId}}" />
            {% else %}
            <condition attribute="xyz_tempattr" operator="not-null" />
            {% endif %}
          </filter>
        </entity>
      </fetch>
    {% endfetchxml %}

Fix this snippet, you have double curly for if :

{{% if {{ RecordId }} %}}

Correct code:

{% if {{ RecordId }} %}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM