🔍 Saved Search Optimization Tricks in NetSuite
🧠 Why Saved Search Optimization Matters
Saved Searches are one of the most powerful tools in NetSuite — they drive dashboards, KPIs, workflows, and even integrations.
But poorly optimized searches can slow down your instance, cause timeouts, or return incomplete data.
This guide covers proven techniques to make your saved searches faster, cleaner, and easier to maintain.
⚙️ 1. Keep It Focused – Use Filters Effectively
A saved search is only as efficient as its filters.
✅ Best Practices:
- Use indexed fields (like internal IDs, type, date, or status) in your main filters.
- Avoid text fields for primary criteria when possible.
- Always set date ranges (e.g., “Last 30 days”) instead of leaving the filter open-ended.
🧩 Example:
Instead of:
Date Created – “on or after” – empty
Use:
Date Created – “within last” – 30 days
This dramatically reduces result size and processing time.
⚙️ 2. Use Summary Types Wisely
Grouping data helps generate reports, but excessive summary layers slow performance.
✅ Tips:
- Use “Summary” only when required for totals, counts, or averages.
- Avoid unnecessary summary joins (especially on transactions or inventory items).
- For dashboards, prefer pre-summarized searches rather than real-time summaries.
🧩 Example:
When displaying total sales by customer:
Group by: Customer
Field: Amount (Sum)
⚙️ 3. Reduce Joins and Use Simple Criteria
Each joined record (like customer → sales order → item) increases query time.
✅ Best Practices:
- Limit joined fields — use only what’s required.
- Don’t pull unrelated joins (like employee > location) unless truly necessary.
- If you need multi-level joins, consider using SuiteQL instead.
🧩 Example:
A Saved Search that joins Customer > Sales Order > Item Fulfillment may run slowly.
Instead, use a transaction search with filters for type = Sales Order
and related fulfillment criteria.
⚙️ 4. Use Formula Fields Efficiently
Formula fields are powerful, but can easily become performance bottlenecks.
✅ Do:
- Use
CASE WHEN
logic only for limited conditions. - Keep formulas short and efficient.
- Prefer simple field references over nested formulas.
🧩 Example:
CASE WHEN {status} = 'Pending Fulfillment' THEN 'Open' ELSE 'Closed' END
❌ Avoid: deeply nested CASE
with multiple joins — that slows things down.
⚙️ 5. Limit Displayed Columns
Every displayed column adds overhead.
✅ Best Practice:
- Show only fields you actually use in dashboards, exports, or integrations.
- If a search is only used by a script, limit it to internal IDs and essential values.
🧩 Example:
If a Scheduled Script just needs id
and tranid
, don’t display 15 other fields.
⚙️ 6. Use “Available Filters” for Flexibility
Add Available Filters for interactive searches instead of hardcoding everything.
This allows users to refine results dynamically without modifying the search.
🧩 Example:
Add:
- Subsidiary
- Location
- Date
So end users can filter without editing the base search.
⚙️ 7. Use SuiteQL for Complex Queries
When searches require multiple joins or subqueries, switch to SuiteQL.
SuiteQL is faster and supports SQL-like syntax directly within SuiteScript.
🧩 Example:
const query = `
SELECT id, tranid, total, status
FROM transaction
WHERE type = 'SalesOrd'
AND datecreated >= TO_DATE('2025-01-01', 'YYYY-MM-DD')
`;
const resultSet = query.runSuiteQL({ query });
SuiteQL:
- Executes faster
- Handles multi-level joins better
- Works well in SuiteScript for reporting and integrations
⚙️ 8. Clone Instead of Rebuilding Searches
When creating variations, clone an existing search instead of starting from scratch.
This ensures consistent filters and reduces maintenance overhead.
🧩 Example:
If you have a “Sales Orders This Month” search, clone it and adjust the date filter for “This Quarter.”
⚙️ 9. Avoid Using “Any of” With Too Many Values
Large “Any of” filter lists (hundreds of IDs) slow down queries.
✅ Better Alternatives:
- Use a custom field or saved search join to narrow results.
- If filtering by many records (like customers), consider temporary categorization using a custom field or group record.
⚙️ 10. Schedule Searches for Heavy Loads
For large datasets (like daily reports or integrations):
- Run saved searches via Scheduled Scripts or Map/Reduce processes at off-peak hours.
- Store results in custom records or CSV exports to reduce real-time load.
💡 Pro Tip: Use the Execution Log
To see how long your search takes:
- Go to Customization → Scripting → Script Execution Log
- Or use Script Governance Monitoring
- You can also log timestamps in your script:
const start = new Date(); // run search
const end = new Date();
log.audit('Time taken (ms)', end - start);
📋 Summary Checklist
✅ Keep filters indexed and time-bound
✅ Avoid excessive joins and columns
✅ Use formulas sparingly
✅ Prefer SuiteQL for complex queries
✅ Clone searches for consistency
✅ Schedule heavy searches for off-peak hours