NetSuite Input Dialog v2.0

What do you do when you need to capture user input just before they submit a form or right after they click that “Approve” or “Reject” button? The answer is simple: Use the NetSuite Input Dialog!

NetSuite Input Dialog in Action

  • NetSuite’s N/ui/dialog module does not include an input dialog although there are situations where capturing user input based on dynamic criteria is necessary.
  • Existing solutions compromise on user experience, are rigid, and/or are too tightly coupled with NetSuite’s internal dependencies which may change without notice.
  • The NetSuite Input Dialog illustrated above is built on NetSuite’s dialog module, thereby providing a native, elegant, and easy-to-integrate answer to the input dialog problem.
  • This module could be yours right now, at no cost, for use in your non-commercial and commercial projects; grab it here!

/**

 * @NApiVersion 2.0

 * @NScriptType ClientScript

 * @NModuleScope SameAccount

 */

define([‘/SuiteScripts/netsuite-insights.com/utils/NSI_CM_InputDialog’],

 

function(nsiInputDialog) {

  /**

   * Validation function to be executed when record is saved.

   */

  function saveRecord() {

    var options = {

      title: ‘Input Dialog’,

      message: ‘Please enter your rejection reason below:’,

      buttons: [{

        label: ‘Reject’, 

        value: 1

      },{

        label: ‘Cancel’,

        value: 2

      }],

      textarea: {

        rows: 6,

        cols: 48,

        isMandatory: true,

        caption: ‘Rejection Reason’,

        fieldId: ‘memo’,

        actionButtons: [1]

      }

    };

 

    var failure = function (reason) {

      console.log(‘Failure: ‘ + reason);

    }

     

    var success function (result, value) {

      alert(‘Input dialog closed by clicking button ‘ + result + ‘ | value: ‘ + value);

      // Do something with the actual result here.

    }

     

    nsiInputDialog.create(options, success, failure);

  }

  

  return {

    saveRecord: saveRecord

  };

});

Leave a comment

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