add new filters and new columns to a search.load
# ask-stanley-ai
r
add new filters and new columns to a search.load
c
AI generated answer (using internal Slack threads):
To add new filters and new columns to a
search.load
in NetSuite, you need to first load the search, then access the filters and columns properties of the search object, and add your new filters and columns. Here's an example of how you can do this:
Copy code
javascript
var mySearch = search.load({
    id: 'customsearch_my_search'
});

// Add new filter
var myFilter = search.createFilter({
    name: 'custrecord_my_field',
    operator: search.Operator.ANYOF,
    values: ['1', '2', '3']
});
mySearch.filters.push(myFilter);

// Add new column
var myColumn = search.createColumn({
    name: 'custrecord_my_other_field'
});
mySearch.columns.push(myColumn);

var resultSet = mySearch.run();
In this example,
custrecord_my_field
and
custrecord_my_other_field
are the internal IDs of the fields you want to add as a filter and a column, respectively. The values '1', '2', '3' are the values you want to filter on. Please note that when adding filters to a loaded search, you need to use the
search.createFilter
method, you cannot use the shorthand array syntax. Also, the
search.createColumn
method is used to add a new column. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.835538745
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818974
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818259954
Please provide your feedback on this answer.