Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Liquid: How to handle null in result of fetchXML

$
0
0
{% fetchxml my_query %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" returntotalrecordcount="true">
.....
.....
<filter type="and">
        <condition attribute="asc_id" operator="eq" uitype="new_uitype" value="{{request.params.id}}" />
      </filter>
    </link-entity>
  </entity>
</fetch>

I am using fetchXML with liquid in web template for ADX portal. The code below works fine when I provide valid ID

{% if my_query.results.entities %}
  {{ my_query.results.entities.size }}
{% else %}
  <span class="alert">No session found for this booking</span>
{% endif %}

However, when ID is not in CRM i.e. null result I am getting this error 

Liquid error: Exception has been thrown by the target of an invocation.


Could you please tell me how to handle null result in Liquid with fetchXML. I have tried following options

{% if my_query.results.entities %}
{% if my_query.results.total_record_count %}
{% if my_query.results %}

all return same error

Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images