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

Community site session details

Session Id :
Power Pages - Customize & Extend
Answered

Portal Cache Nightmare

(2) ShareShare
ReportReport
Posted on by 4
Guys, I am at my wits end.
 
I have a record, in a custom table, that the user interacts with by clicking a button that makes an external http request to an Azure resource.
 
This Azure resource then updates the record state and returns a 200 OK.
 
My Javascript then refreshes the page... and still record shows in the old state for like 5 minutes even though the value has been updated in Dataverse.
 
Here is the kicker... I'm not using an OOB entity list or anything like that to render the record. I'm doing a straight up liquid fetchxml api call to Dataverse and it still returns the old value... even via API call from portal!
 
To summarize my question is: HOW DO I FORCE THE PORTAL TO RESPECT DATAVERSE UPDATES IN REAL TIME???
Categories:
I have the same question (0)
  • ID-24120023-0 Profile Picture
    4 on at
    Portal Cache Nightmare
    Thank you all so much, manipulating the query like @eugenevanstaden suggested works. You are amazing!
     
    Also, very sad and funny that this is the solution...
  • Suggested answer
    Fubar Profile Picture
    8,118 Super User 2025 Season 2 on at
    Portal Cache Nightmare
    As you are doing a liquid fetchxml query, all you need to do is make the query 'relatively' unique by adding a criteria that is close to unique but always true - you can do this by including a criteria in your fetchxml such as  createdon is less than the liquid 'now' formatted down to the second  
    <condition attribute="createdon" operator="on-or-before" value="{{ now | "yyyy-MM-dd HH:mm:ss" }}" />
    https://learn.microsoft.com/en-us/power-pages/configure/liquid/liquid-filters#date-filters
  • Suggested answer
    surya narayanan Profile Picture
    58 on at
    Portal Cache Nightmare
    Hi,
    Power Pages uses aggressive server-side caching for Liquid-based FetchXML queries. Even if Dataverse updates immediately, the rendered data via Liquid can lag for up to 5 minutes, especially when:
    You've used fetchxml in a .html or .webpage file
    Output is rendered using entitylist or any custom Liquid loop
    Portal's output cache hasn't invalidated yet
    Even worse—Liquid has no awareness of dynamic changes unless the cache expires or you bypass it.
    4 Ways to Force Real-Time Data Rendering
    1. Call Power Pages Web API via JavaScript
    Skip Liquid. Use a JS fetch() call to /_api for fresh data straight from Dataverse.
    javascript
    fetch("/_api/custom_table_records(GUID)")
      .then(r => r.json())
      .then(data => {
        console.log("Live data:", data);
        // Use this to dynamically update the UI
      });
    This bypasses the Liquid rendering layer entirely. Works great with Ajax-loaded components.
    2. Use Client-Side Logic to Refresh Record Data
    If you must stick with Liquid (e.g., SEO-friendly content), use JavaScript after page load to refresh just the updated fields via a light Web API call, like:
    // Replace record ID dynamically
    let recordId = "YOUR_RECORD_ID";
    fetch(`/_api/custom_table_records(${recordId})`)
      .then(res => res.json())
      .then(data => {
        document.querySelector("#recordStatus").textContent = data.statuscode;
      });
    This blends static Liquid and dynamic client updates. Add a loading spinner if needed.
    3. Temporarily Disable Output Caching (for debugging only)
    Under Site Settings, add:
    Name: Web Page Output Cache Enabled
    Value: false
    Don't leave it off for long—performance hits hard in production.
    4. Force Data Consistency via Flow/Webhook
    If you're updating from Azure and need it reflected instantly, consider having the Azure function trigger a Power Automate Flow that does a redundant update or logs to a portal-visible table—something the portal notices immediately (dirty trick, but it works).
     
  • Verified answer
    eugenevanstaden Profile Picture
    437 on at
    Portal Cache Nightmare
    If you update the record via the Portal API - it would break cache. As the record is being updated outside of the portal, then cache would not break.

    If you are using liquid to query then you can add this to break the cache. Just replace any_field with any field on your table.
     
     <condition attribute="any_field operator="ne" value='{{ "now" | date: "yyyy-MM-dd HH:mm:ss" }}' />
  • lbendlin Profile Picture
    8,227 Super User 2025 Season 2 on at
    Portal Cache Nightmare
    would it help to add a "&r=<random number>"  to the fetch URL ?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Pages

#1
Jon Unzueta Profile Picture

Jon Unzueta 89 Super User 2025 Season 2

#2
Shafiuddin Profile Picture

Shafiuddin 45

#3
Fubar Profile Picture

Fubar 40 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics