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 / Trigger Dataverse plug...
Power Pages
Answered

Trigger Dataverse plugin when user visits Power Pages site

(0) ShareShare
ReportReport
Posted on by 67

Hello Power Pages Community,

 

I have a situation where I need to trigger a custom Dataverse plugin when someone visits my Power Pages website, preferably when the website requests the `Header` and/or `Footer` web templates. I've tried registering the plugin to the `Retrieve` and `RetrieveMultiple` messages for the `mspp_webpage`, `mspp_webtemplate`, and `mspp_pagetemplate` entities, but the plugin only shows up in the trace log when I access the records through the Power Pages Management app, not when visiting the website, regardless whether or not I've cleared the server-side and/or client-side caches or if I'm using an InPrivate browser or not.

 

For context, I have some dynamic HTML, CSS, and JS content that is coming from another service (API), so I'm doing an HTTP GET request, parsing the response, and then returning that instead of the content of the web templates.

 

Thanks in advance!

Categories:
I have the same question (0)
  • Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at

    There is a Cache that sits between the Portal/Power Pages site and Dataverse and the portal reads from it first, so a plugin will never work for what you want.

     

    You will need to provide a bit more info about what you are trying to achieve.

  • rcarrigan Profile Picture
    67 on at

    Hi @Fubar , thanks for the quick response. Could you provide references for this additional caching layer that you're referring to so I can learn more about it?

     

    Regarding your request for more info, I have a requirement to load our website's header and footer from another service. Currently, this is done via client-side JS where we perform the following steps:

    1.  Fetch header and footer data from URL
    2. Parse XML response data into CSS links, JS links, header HTML content, and footer HTML content
    3. Add CSS and JS links into document `head` (this step also triggers browser to execute CSS and JS)
    4. Add header HTML content into top of `body`
    5. Add footer HTML content into bottom of `body`

    The issue with our current process is that it leads to an unacceptably large CLS and, in rare cases, leads to the website header and footer not loading at all.

     

    I've explored the idea of using even more client-side JS to `display:none` the body content until after the header and footer loads, which does work, but since the default state of the content would be `display:none`, it means that any issues encountered running the client-side JS will cause the entire site to not load. I've also, briefly, considered parsing the XML data manually and adding in the results into their respective locations within the site's web templates, but this negates the reason for fetching the data, as it doesn't allow us to update our header and footer when changes are made by the team responsible for maintaining it (which isn't directly associated with my team, BTW, so having them place their content in our Power Pages site directly is out of the question).

     

    I hope this is enough additional detail, so I look forward to any thoughts you might have on a possible solution, or confirmation that our current workaround is the optimal solution until Power Pages directly supports server-side processing.

  • Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at

    Note: you have no real control over the cache, and some of the info in the doco is easy to misinterpret   https://learn.microsoft.com/en-us/power-pages/admin/clear-server-side-cache

    and whilst the SLA is 15 mins, those things it applies to will usually occur within a minute or two.

     

    Its not really designed to do what you want, there may be others but things that come to mind

    • load CSS/JS like it is coming from an external CDN, this shouldn't cache the content from the CDN (and if it did you could try put a parameter on the end of the CDN url so it was unique each call)
    • maybe Iframe something

    I don't think the following will be the answer to your whole problem, but will be adding to it if it is set - there is also a setting to Cache the Header/Footer  https://learn.microsoft.com/en-us/power-pages/configure/enable-header-footer-output-caching

     

  • rcarrigan Profile Picture
    67 on at

    Hi @Fubar, as I mentioned in my initial post, I'm familiar with the server-side cache. Based on our use-case, it would be fine if the plug-in were retriggered only when we clear the server-side cache manually or with each website deployment, as the content being pulled in by the plug-in doesn't change frequently (think months not minutes).

     

    I will check if disabling the header and footer output caching affects my plugin triggering and report back. The other ideas (CDN and Iframe) won't work for our needs, but I do truly appreciate your brainstorming.

     

    What I really need, if anyone knows the answer, is how to trigger a Dataverse plugin when a user visits a Power Pages website. If I just had that piece of information, or verifiable/reproducible confirmation that it's not possible, then I would be able to move forward with next steps accordingly.

  • rcarrigan Profile Picture
    67 on at

    UPDATE: Even with header and footer output cache disabled and the server-side cache purged, none of the following messages triggered my custom plugin:

    MessagePrimary EntityEvent Pipeline Stage of ExecutionExecution ModeDeployment
    Retrievemspp_pagetemplatePreOperationSynchronousServer
    Retrievemspp_webpagePreOperationSynchronousServer
    Retrievemspp_websitePreOperationSynchronousServer
    Retrievemspp_webtemplatePreOperationSynchronousServer
  • Verified answer
    Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at

    As I mentioned in my first post, you will not get your plugin to trigger on someone just visiting your site.  I wouldn't recommend doing this, but how you can trigger a plugin is you make a Liquid fetchxml query where the query criteria contains something that makes it unique e.g. created on is less than or equal to Today (formated to seconds). Edit: ie. create a 'dummy' Table and use it in the Liquid fetchxml and then register your plugin on retrieve/retrievemultiple for that table

     

    However, if your header etc is static except for when it updates why not write something on the Dataverse, Azure or Flow side that will update the Dataverse  Web Template content itself (e.g. the update into the 'Header' Web Template) if the Header caching is turned off it will take less than 15mins for the update to surface on the Portal.

  • rcarrigan Profile Picture
    67 on at

    "you will not get your plugin to trigger on someone just visiting your site" - do you have a reference for how you learned this, or just from experience? I just want to understand why it's not possible to improve my mental model of Power Pages architecture.

     

    I like your idea of "why not write something on the Dataverse, Azure or Flow side that will update the Dataverse  Web Template content itself (e.g. the update into the 'Header' Web Template)". For Azure, I'm sure you mean Logic/Function app, and obviously Flow refers to Power Automate, but what do you mean by "write something on the Dataverse"? I'll probably opt for a Function App since low-code for this is unnecessary overhead, but I want to be clear on the available options before making a decision.

     

    Thank you!

  • Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at

    @rcarrigan wrote:

    "you will not get your plugin to trigger on someone just visiting your site" - do you have a reference for how you learned this, or just from experience? I just want to understand why it's not possible to improve my mental model of Power Pages architecture.

     


    Because of how the Cache is implemented - everything is pulled from the cache first (and when data and the portal metadata - web templates, forms etc is read from the cache there is no read of Dataverse to trigger the plugin).

     


    @rcarrigan wrote:

    I like your idea of "why not write something on the Dataverse, Azure or Flow side that will update the Dataverse  Web Template content itself (e.g. the update into the 'Header' Web Template)". For Azure, I'm sure you mean Logic/Function app, and obviously Flow refers to Power Automate, but what do you mean by "write something on the Dataverse"? I'll probably opt for a Function App since low-code for this is unnecessary overhead, but I want to be clear on the available options before making a decision.


    Yes could be logic app, or function etc etc.

    Dataverse side - if you have a trigger could be via a plugin, custom workflow activity, webhook, Azure Service Bus.  There are also various mechanisms to fake a 'timer' e.g. using bulk delete, multiple asynchronous workflows with a wait in the right configuration to stop the recursion depth issue, could have a flow on a timer that calls a Action (though in that scenario you would probably just put everything in the Flow).

  • rcarrigan Profile Picture
    67 on at

    @Fubar wrote:
    Because of how the Cache is implemented - everything is pulled from the cache first (and when data and the portal metadata - web templates, forms etc is read from the cache there is no read of Dataverse to trigger the plugin).

    I understand what you're saying, but that doesn't explain why the 'Retrieve' message doesn't get fired when the page is loaded *after* clearing the server-side cache. Regardless of the reason, it's obvious to me that these 'Retrieve' messages aren't triggering the plugin as expected, so short of creating a Microsoft support ticket, I think this is a dead end.

     


    @Fubar wrote:
    Dataverse side - if you have a trigger could be via a plugin, custom workflow activity, webhook, Azure Service Bus.  There are also various mechanisms to fake a 'timer' e.g. using bulk delete, multiple asynchronous workflows with a wait in the right configuration to stop the recursion depth issue, could have a flow on a timer that calls a Action (though in that scenario you would probably just put everything in the Flow).

    I see. Based on our needs and the DLP in place, we'll most likely be going to Azure Function App route. I will mark that recommendation as the solution.

     

    Thank you for your help!

  • Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at

    The cache is basically a 'black box' how it really works we don't know. In the Enhanced model (which you are using based on the table prefix), the tables you registered your plugin against are actually Virtual tables, these Virtual tables pull data from 1 main table (can't remember its name off the top of my head), and for the caching of the config/metadata i would suspect they may be getting it from that main table and not the virtual tables.  Similarly, as they have access to the backed, they could be getting the data out of the database and not via Web Services. 

     

    Also, will just add something about the Header/Footer caching setting for anyone else that thinks this may avoid the cache - this is actually an Output Caching setting, if enabled the Header/Footer gets rendered on first visit by the user, that rendered content is then cached and every other time the user visits a page that uses the header/footer they get the 'pre-rendered' content out of the cache (which is a quicker load time for the page). If it is not enabled, each page will re-render the header/footer - when it re-renders it is still reading from the portals cache first.

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 61

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 40 Most Valuable Professional

#3
11manish Profile Picture

11manish 38

Last 30 days Overall leaderboard