web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Pages
Answered

FetchXML through JS

(0) ShareShare
ReportReport
Posted on by 117

Hello, I have some data that I need from some specific dataverse tables.

Problem is I need to query a table to get some data and use that data to query other tables.

Is there any way to do that? If I normally use FetchXML, all of them run an the same time, I can not use the result of one in another, or at least I don't know how.

I thought maybe something with JS, if possible.

 

Thank you.

Categories:
  • Christian Leverenz Profile Picture
    1,214 on at

    Hi @sweb ,

    in case of that kind of requirements, i create a liquid template which uses fetchxml to make the queries. Either you make several "services" out of that or you create a bigger template with several fetches. Never tried but i think, you can use results of a fetch in the next fetch.

    https://learn.microsoft.com/en-us/power-pages/configure/liquid/template-tags#fetchxml

     

    For the parameter you can just use request.params.<whateveryouparameteris>

    https://learn.microsoft.com/en-us/power-pages/configure/liquid/liquid-objects#request

     

    When creating that kind of things, just create a liquid (=web) template, assign it to a pagetemplate and IMPORTANT: swicth off "render header and footer" and then create a page with that pagetemplate. The liquid will be renderered as it is and you can create for example a jsonoutput. 

    Hope this points in the right direction,

      Christian

     

  • sweb Profile Picture
    117 on at

    Hi @chleverenz , I don't know if I explained correctly.

    I have multiple queries, all of them get executed at the same time, so I don't have any results to start with.

    My first query returns some data, I need some of that data to execute the second query.

    Have read both your links, I don't seem to understand the solution.

    Can I have more details?

     

    Now the site is slow, one query has 7000+ results. I save the data to a JS variable and use the data from the other queries to filter out the one with 7000+ and get the data I need. As I said, site is so slow, takes 1-2 mins to load, sometimes even crashes.

  • Verified answer
    oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    Why not using the Portals API?

    On the click/select of each record you run the additional queries.

    Does that make sense?

     

  • sweb Profile Picture
    117 on at

    Thanks @OliverRodrigues, had no idea about the API, it's exactly what I need, I thought the only way to get data is through FetchXML.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Pages

#1
M Bilal Khan Profile Picture

M Bilal Khan 139

#2
Mohsin Ali Profile Picture

Mohsin Ali 41

#3
11manish Profile Picture

11manish 21 Super User 2026 Season 2

Last 30 days Overall leaderboard