Expand your SuiteScript skills in the Sustainable SuiteScript community for NetSuite developers.

Learn SuiteScript by Example

... not by Trial and Error

Documentation is often wrong or not detailed. Would be useful to see functional examples of more aspects of SuiteScript."

"Lack of learning resources. The official documentation is poor, requires a NS login, has errors, is incomplete..."

"... having more code examples would be the most helpful for me.

In order to help you learn, remember, and ultimately master the fundamental concepts of NetSuite Development, I've created this SuiteScript by Example series of "Cookbooks", as real-world, example-focused references for SuiteScript 2.1.

Each Cookbook contains between 6 and 10 examples to help you learn and apply a particular module or aspect of SuiteScript development.

The best part? They're completely free.

I'm only able to make these free because of the members of the Sustainable SuiteScript community. We are a community of NetSuite developers who want to deepen our technical skills, expand our professional network, and raise the bar for SuiteScript development.

Join us today.

The Cookbooks

Download Cookbooks

Basic Searching with SuiteScript 2.1

Learn fundamental structures for effective searches with the N/search module.

Details Searches, reports, and analytics are some of the most commonly requested NetSuite customizations a SuiteScript developer is asked to create. In order to build these types of features, you must have a solid foundation of knowledge on SuiteScript's searching capabilities.

Basic Searching with SuiteScript 2.1 is intended to help you build that solid foundation through realistic, functional examples.

In this cookbook, you'll see examples of:

  • The fundamentals of creating and executing a Search with SuiteScript
  • The various methods of iterating over and processing search results
  • How to load and execute a Saved Search in SuiteScript
  • How to specify Joins to related records in your search filters and columns
  • How to use Summaries like summing in your search results
  • How to create Filter Expressions for your searches
  • How to get the number of results for a particular search

Advanced Searching with SuiteScript 2.1

Advanced Searching with SuiteScript 2.1 builds on the foundation established in Basic Searching in SuiteScript; it is intended to help you create more advanced, complex NetSuite Searches using the SuiteScript API.

Details

Advanced Searching with SuiteScript 2.1 is intended to help you build that solid foundation through realistic, functional examples.

In this cookbook, you'll see examples of:

  • How to process very large (4,000+) result sets using Paging
  • How many Results does this Search return? (Without having to run the Search twice)
  • Which Employees have logged overtime this week? (How to use Summary Filters)
  • How do I compare values between Search Columns?
  • Which Time Entries were entered late? (How to use Formula Filters and Columns)
  • Which Employees have zero time entries? (How to search for absence of something)

Transaction Searches with SuiteScript 2.1

Transactions are a critical aspect of any business' operations, and as a SuiteScript developer, no matter where you work, you must be able to build key reports and analytics based on Transactions.

Details Transaction Searches in SuiteScript builds on the foundation established in [Basic Searching in SuiteScript](/cookbooks/basic-search/) and [Advanced Searching in SuiteScript](/cookbooks/advanced-search/); it is intended to help you understand the nuances of searching Transactions via SuiteScript.

In this cookbook, you'll see examples of:

  • What are the totals on the 10 most recent Sales Orders?
  • How many of each Item were ordered last month?
  • What are the Most Recent Sales Orders?
  • What are the Oldest Return Authorizations?
  • What are the Most Recent Sales Orders, with the Highest Amounts First?
  • What is the Amount of the Most Recent Sales Order by Customer?
  • Which Sales Rep had the Top Transaction in each Month?
  • Who is the Contact for the Most Recent Case Filed by a Customer?
  • What are all the unapproved Return Authorizations from last month?
  • How much On Hand Inventory do I have for each Item?
  • What is my Inventory breakdown at a specific Location?

Sending Email with SuiteScript 2.1

This cookbook is intended to provide you with practical examples for sending communication via email using SuiteScript's N/email module.

Details

In this cookbook, you'll see examples of:

  • Sending a simple email
  • Sending an email to multiple recipients, including CC and BCC functionality
  • Sending an HTML email
  • Sending an email using a template
  • Attaching files to an email
  • Linking an email to a NetSuite record

Managing Files with SuiteScript 2.1

This cookbook is intended to provide you with practical examples for working with Files via email using SuiteScript's N/file module.

Details

In this cookbook, you'll see examples of:

  • Loading an existing file
  • Creating a new file
  • Relocating a file
  • Deleting a file
  • Streaming data into a file
  • Reading contents of a file line by line

Rendering PDFs with SuiteScript 2.1

This cookbook is intended to provide you with practical examples for rendering PDFs using SuiteScript's N/render module.

Details

In this cookbook, you'll see examples of:

  • Displaying a PDF for a user
  • Downloading a PDF for a user
  • Rendering a PDF using a Template
  • Rendering a PDF from custom XML
  • Rendering Record data in a PDF Template
  • Rendering Saved Search results in a PDF Template
  • Rendering Query results in a PDF Template
  • Rendering custom data sources in a PDF Template

Basic Queries with SuiteScript 2.1

NetSuite's Workbook functionality exposes the most powerful, flexible, useful Analytics the platform can provide. In order to build these Workbooks, you must have a solid foundation of knowledge on SuiteScript's querying capabilities.

Basic Querying in SuiteScript is intended to help you build that solid foundation through realistic, functional examples utilizing SuiteScript's N/query module.

Details

Basic Queries with SuiteScript 2.1 is intended to help you build a foundation of realistic, functional Query knowledge.

In this cookbook, you'll see examples of:

  • The fundamentals of creating and executing a Query with SuiteScript
  • How to iterate over and read data from Query results
  • How to get the number of results for a particular Query
  • How to specify Joins to related records in your Query Condtions and Columns
  • How to sort Query results
  • How to load and execute a Saved Workbook in SuiteScript

Basic Optimization with SuiteScript 2.1

Error: SCRIPT_EXECUTION_USAGE_LIMIT_EXCEEDED

How many times has this error ruined your day?

Basic Optimization with SuiteScript 2.1 is intended to provide you with practical examples for reducing governance usage, reducing execution time, and increasing performance in your SuiteScript.

Details

In this cookbook, you'll see examples of:

  • Minimizing Log Entries
  • Leveraging Inline Editing
  • Consolidating Lookups and Inline Edits
  • Eliminating Loads or Lookups on Associated Records
  • Eliminating Repeated Lookups of Same Type
  • Avoiding Searches or Queries from Loops
  • Reducing Repetition in Common SuiteScript Tasks

Download Cookbooks