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
Asked
Active
Viewed 89 times
0
-
That alert is appearing because something has changed on the form. Is your custom ribbon button making any changes? Has a Business Rule or other automation made any changes? – jasonscript May 18 '23 at 01:43
-
Yes the form has been changed because I clicking on +New button and entering the details there, but I have used JS to get the data entered there, created the record and updated using JS once the custom command button is clicked. However when I tried to navigate it is giving me an alert. I want o disregard the default alert while navigating disregarding the changes made on the form as the record has been already created using JS – Prashant Pokhrel May 19 '23 at 03:36
-
You'll need to update your question with your code because it's not clear to me what you're doing. You could update your script to save the record before opening the web resource ...? – jasonscript May 19 '23 at 07:22
1 Answers
0
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
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

Harinarayanan
- 375
- 1
- 9