Dear all,
I am trying to prompt a user before the tab is closed if the form is dirty and has unsaved changes.
For example: A case tab is opened inside Unified Service Desk and it has unsaved changes and if the user attempts to close this tab it should give a warning either to stay on the page or close the tab.
I know I can use Xrm.Page.data.entity.getIsDirty() to check if the form is dirty or not. But i am having issues where should I run this script and how should I warn users before closing.
There will be 2 buttons on my dialog box ok and cancel. Ok will lead to closing the tab where as cancel will allow user to return to the same tab again and save the unsaved changes.