Ever run a Transaction saved search and get way more rows than you expected? You’re probably looking at line-level data without asking for it. When I was first learning NetSuite this was an issue I ran into a few times before learning the importance of this criteria. On Sales Orders, Invoices, Bills, and friends, NetSuite stores a header and a row per line item. Leave Main Line unset and you get both; so a 10-line order can show up as 11 rows (or more, once you add tax/shipping lines). The fix: add this criteria to almost every header-focused Transaction search: Filter: Main Line Operator: is Value: True (or T in a formula / SuiteScript filter) In SuiteScript that looks like: filters: [ ['mainline', 'is', 'T'], // ...other filters ] When to leave it off: you actually need item, quantity, amount, or other line fields. Then keep Main Line = F (or omit it) and be intentional about grouping/summarizing. Rule of thumb: if you care about the doc...
Need a customer name and email inside a SuiteScript? Loading the full record is the easy habit — and usually the expensive one. Use search.lookupFields when you only need a handful of values: var fields = search.lookupFields({ type: search.Type.CUSTOMER, id: customerId, columns: ['entityid', 'email'] }); var name = fields.entityid; var email = fields.email; Why it wins: Fewer governance units than record.load Faster on big records with lots of sublists Clear intent: “I only need these fields” Rule of thumb: if you’re not editing the record, don’t load it. Lookup what you need and move on.