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.
Comments
Post a Comment