Prashant Pokhrel
Prashant Pokhrel

Reputation: 1

Model Driven App: How to remove the default alert to save changes while using Navigation

I am trying to use the Report main form to create a new Report however, I am using a custom ribbon button on Report Main Form called "Generate Report". Then I am using the javascript webresource to generate the report which uses fetch XML to get the data from dataverse table and convert it to csv format and uploads the file to the newly generated report, once the report is created I want to navigate the user to the Report edit form that has been generated by passing the newly generated Report GUID id. Everything is working fine but whenever I want to navigate to the newly generated report from the create Report form the alert pops up saying to save changes before leaving the page as shown in the image below. I want to remove that alert message just for the report form when the generate report button is clicked which navigates back to the newly generated report. alert message which i want to get rid of code to create report and navigate to the edit form

Upvotes: 0

Views: 772

Answers (1)

Harinarayanan
Harinarayanan

Reputation: 409

What you have to do is on click of GenerateReport button invoke below

formContext.data.save(saveOptions).then(successCallback, errorCallback);

On successCallback you can do all your operations associate or attach your generated data and once completed, refresh the form using data.refresh javascript api.

more info below

https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/formcontext-data/save

Additionally you can add Progress Indicator to block the ui https://learn.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/xrm-utility/showprogressindicator

Upvotes: 0

Related Questions