Announcements
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?
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,AhmedIf 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
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
@Anonymous, try this function to reload the full page:
function refreshPage(){ Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId()); }
@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 🙂
@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()); }
@AhmedSalihCould you clarify what you mean whit adding the function.
Do you add it as a javascript in the onSave function?
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.
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 551
WarrenBelz 430 Most Valuable Professional
Valantis 298