Skip to main content

Notifications

Community site session details

Community site session details

Session Id : mfU1kdofzCeYSP0XWgw8vi
Power Pages - Customize & Extend
Answered

Retrieve data with Liquid and FETCH XML

Like (1) ShareShare
ReportReport
Posted on 20 Jun 2024 11:56:06 by 48

Hello.

I have a problem with fetching data using fetchxml.
Some time ago it worked for me, now it works strangely.

Here is my code:

{% fetchxml params %}
  <fetch mapping="logical">
    <entity name="dyn365bc_params_test">
      <attribute name="dyn365bc_parameter_name"/>
      <attribute name="dyn365bc_parameter_value"/>
      <attribute name="dyn365bc_no"/>
      <attribute name="dyn365bc_params_test" />
  </entity>
  </fetch>
  {% endfetchxml %}
   {% for resultparams in params.results.entities %}
    {{ resultparams.dyn365bc_parameter_value }}
    {{ resultparams.dyn365bc_parameter_name }}
    {{ resultparams.dyn365bc_params_test }}
    {{ resultparams.dyn365bc_no }}
{% endfor %}


And as a result I get:

hubjes_0-1718884047760.png


And this is data in the table:

hubjes_1-1718884111689.png

So I retrieve the data from 'dyn365bc_parameter_name' and 'dyn365bc_params_test' (it's a GUID field).
I've done some tests and it always shows data from the first attribute I select to retrieve, no matter what kind of field it is and in addition it shows data from the GUID type field.
Do you have any idea why I can't show all attributes at the same time? I think the permissions in Power Pages and the field names are correct because I can retrieve data from any field, but only if it is my first attribute in the fetch xml.

 





  • Christian Leverenz Profile Picture
    1,214 on 08 Aug 2024 at 14:31:27
    Retrieve data with Liquid and FETCH XML
    Hi @hubjes,
    i recenently was also using fetchXML agin after a long time and stumbled across a strange remark in the documentation ( https://learn.microsoft.com/en-us/power-pages/configure/liquid/template-tags#fetchxml ) : you shall not use selfenclosing tags. so, instead of <attribute name="harry"/> you should use <attribute name="harry"></attribute>
    sounds a little bit strange,, but may be its serious now. You will always get the id if the entry as this is a specific attribute in the response.
     
    Hope it helps.
    Have fun,
    Christian
     
  • Verified answer
    hubjes Profile Picture
    48 on 09 Jul 2024 at 12:04:36
    Re: Retrieve data with Liquid and FETCH XML

    Hi.

    Permission was fine, I think the problem occurs when you try to use fetchxml multiple times for a specific table on the same website. When I use fetchxml only once per website, it works ok.

  • EmadBeshai Profile Picture
    806 Super User 2025 Season 1 on 02 Jul 2024 at 20:53:42
    Re: Retrieve data with Liquid and FETCH XML

    Hi @hubjes ,

     

    Did you check your table permissions for this table?

     

    If this post helps you with your problem, please mark this answer as Accepted Solution.

    If you like my response, please give it a Thumbs Up. 

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Pages - Customize & Extend

#1
oliver.rodrigues Profile Picture

oliver.rodrigues 2 Most Valuable Professional

#1
Fubar Profile Picture

Fubar 2 Super User 2025 Season 1

#1
Ajlan Profile Picture

Ajlan 2

Overall leaderboard

Featured topics