Hi everyone,
I have a Power Automate Flow which updates a field on a custom dataverse table.
Could anyone share the JS syntax for automatically refreshing the section or page when that field changes? The reason I think I would need to refresh the section/page (the equivalent of clicking the Refresh button) is that I have an embedded canvas app in a section which needs to be updated when the field value changes.
My thinking is that I could place the field in a different section and run the JS function on the OnChange property against it.
best regards,
Eiken Thank you for the solution. Unfortunately, although the function triggers perfectly when changing a field inside the form, it seems a javascript function cannot trigger when a field has been changed by an external connector (in this case, Power Automate).
There is a Power Automate flow which updates that field. In the video below, you can see the event triggers when I change the field directly inside the form, but the event does not trigger when a Power Automate Flow changes that field.
I still find your solution very helpful though so I marked as Solved.
If you happen to know if it is indeed possible to trigger the refresh, please let me know.
[View:/cfs-file/__key/communityserver-discussions-components-files/761/recording.mp4:1440:1080]
Hi,
Please use the following API:
formContext.data.refresh(save).then(successCallback, errorCallback);
Please check the detail of this API.
data.refresh (Client API reference) in model-driven apps - Power Apps | Microsoft Learn
Now please refer to my steps.
Edit the refreshpage function.
function refreshpage(e){
var formContext = e.getFormContext();
formContext.data.refresh(true).then(function(result){
alert('Refreshed!!')
});
}
Add On change event to the selected field.(Now I choose ""Name")
It works well.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156