Module 1: Introduction to SuiteScript

Week 1 • NetSuite SuiteScript 2.0 Training • ~45 minutes

🎯 Learning Objectives

1. The 6 SuiteCloud Platform Tools

NetSuite provides six powerful tools for customization, collectively called the SuiteCloud Platform:

ToolPurposeRequires Code?
SuiteBuilderPoint-and-click UI customization (fields, forms, records)No
SuiteFlowVisual workflow automation with diagramsNo
SuiteScriptExtend NetSuite with JavaScript codeYes
SuiteTalkSOAP/REST APIs for external integrationYes
SuiteAnalyticsReports, dashboards, and saved searchesNo
SuiteBundlerPackage customizations for deploymentNo
🎯 When to Use SuiteScript

Use SuiteScript when you need to:

  • Build features not available in NetSuite
  • Create complex automation beyond SuiteFlow's capabilities
  • Integrate third-party services
  • Customize behavior programmatically
💡 Real-World Example: Box.com Integration

A company needed online collaboration for expense reports. Solution: SuiteScript uploads attachments to Box.com automatically, then stores the Box URL back on the NetSuite record. Users edit files online without downloading.

2. NetSuite Data Model

🚫 Important Difference

NetSuite does NOT give you direct SQL database access! Data access works differently than traditional database programming.

Instead of SQL tables, NetSuite organizes data into Records grouped into 5 categories:

The 5 Record Categories

CategoryWhat It StoresExamples
EntityPeople & organizationsCustomers, Vendors, Employees, Partners
TransactionMoney movementSales Orders, Invoices, Purchase Orders, Bills
CRMBusiness activitiesEvents, Tasks, Phone Calls, Cases
ItemProducts & servicesInventory Items, Service Items, Discounts
CustomYour custom dataAnything you create
✅ Why Categories Matter

Same Category = Similar Structure

Scripts written for one record type easily adapt to others in the same category. A Customer script can become a Vendor script with minimal changes (both are Entity Records).

Different Category = Major Changes

Moving a Customer script (Entity) to Sales Order (Transaction) requires significant modifications.

3. Web Architecture

Understanding where code runs is crucial for SuiteScript development:

AspectClient-Side (Browser)Server-Side (NetSuite)
Runs InUser's browserNetSuite servers
Response TimeImmediate feedbackRequires server round-trip
GovernanceNo units consumedConsumes governance units
Use CasesField validation, UI interactionsData processing, record creation
Script TypesClient ScriptUser Event, Scheduled, Map/Reduce, etc.

4. The 10 Script Types

Here's an overview of all script types — we'll cover each in detail later:

Script TypeWhen to UseLocation
Client ScriptUser interactions on forms (validation, defaults)Client
User EventBefore/after record operations (load, submit)Server
Workflow ActionExtend SuiteFlow workflow capabilitiesServer
ScheduledRun scripts on a schedule (nightly, weekly)Server
Map/ReduceProcess thousands of records efficientlyServer
SuiteletCustom UI pagesServer
RESTletREST API endpoints for integrationServer
PortletDashboard componentsServer
Mass UpdateBulk update records via UIServer
Bundle InstallationCustom installation logic for bundlesServer

🏋️ Practice Exercises

Exercise 1: Identify the Tool

For each scenario, identify which SuiteCloud tool would be best:

  1. Adding a "Priority" dropdown field to Customers
  2. Automatically sending an email when a Sales Order is approved
  3. Connecting to a shipping provider's API to get tracking numbers
Exercise 2: Categorize Records

Classify these records into their categories: Invoice, Contact, Task, Assembly Item, Support Case

🎯 Key Takeaways

  • 6 SuiteCloud Tools: SuiteBuilder (UI), SuiteFlow (workflows), SuiteScript (code), SuiteTalk (integration), SuiteAnalytics (reports), SuiteBundler (deployment)
  • No SQL Access: NetSuite uses Records, not direct database access
  • 5 Record Categories: Entity, Transaction, CRM, Item, Custom
  • Records in Same Category: Share similar structure, scripts easily cross-apply
  • 10 Script Types: Each designed for specific use cases
  • Client vs Server: Understand where your code runs