Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Liquid & fetchxml to return CRM data

Posted on by Microsoft Employee

Hi, I am trying to get from an entity "adx_entity_form" portal, I already created a web template to add some Liquid to fetch the results but I am getting nothing.

First, I verified all the fields where accessible from the xRM web API: https://my.instance/api/data/v9.0/adx_entityforms?$select=adx_name,adx_entityformid

Then, I create the web template XML:

{% fetchxml query %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
	<entity name="adx_entityform">
		<attribute name="adx_name" />
		<attribute name="adx_entityformid" />
		<order attribute="createdon" descending="true" />
		{% if request.params['id'] %}
		<filter type="and">
		  <condition attribute="adx_entityformid" operator="eq" value="{{ request.params['id'] | xml_escape }}" />
		</filter>
		{% endif %}
	</entity>
</fetch>
{% endfetchxml %}{
	{% for ef in query.results.entities %}
	  "{{ ef.adx_entityformid }}": "{{ ef.adx_name }}"{%- unless forloop.last -%},{%- endunless -%}
  {% endfor %}
}


This returns an empty object, it doesn't reach the for loop.

Any suggestions on this code or something else?

Kindly regards

*This post is locked for comments

  • Suggested answer
    sandeepstw Profile Picture
    sandeepstw 4,601 on at
    RE: Liquid & fetchxml to return CRM data

    Hi,

    I will suggest to use console.log request.params['id']. I think you are not getting value or null so it goes in true block and you are not getting any data.

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Liquid & fetchxml to return CRM data

    Hi,

    First check if your fetchXML in CRM returning data, you can test using XrmToolBox tools and if it's returning data, make sure you have defined correct entity permissions under web roles for your portal user and he has access to the entity which you are querying, if user won't have read permission it won't return any data.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans