Video: Learn how to Avoid NetSuite “Do you want to leave this site” Message

This article is relevant if you are a NetSuite SuiteScript developer and you want to improve the user experience of your SuiteLets and other NetSuite forms.

Background

When working with NetSuite record data, NetSuite tries to help you not lose your work by warning you with a message: “Do you want to leave this site? Changes you made may not be saved.” with a “Stay or Leave” option.   There are times that you simply don’t want this message.

In some recent SuiteLet development work, I needed to ask the user for information that was available via a drop down.  Once information was selected in the URL, I wanted to reload the SuiteLet passing the information as a parameter in the URL.   NetSuite dutifully would warn as I tried to automatically navigate away to a new page.  I wanted to avoid the message as it produced an undesirable experience.

Client Side Script to Resolve

The key to solve this is to simply wipe away NetSuite’s underlying mechanism producing the warning.  The following JavaScript snippet does this for you in your client side script:

//avoid the standard NetSuite warning message when navigating away
if (window.onbeforeunload){
   window.onbeforeunload=function() { null;};
};

To see this in action, review the following 1 minute video:

NetSuite Innovation Leadership

If you enjoy producing solutions on the NetSuite platform like I do, perhaps it makes sense to work together to help bring advanced innovations to the NetSuite community.  Drop me a message and let’s have a conversation about your ambitions

Be Sociable, Share!

Marty Zigman

Holding all three official certifications, Marty is Southern California's NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 25 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to setup a conversation.

More Posts - Website - Twitter - Facebook - LinkedIn - Google Plus - YouTube

| Tags: , | Category: NetSuite, Technical | Leave a comment

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>