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

Rajesh Kannan G
ServiceNow Employee
ServiceNow Employee

Akshay,

I assume you have a client script to navigate to another page, have you tried g_form.clearValue() before navigating to another page.

Regards,

Rajesh

Community Alums
Not applicable

Hello Rajesh,

 

Thanks for the reply. Yeah I have written on change client script. I have tried to clear the value before redirection but above pop up appears first then value is getting cleared.

 

Regards,

Akshay

Try this, Before navigating away set the modified to false

g_form.modified = false;

This worked in regular form, not quite sure about catalog forms.

Regards,

Rajesh

Rajesh Kannan G
ServiceNow Employee
ServiceNow Employee