NetSuite provides a powerful saved search feature to filter and display data, but when it comes to bulk adding a list of internal IDs to a saved search, the platform doesn’t offer a very friendly way to do it via the UI. If you’ve ever tried to filter by hundreds of internal IDs manually, you know how tedious and error-prone it can be.
In this blog, we’ll show you why this is useful, and how to solve it with a simple SuiteScript snippet.
Why You Might Need This
Imagine you have a set of records you need to monitor, report on, or export — maybe a list of transactions, customers, or custom records. You could:
- Export the records manually and filter them in Excel
- Build multiple saved searches for different record sets
But both approaches are cumbersome and not maintainable. By adding a list of internal IDs directly to a saved search, you can:
- Reuse the saved search for reporting or dashboards
- Quickly update the search when the set of records changes
SuiteScript Snippet to Add Internal IDs
Here’s a straightforward SuiteScript snippet you can use. It loads an existing saved search and appends a filter for a list of internal IDs.
This can run in a Browser developer console with a page related library loaded, or you can adapt it to run in a Suitelet.
require(['N/search'], function(search){
const savedSearchId = '';
const ids = [];
function updateSavedSearch(savedSearchId, ids) {
try {
let mySearch = search.load({ id: savedSearchId });
let filters = mySearch.filters || [];
filters.push(
search.createFilter({
name: 'internalid',
operator: search.Operator.ANYOF,
values: ids
})
);
mySearch.filters = filters;
let newId = mySearch.save();
console.log('Saved Search Updated', `New ID: ${newId}`);
return newId;
} catch (e) {
console.error('Error updating saved search', e);
}
}
updateSavedSearch(savedSearchId,ids);
})
How to Use the Script
1. |
the Saved Search ID Replace the savedSearchId variable with the internal ID of your saved search. You can find this ID in the saved search URL or in the search list. |
2. Prepare the List of Internal IDs Populate the ids array with the internal IDs you want to add. For example: |
const ids = [101, 102, 103, 104];
3. |
Deploy the Script |
- You can run this script in a Suitelet, User Event, or even the Script Debugger.
- Make sure the script has sufficient permissions to load and save the saved search.
- Run and Verify After running, your saved search will now include a filter for the specified internal IDs. Open the saved search in NetSuite to verify that the new filter has been added successfully.
Tips and Considerations
- If you run this frequently or for large lists, consider using a CSV import or API to generate the IDs dynamically. It may affect performance when loading the saved search in NetSuite UI (e.g., more than 100 IDs could be slow).
- Be careful not to overwrite existing filters unintentionally. This snippet appends a filter, preserving other filters. You can adapt the snippet to add multiple filter types (e.g., status, date ranges) if needed.
By using this approach, you can efficiently manage bulk internal ID filtering in saved searches without manual clicks or repetitive work, making your NetSuite reporting and automation much smoother.
Call to Action
Want to avoid this pitfall in your ERP journey? Join our October 16 webinar: 5 ERP Pitfalls (and How to Avoid Them) and download the free ERP Risk Mitigation Checklist to keep ROI at the center of your ERP planning.
About Us
Concentrus is a leading provider of innovative cloud-based enterprise resource planning (ERP) solutions, including NetSuite. Our team of NetSuite experts offers a range of services, including NetSuite price analysis, NetSuite training, and NetSuite integration services.
Our goal is to help businesses of all sizes maximize their investment in NetSuite by providing expert NetSuite cost optimization and implementation strategies. With years of experience as a NetSuite partner, our NetSuite administrators and NetSuite consultants are well equipped to help businesses of all sizes with their NetSuite consulting needs.
Whether you're looking for a NetSuite consultant to help with your NetSuite implementation or you need ongoing NetSuite support, Concentrus is here to help.
Read About Our Implementation Methodology
Want more NetSuite Tips and Tricks? Check out our Short & 'Suite videos