
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2020 01:55 AM
Hello Developers,
We have requirement for Service Portal catalog form. We need to redirect from one form to another form without knowing the end user. If end user selects any particular value then form will redirect to another form but we are getting alert box -
"Changes you made may not be saved". Thing is if they click on cancel, they will not redirect to another form and we want to prevent this case.
Is there anyway to disable this alert for particluar catalog form only.
Thanking you.
Regards,
Akshay
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2020 04:54 AM
correct! so we cant say that it comes from browser level.
although before redirecting we can use this code to avoid that popup.
top.window.onbeforeunload = null;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2020 04:54 AM
correct! so we cant say that it comes from browser level.
although before redirecting we can use this code to avoid that popup.
top.window.onbeforeunload = null;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2020 05:26 AM
I had this similar question in past to change that message.
Also I could find that such type of message do come using chrome. I haven't tried with other browser
for reference:
https://support.google.com/chrome/thread/8565697?hl=en
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2020 06:19 AM
Hello Hammad,
Thank you so much. It's working.
Regards,
Akshay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2020 06:31 AM
I am gald its working. Happy coding
thanks
hammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2021 03:22 AM
Hello @hammad
Can you help this as I have the same problem of an alert appearing on my onSubmit client script.
I tried your code but it didn't work, can you help please?
function onSubmit() {
//Type appropriate comment here, and begin script below
var num = g_form.getValue("number");
if(num) {
//g_form.submit();
top.window.onbeforeunload = null;
top.window.setTimeout(redirectUrl,1000);
}
function redirectUrl() {
top.window.location = "https://digitalenergydev.service-now.com/sn_customerservice_l3_case_type.do?sysparm_query=number=" + num;
}
}