Copying the Full Script

This section shows the full sample script. If you haven't already created the script file by following the steps in Writing the Client SuiteScript File, copy and paste the following code into a text file. Save the file and name it helloWorld.js.

          /**
 *@NApiVersion 2.1
 *@NScriptType ClientScript
 */


define(['N/ui/dialog'],

    function(dialog) {

        function helloWorld() {

            var options = {
                title: 'Hello!',
                message: 'Hello, World!'
            };
        
            try {
           
                dialog.alert(options);
           
                log.debug ({
                    title: 'Success',
                    details: 'Alert displayed successfully'
                });
        
            } catch (e) {
           
                log.error ({ 
                    title: e.name,
                    details: e.message
                });           
            } 
        }
              
    return {
        pageInit: helloWorld
    };
}); 

        

Related Topics

General Notices