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.
This pop-up only shows when there is unsaved field change on form.
You can try this code to find out the unsaved fields:
Xrm.Page.data.entity.getDataXml():
After this, if you still want to ignore the field change and the pop-up, you can set the SubmitMode property to "never":
formContext.getAttribute("new_accounthierarchy").setSubmitMode("never")