function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Display an alert message when navigating to another tab without saving the data

HI All


In salesforce, when creating new objects and navigating to any other object ( or any other tab/ application/any other part of the application) in the application all data is lost unless saved before. 

Is it possible to display a message asking the user to save the object before navigating to the other tab or other part of application?  we are using standard detail pages for the objects


Please help!


Using standard detail pages? No.


Using Visualforce pages? Yes, using the onbeforeunload event on the page.


Hope this helps,