Posted Tue, 19 Apr 2016 12:19:09 GMT by Matthew Jacobs

Hi,

I have recently reviewed your latest release notes and the item stating "Liquid: Add {% fetchxml %} tag, for arbitrary FetchXML support from Liquid." is of particular interest.

Would you happen to have any documentation on this?

Thanks,

Matthew Jacobs

Posted Tue, 19 Apr 2016 17:13:49 GMT by Gabriel Boyer

There's no documentation at this time, but it's pretty straightforward:

{% fetchxml my_query %}
  <fetch version="1.0" mapping="logical">
    <!-- Write FetchXML here, use Liquid in here if you want, to build XML dynamically. -->
  </fetch>
{% endfetchxml %}

{{ my_query.xml | escape }}
{{ my_query.results.total_record_count }}
{{ my_query.results.more_records }}
{{ my_query.results.paging_cookie | escape }}
{% for result in my_query.results.entities %}
  {{ result.id | escape }}
{% endfor %}

<!-- You can also filter results by Entity Permissions -->
{% fetchxml secure_query enable_entity_permissions: true, right: 'read' %}
{% endfetchxml %}
Posted Fri, 05 Aug 2016 14:42:18 GMT by Adam Hong

FYI. For 8.0+ the fetchxml tag requires appropriate entity permissions for data to be correctly retrieved.

Posted Thu, 08 Dec 2016 08:03:29 GMT by Vishal Sahu

I tried to use fetchxml in liquid template by putting it in web page's summary . 

I keep getting this error  - "Liquid error: Data at the root level is invalid. Line 2, position 1."

Here is the code I am using :-

{% fetchxml fetchrelatedpermits %}
  <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="contact">
    <attribute name="firstname" />
  </entity>
</fetch>
{% endfetchxml %}

Any idea why this is not working ?