Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

form is not refreshing when saving

Posted on by Microsoft Employee

hey guys :)

have one issue to discuss with ur exp

after saving the form in crm 2016 the page is not refreshed where i have to refresh the 

page manually by pressing Ctrl +R  inorder to have the next stage which is assigned by workflow

tryied to refresh by javascript Xrm.Page.data.refresh(); but it does not make any sense

i know u r there to support :)

thanks

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: form is not refreshing when saving

    got it

    it has no error on trigger but it does no sens as well ,

    although alertjs are installed , added to the libraries and being called

    by the script which is enabled ?

    Alert.showLoading(String."server/org")

    is there a necessary to configure a form to accept custom querystring parameters ?

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: form is not refreshing when saving

    Hi Hasooon,

    You could use this: https://alertjs.codeplex.com/

    You can add a loading screen to disable the form.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: form is not refreshing when saving

    thanks man :) it works

    but i had to change wait time to 10000 in order to trigger the workflow in background process . However i am trying to use a code to disable the form during that 10 sec , it used to be in old crm 4.0 during saving and refreshing( full white page with a message in the middle processing ... )

    any idea about ? and sure u do ;)

    thanks bro

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: form is not refreshing when saving

    Yes you put the code in OnSave.

    I'm not entirely sure what you are asking but if you want to run the code when the form is saved successfully. Then you can use this:

    function ExecuteWhenSaveComplete(callback)
    {
    	setTimeout(function ()
    	{
    		if (!Xrm.Page.data.entity.getIsDirty()) return callback();
    		//console.log('form not saved yet');
    		ExecuteWhenSaveComplete(callback);
    	}, 500);
    }
    
    function SetExecuteOnSaveComplete()
    {
    	ExecuteWhenSaveComplete(function ()
    	{
    		console.log('form save complete');
    		Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId());
    	});
    }


    Just place the SetExecuteOnSaveComplete on the OnSave. This will ensure that the form is saved first before the refresh

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: form is not refreshing when saving

    i am using that script onSave mode where it is supposed to be save and then

    trigger the refresh script isn't it correct ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: form is not refreshing when saving

    thanks Bro it works ;)

    but there is an alert for changes have not been saved

    and i dont need it to show is it possible to take it out

    here is my code

    function RefreshPage()

    {

    sleep(10000);

    Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId());

    }

    function sleep(milliseconds) {

     var start = new Date().getTime();

     for (var i = 0; i < 1e7; i++) {

       if ((new Date().getTime() - start) > milliseconds){

         break;

       }

     }

    }

    known that i am trying to wait on it for seconds inorder to trigger the plugin

    can we remove the alerts ?

    again thanks Thomas

  • Verified answer
    Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: form is not refreshing when saving

    Hi Hasooon,

    I assume you are trying to refresh a business process flow.

    Try this: 

    Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId());

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans