Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Form reload javascript fails with IE after Dynamics 365 update 2.2

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

We have a system with a very large number of custom entities, plugins and processes. It is often the case that we want to do something fancy on the form, such as modify the available values in drop down lists based on some other selections on the form. To achieve this, we have used javascripts.

In the early days, in Dynamics CRM 2011, this worked without any hassle. Then we upgraded to Dynamics CRM 2016 (8.1) and, due to a new feature, the form didn't reload anymore after saving. So we created a hack to forcibly reload the form: We added ModifiedOn field to the form and into its OnChange event we added the following javascript code:

SaveAndReloadExtension = {
    saveAndReload : function() {
        setTimeout(function(){
            var id = Xrm.Page.data.entity.getId();
            var name = Xrm.Page.data.entity.getEntityName();
            Xrm.Utility.openEntityForm(name, id);
        }, 100);
    }
};

This works fine in Dynamics CRM 2016 (8.1.1.1005). It also works fine in Dynamics 365 (8.2.2.112) with the exception that it does not work at all with Internet Explorer. In Firefox and Chrome it works like before, but in IE the form gets stuck when reloading. The save action works and the entity gets updated, but when the form tries to reload itself, it only shows the following animated loading-icon in the middle of a blank screen and is stuck there forever:

All versions mentioned here are on-premises.

Any ideas on what causes this behavior and how it could be fixed?

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Form reload javascript fails with IE after Dynamics 365 update 2.2

    Thanks for the suggestion, but unfortunately it did not change the behavior. Are you or anyone else able to reproduce this issue? We first encountered this about a year ago so it most likely is not dependent on some specific version of IE.

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Form reload javascript fails with IE after Dynamics 365 update 2.2

    Hi Tommi,

    I have not found any issue in your code but could you please make your function simpler like below and also try to increase timeout span (2000).

    function saveAndReload()
    {
        setTimeout(function(){
            var id = Xrm.Page.data.entity.getId();
            var name = Xrm.Page.data.entity.getEntityName();
            Xrm.Utility.openEntityForm(name, id);
        }, 2000);
    }


    Hope this helps.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans