Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

New UI Refresh button on forms does not trigger formload event

(0) ShareShare
ReportReport
Posted on by

It appears that in the new UI the new refresh button on forms does not trigger the form load event. I can't find any event to subscribe to to deal with it either. I have a html web resource on the form that I need call javascript on when certain fields change (working) or when the refresh button is clicked (not working). If you click the refresh button then the web resource is also refreshed but I need to call javascript on it again so that it can get access to the formcontext object again.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: New UI Refresh button on forms does not trigger formload event

    After more debugging. I'm going to say this is NOT what is going on. The form load event is firing.

    My actual issue is that on Chrome\Edge (but not on FireFox) the html web resource is getting reloaded after the form load by just a couple milliseconds. So that my code is running but then the web resource refreshes afterward. I fixed it by adding a timeout. I had thought that the getContentWindow() call would handle this, but apparently not.

    I had to add the setTimeout call in the following code to make it work.

    function formLoad(context)

    {

    var formContext = context.getFormContext();

    var productOptionsIFrame = formContext.getControl('WebResource_ProductOptionPicker');

       if (productOptionsIFrame) {

               setTimeout(function () {

                   productOptionsIFrame.getContentWindow().then(function (w) {

                       w.RefreshOptionPicker(Xrm, formContext);

                   }

                   ); // force reload

               }

               , 1000);

           }

    }

  • LeoAlt Profile Picture
    16,331 Moderator on at
    RE: New UI Refresh button on forms does not trigger formload event

    Hi Partner,

    I did a simple test in my instance, I have an alert function on onLoad event on form, when click "Refresh" ribbon, the alert will also be triggered.

    Did you put the javascript in your html web resource on the form and when loading the form, call the JS functions in it?

    Could you kindly share your code and more details about the situation?

    Regards,

    Leo

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,190 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,968 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans