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 Apps / Refresh Form Page afte...
Power Apps
Answered

Refresh Form Page after Save

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

I am working on a model-driven form. On the form I have a section that has a canvas app component. Whenever I change data on the form, I want the canvas app component to immediately update so that I don't have to press refresh on the command bar. Is it possible to write a js script that automatically refreshes the section or entire form on save?

Categories:
I have the same question (0)
  • AhmedSalih Profile Picture
    6,680 Moderator on at

    Hello, @Anonymous, You can create a Javascript web-resource with a function that's called on your Save Event.

     

    Try something like this: (Using formContext.data.refresh(save) >> I set it to false to not save as the script will run on the save event)

    function RefreshOnSave(executionContext) {
    
    var formContext = executionContext.getFormContext();
    
    formContext.data.refresh(false)
    
    }

     

     

    Regards,

    Ahmed

    If my reply helped you, please give a 👍. And if it has solved your issue, please consider a 👍 & Accepting it as the Solution to help other members of the community find it more.

    My Blog: www.powerplatformplace.com

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Ahmed,

    Thank you for the suggestion. Unfortunately, this did not resolve my issue. It seems to just refresh the data and not reload the form page.

     

    Regards,

    Valentin

  • Verified answer
    AhmedSalih Profile Picture
    6,680 Moderator on at

    @Anonymous, try this function to reload the full page:

     

    function refreshPage(){
     Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), 
     Xrm.Page.data.entity.getId());
    }

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @AhmedSalih Wow this worked like a charm, thank you so much!

    Also an fyi for people using this solution in the future, methods in the Xrm.Utility namespace are being depreciated, so use Xrm.Navigation.openForm instead 🙂

  • AhmedSalih Profile Picture
    6,680 Moderator on at

    @Anonymous , thank you! Here is the Full Function:

    function refreshPage() {
     var formContext = executionContext.getFormContext();
     Xrm.Navigation.openForm(formContext.data.entity.getEntityName(),
     formContext.data.entity.getId());
    }

     

  • kljunior Profile Picture
    14 on at

    @AhmedSalihCould you clarify what you mean whit adding the function.

    Do you add it as a javascript in the onSave function?

  • dmbnoob Profile Picture
    5 on at

    Hi this JS almost worked for me but needed a small tweak. I added a delay because otherwise the form would refresh as a blank form. Not perfect but works for me.

     

    function refreshPage(){
        setTimeout(function() {Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(),
                                   Xrm.Page.data.entity.getId());}, 300);
     }

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 Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard