Remove Standard Leave Site Popup in Suitelet forms

Jira Code : 552

Description

The custom form created using Suitelet script will show the Standard Leave Site Popups while we navigate away. We can also remove this popup by using the following code. We can add the following code in the page Init entry point of the Client script which is associated with the Suitelet form.

image

Solution

/**
 * Function to be executed after page is initialized.
 *
 * @param {Object} scriptContext
 * @param {Record} scriptContext.currentRecord - Current form record
 * @param {string} scriptContext.mode - The mode in which the record is being accessed    (create, copy, or edit)
 *
 * @since 2015.2
 */
 function pageInit(scriptContext)
 {
     recordObj = currentRecord.get();
     //To remove the Leave Site Popup 
     if (window.onbeforeunload)
     {
         window.onbeforeunload = function ()
         {
            null;
          };
     }
     return true;
 }

Leave a comment

Your email address will not be published. Required fields are marked *