You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否同时通过UI与SuiteScript 1函数添加筛选器并组合使用?

Can I Combine UI-Setup Filters with Additional SuiteScript 1 Filters for Item Searches?

Absolutely! You can absolutely combine UI-configured search filters with custom parameters added via SuiteScript 1—NetSuite handles this merging smoothly, and the final search results will respect both the UI-defined conditions and your script-added filters (they’re typically joined with an AND by default).

How to Implement This

Here’s a straightforward example of how to pull this off in SuiteScript 1:

  1. First, load your existing saved search that has UI-configured filters.
  2. Add your additional filters directly to the search object in your script.
  3. Run the search—NetSuite will automatically combine all filters.
// Load the saved search with UI-set filters
var itemSearch = nlapiLoadSearch('item', 'customsearch_my_ui_item_search');

// Add a script-specific filter to exclude inactive items
itemSearch.addFilter(new nlobjSearchFilter('isinactive', null, 'is', 'F'));

// Add another filter to limit results to specific locations
itemSearch.addFilter(new nlobjSearchFilter('location', null, 'anyof', ['2', '5']));

// Execute the combined search
var searchResults = itemSearch.runSearch();

// Process your results here...

Important Things to Remember

  • Default Filter Logic: All filters (UI + script) are joined with AND by default. If you need more complex logic (like mixing AND and OR), you can use itemSearch.setFilterLogic() to define a custom logic string (e.g., 1 AND (2 OR 3) where numbers correspond to filter positions).
  • Filter Overrides: If your script adds a filter that already exists in the UI search, the script’s filter will override the UI version. For example, if the UI has a filter for inactive = T and your script sets inactive = F, the script’s value will take priority.
  • Permissions: Ensure your script has access to the saved search (check the search’s permission settings and the script’s execution context to avoid access errors).

内容的提问来源于stack exchange,提问作者Ethan Freeman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:15:04