How to Disable the "Changes You Made May Not Be Saved" Alert on a Specific ServiceNow Catalog Form
- nathanlee142
- Mar 19
- 3 min read
Updated: Mar 29

When working with catalog forms in the ServiceNow Service Portal, you may encounter an alert message: "Changes you made may not be saved." This prompt typically appears when navigating away from a modified form without saving changes. While this feature helps prevent users from accidentally losing important data, certain scenarios require this functionality to be disabled. For instance, if your process involves automatically redirecting users between forms based on specific inputs, you might need to prevent this alert from appearing to maintain a seamless user experience.
In this article, we'll explore why this alert occurs, outline common scenarios, and demonstrate a verified method to disable it specifically for your catalog form.
Understanding the Alert and Common Causes
The alert, "Changes you made may not be saved," is designed to warn users when they attempt to leave a modified form without saving. It originates from the ServiceNow Service Portal's default behavior and is triggered by the browser's onbeforeunload event.
Common causes for this alert include:
Unsubmitted changes on a catalog form.
Client scripts that automatically redirect users based on form input changes.
Custom navigation logic between multiple catalog items.
The challenge arises when your business process necessitates automatic navigation without interruption. In such cases, this alert becomes an obstacle.
Verified Solution: Disabling the Alert for Specific Catalog Forms
Here's a verified solution to disable the alert for specific catalog forms using ServiceNow's client-side scripting capabilities. Follow the steps below to implement:
Step-by-step Instructions:
Navigate to the specific catalog item within the ServiceNow Service Portal.
Open the Catalog Item and select the Client Script tab.
Create or open your existing "onChange" client script, where you handle the redirection.
Before initiating the redirection, insert the following JavaScript code snippet:
top.window.onbeforeunload = null;
Explanation:
The code snippet effectively disables the browser-level alert by setting the browser's onbeforeunload event to null just before the redirect.
This prevents the warning from appearing when navigating away from the modified form.
Example Use Case:
Suppose you have a dropdown field "Request Type". Selecting a specific request type requires immediate redirection to another related catalog form:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == oldValue) {
return;
}
if (newValue == 'special_request_type') {
// Disable the alert
top.window.onbeforeunload = null;
// Redirect to the specified catalog item
window.location.href = '/sp?id=sc_cat_item&sys_id=YOUR_TARGET_CATALOG_ITEM_SYS_ID';
}
}
Replace YOUR_TARGET_CATALOG_ITEM_SYS_ID with the actual sys_id of the catalog item you want to redirect to.
Alternative Solutions
While the above method is the most direct and targeted approach, here are two alternatives you might consider:
Globally Disable Alerts: Modify the system property glide.ui.dirty_form_support to false. However, this impacts all forms across the entire ServiceNow instance, which might not be desirable.
Resetting Form State: Using g_form.modified = false; before redirection might work on regular backend forms but typically does not affect Service Portal forms.
Thus, the targeted JavaScript method described above remains the recommended solution.
Conclusion
The "Changes you made may not be saved" alert is essential for preventing unintended data loss. However, automatic redirection scenarios in ServiceNow's Service Portal might require temporarily disabling this functionality. By strategically implementing the JavaScript solution provided, you can enhance your user's experience by ensuring smooth, uninterrupted navigation between forms.
Implement this approach carefully to ensure that the functionality only applies to intended forms, maintaining the integrity of data input on all other forms.