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
- Join the NetSuite Professionals Slack Community, where you have instant access to over 200 NetSuite Professionals across the globe.
- Use the NetSuite Records Browser for the schema of all record types
- Mozilla Developer Network's JavaScript Reference Guide
Versions
Version | Release Date |
---|
2016.2 | 2016-09-20 |
Eclipse SuiteCloud IDE Setup
- Download and install the latest Eclipse IDE
- Install SuiteCloud IDE plugin
- Once installation is complete, launch Eclipse
- Navigate to Help > Install New Software...
- Click Add... to add a new Update Site
- Select "SuiteCloud IDE" site in the Work With dropdown
- Proceed through the install wizard
- Restart Eclipse when prompted
- Configure the SuiteCloud IDE plugin
- When Eclipse restarts, you will be prompted to set up the SuiteCloud plugin with a master password and default NetSuite account
- After completing this set up wizard, navigate to Preferences > NetSuite
- Here you will find all of the SuiteCloud IDE preferences
- [Optional] If your primary use for Eclipse is NetSuite development, navigate to Preferences > General > Perspectives and make the "NetSuite" Perspective your default
- Create a new NetSuite project
- Right-click in the NS Explorer window and select New > NetSuite project
- Follow the wizard for the project setup of your choosing. The project types are as follows:
- Account Customization: A project that leverages the SuiteCloud Development Framework for building custom objects, records, and scripts for customizing a NetSuite account.
- SuiteScript: A project used exclusively for writing scripts.
- 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
- Create the source file for your new Client Script
-
Create a new JavaScript file using your favorite editor or IDE
-
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!");
}
-
Save the file as hello-world.js
wherever you wish
- Use the source file we just created to create a new Script record in NetSuite
- In your NetSuite account, navigate to Customization > Scripting > Scripts > New
- When prompted, select
hello-world.js
as the Script File
- Click Create Script Record
- When prompted, select Client Script as the Script Type
- Name your Script record Hello World
- Map the function named
pageInit
in our source file to the Page Init script event by entering pageInit
in the Page Init Function field
- Save your new Script record
- Deploy your new Script to the Employee record
- On your newly created Script record, click Deploy Script
- In the Applies To field, select Employee
- Make sure the Status field is set to Testing
- Click Save
- See your script in action!
- Open your browser's developer/JavaScript console (typically F12 on most browsers)
- Create a new Employee by navigating to Lists > Employees > Employees > New
- Observe your "Hello, World" message in the browser console.
Hello, World 2.0 Client Script
- Create the source file for your new Client Script
-
Create a new JavaScript file using your favorite editor or IDE
-
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;
});
-
Save the file as hello-world2.js
wherever you wish
- Use the source file we just created to create a new Script record in NetSuite
- In your NetSuite account, navigate to Customization > Scripting > Scripts > New
- When prompted, select
hello-world2.js
as the Script File
- Click Create Script Record
- Name your Script record Hello World
- Save your new Script record
- Deploy your new Script to the Employee record
- On your newly created Script record, click Deploy Script
- In the Applies To field, select Employee
- Make sure the Status field is set to Testing
- Click Save
- See your script in action!
- Open your browser's developer/JavaScript console (typically F12 on most browsers)
- Create a new Employee by navigating to Lists > Employees > Employees > New
- Observe your "Hello, World" message in the browser console.