netsuite

Getting started with netsuite

Remarks#

NetSuite is a cloud-based ERP, CRM, E-Commerce, and Professional Services management platform. It is used by over 30,000 companies to run their entire business.

NetSuite is fully customizable by administrators and developers, including via a JavaScript-based API called SuiteScript. Developers are able to write scripts that are triggered by various events throughout the NetSuite system to automate business processes.

Where to get Help

  1. Join the NetSuite Professionals Slack Community, where you have instant access to over 200 NetSuite Professionals across the globe.
  2. Use the NetSuite Records Browser for the schema of all record types
  3. Mozilla Developer Network’s JavaScript Reference Guide

Versions#

VersionRelease Date
2016.22016-09-20

Eclipse SuiteCloud IDE Setup

  1. Download and install the latest Eclipse IDE
  2. Install SuiteCloud IDE plugin
    1. Once installation is complete, launch Eclipse
    2. Navigate to Help > Install New Software…
    3. Click Add… to add a new Update Site
    4. Select “SuiteCloud IDE” site in the Work With dropdown
    5. Proceed through the install wizard
    6. Restart Eclipse when prompted
  3. Configure the SuiteCloud IDE plugin
    1. When Eclipse restarts, you will be prompted to set up the SuiteCloud plugin with a master password and default NetSuite account
    2. After completing this set up wizard, navigate to Preferences > NetSuite
      • Here you will find all of the SuiteCloud IDE preferences
    3. [Optional] If your primary use for Eclipse is NetSuite development, navigate to Preferences > General > Perspectives and make the “NetSuite” Perspective your default
  4. Create a new NetSuite project
    1. Right-click in the NS Explorer window and select New > NetSuite project
    2. Follow the wizard for the project setup of your choosing. The project types are as follows:
      1. Account Customization: A project that leverages the SuiteCloud Development Framework for building custom objects, records, and scripts for customizing a NetSuite account.
      2. SuiteScript: A project used exclusively for writing scripts.
      3. SSP Application: A SuiteScript Server Pages application, used typically in conjunction with SiteBuilder or SuiteCommerce for NetSuite-backed E-Commerce applications.

Hello, World 1.0 Client Script

  1. Create the source file for your new Client Script
    1. Create a new JavaScript file using your favorite editor or IDE

    2. Add the following source code to your file (original source here)

      /**
       * A simple "Hello, World!" example of a Client Script. Uses the `pageInit`
       * event to write a message to the console log.
       */
      
      function pageInit(type) {
          console.log("Hello, World from a 1.0 Client Script!");
      }
    3. Save the file as hello-world.js wherever you wish

  2. Use the source file we just created to create a new Script record in NetSuite
    1. In your NetSuite account, navigate to Customization > Scripting > Scripts > New
    2. When prompted, select hello-world.js as the Script File
    3. Click Create Script Record
    4. When prompted, select Client Script as the Script Type
    5. Name your Script record Hello World
    6. Map the function named pageInit in our source file to the Page Init script event by entering pageInit in the Page Init Function field
    7. Save your new Script record
  3. Deploy your new Script to the Employee record
    1. On your newly created Script record, click Deploy Script
    2. In the Applies To field, select Employee
    3. Make sure the Status field is set to Testing
    4. Click Save
  4. See your script in action!
    1. Open your browser’s developer/JavaScript console (typically F12 on most browsers)
    2. Create a new Employee by navigating to Lists > Employees > Employees > New
    3. Observe your “Hello, World” message in the browser console.

Hello, World 2.0 Client Script

  1. Create the source file for your new Client Script
    1. Create a new JavaScript file using your favorite editor or IDE

    2. Add the following source code to your file (original source here)

      define([], function () {
          /**
           * A simple "Hello, World!" example of a Client Script. Uses the `pageInit`
           * event to write a message to the console log.
           *
           * @NApiVersion 2.x
           * @NModuleScope Public
           * @NScriptType ClientScript
           */
          var exports = {};
          function pageInit(context) {
              console.log("Hello, World from a 2.0 Client Script!");
          }
          exports.pageInit = pageInit;
          return exports;
      });
    3. Save the file as hello-world2.js wherever you wish

  2. Use the source file we just created to create a new Script record in NetSuite
    1. In your NetSuite account, navigate to Customization > Scripting > Scripts > New
    2. When prompted, select hello-world2.js as the Script File
    3. Click Create Script Record
    4. Name your Script record Hello World
    5. Save your new Script record
  3. Deploy your new Script to the Employee record
    1. On your newly created Script record, click Deploy Script
    2. In the Applies To field, select Employee
    3. Make sure the Status field is set to Testing
    4. Click Save
  4. See your script in action!
    1. Open your browser’s developer/JavaScript console (typically F12 on most browsers)
    2. Create a new Employee by navigating to Lists > Employees > Employees > New
    3. Observe your “Hello, World” message in the browser console.

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow