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.
- 01Read the case
- The script that saves the record twice
- Set the value in beforeSubmit, or submitFields after save
- 02Read the case
- A lookup on every line
- Collect the IDs, run one search, build a map
- 03Read the case
- The hand-rolled 1,000-row paging loop
- search.runPaged, or Map/Reduce for very large jobs
- 04Read the case
- Yield and reschedule tricks
- Move the job to Map/Reduce
- 05Read the case
- The catch block that logs at Debug
- log.error with the record ID, and stop the save when data must not go through
- 06Read the case
- One helper, pasted into about 210 files
- One shared library module, loaded with define
Seeing one of these in your account? We can tell you how many scripts it affects.
Book a review