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 Platform Community / Forums / Power Pages / Assign a javascript va...
Power Pages
Answered

Assign a javascript variable to fetchXML variable

(0) ShareShare
ReportReport
Posted on by 167

Hi All,

 

I was wondering how you can assign a javascript variable to a fetchxml variable similar to below. Any hints is appreciated. Thank you!

 

gospa_0-1672957204877.png

 

Categories:
I have the same question (0)
  • Verified answer
    oliver.rodrigues Profile Picture
    9,457 Most Valuable Professional on at

    Hi, JavaScript is executed on the Cliend-side, while Liquid is executed Server-side. Basically at the moment your Fetch is being executed, this is still on the server-side and hasn't processed the JS yet. So your code above won't work.

     

    There might be alternatives to what you are trying to achieve, for example you can have a separate Web Page/Web Template executing your Fetch and calling the page via Javascript: Using FetchXML in a Power Apps Portal Web Page Template - Carl de Souza

     

    If you need the Fetch to happen based on a JS variable, would you not consider using the Portal Read API? Portals read operations using the Web API - Power Apps | Microsoft Learn

  • gng Profile Picture
    167 on at

    Hi Oliver,

     

    Thanks for the proposals. I like the idea with option #1 which is to create a web template with request params. Does that mean that in my current web page, I am able to filter out my fetchxml script with incoming request params?

  • oliver.rodrigues Profile Picture
    9,457 Most Valuable Professional on at

    Hi @gospa yes, this will allow you to filter the fetch, as long as the fetch is placed in the other Web Template (not the one from the current page)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 69

#2
DP_Prabh Profile Picture

DP_Prabh 36

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 30 Most Valuable Professional

Last 30 days Overall leaderboard