Casebook

Problems we keep finding in NetSuite accounts

Each entry is one habit from real code: what you notice, why it happens, and how it looks in SuiteScript 2.1. Examples are rewritten from scratch; no client code.

Illustrative sketches, rewritten from scratch. Not run in a NetSuite account; NetSuite validation pending.

  • 01
    • The script that saves the record twice
    • Set the value in beforeSubmit, or submitFields after save
    Read the case
  • 02
    • A lookup on every line
    • Collect the IDs, run one search, build a map
    Read the case
  • 03
    • The hand-rolled 1,000-row paging loop
    • search.runPaged, or Map/Reduce for very large jobs
    Read the case
  • 04
    • Yield and reschedule tricks
    • Move the job to Map/Reduce
    Read the case
  • 05
    • The catch block that logs at Debug
    • log.error with the record ID, and stop the save when data must not go through
    Read the case
  • 06
    • One helper, pasted into about 210 files
    • One shared library module, loaded with define
    Read the case

Seeing one of these in your account? We can tell you how many scripts it affects.

Book a review