Working of a cancel button using Suite Script

Cancel button is using the NetSuite for back to the record. We set the confirm messages using the Suitelet script. Most of the confirm messages has 2 options. One for accept the confirm message other for cancel . If we cancel the message ,the flow goes back to record

/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */
define(['N/action', 'N/currentRecord', 'N/error', 'N/http', 'N/https', 'N/log', 'N/record', 'N/runtime', 'N/search', 'N/ui/dialog', 'N/ui/message', 'N/url'],
/**
 * @param{action} action
 * @param{currentRecord} currentRecord
 * @param{error} error
 * @param{file} file
 * @param{http} http
 * @param{https} https
 * @param{log} log
 * @param{record} record
 * @param{runtime} runtime
 * @param{search} search
 * @param{dialog} dialog
 * @param{message} message
 * @param{url} url
 */
function(action, currentRecord, error, http, https, log, record, runtime, search, dialog, message, url) {
    
    /**
     * 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) {

    }

    function cancelPo() {
      try {
           
window.close();
          
} catch (e) {
        console.log("error@cancelPo",e)
      }
    }

  return {
     pageInit: pageInit,
    cancelPo: cancelPo
    };
    
});

Leave a comment

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