Disable alert "Changes you made may not be saved." for particular catalog form on Service Portal

Community Alums
Not applicable

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.

find_real_file.png

 

Thanking you.

Regards,

Akshay

1 ACCEPTED SOLUTION

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;

View solution in original post

25 REPLIES 25

try this

function onSubmit() {
	//Type appropriate comment here, and begin script below
	var num = g_form.getValue("number");
	if(num) {
		//g_form.submit();
		
		top.window.setTimeout(redirectUrl,1000);
	}
	function redirectUrl() {
         top.window.onbeforeunload = null;
		top.window.location = "https://digitalenergydev.service-now.com/sn_customerservice_l3_case_type.do?sysparm_query=number=" + num;
	}
}

Thanks a lot for your reply Hammad.

The redirection is working fine, but before redirection it is giving this popup alert, I have to click on Leave and then only it submits the form and takes me to correct redirection.

find_real_file.png

How can I solve this? We want redirection to happen directly without any alert

I tried the above code and its not showing any popup for me.

please contact me here


+923063231735 WhatsApp

email:hammad702@gmail.com

 

we can further discuss.

Hi Hammad, 

 

Where do we need to add this?

Regards, 

Rushi

Community Alums
Not applicable

Hello Ankur,

Yes, I am redirecting by using Catalog On change Client script. I tried by clearing values and setting to Old value but it is not working on Service Portal. It's working on native.

 

Thanks & Regards,

Akshay