Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Customize & Extend
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:
  • sweb Profile Picture
    117 on at
    Re: FetchXML through JS

    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.

  • Verified answer
    oliver.rodrigues Profile Picture
    9,315 Most Valuable Professional on at
    Re: FetchXML through JS

    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
    Re: FetchXML through JS

    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.

  • Christian Leverenz Profile Picture
    1,214 on at
    Re: FetchXML through JS

    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

     

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 69 Super User 2025 Season 1

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 49 Most Valuable Professional

#3
Jon Unzueta Profile Picture

Jon Unzueta 43

Featured topics