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

Notifications

Announcements

No record found.

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.

I have the same question (0)
  • LeoAlt Profile Picture
    16,331 Moderator on at

    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

  • Verified answer
    Community Member Profile Picture
    on at

    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);

           }

    }

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans