Elaine L
10/23/2025, 7:39 AMCeligo AI
10/23/2025, 7:40 AMAI generated answer (using internal Slack threads):Based on the conversations, here is a sample SuiteScript that converts saved search results to JSON:
javascript
var search = require('N/search');
function getSearchResults(searchId) {
var mySearch = search.load({
id: searchId
});
var searchResult = mySearch.run().getRange({
start: 0,
end: 100
});
var results = [];
searchResult.forEach(function(result) {
var resultJSON = {};
result.columns.forEach(function(column) {
resultJSON[column.name] = result.getValue(column);
});
results.push(resultJSON);
});
return results;
}
var searchId = 'customsearch_my_search'; // replace with your saved search id
var results = getSearchResults(searchId);
var resultsJSON = JSON.stringify(results);
This script loads a saved search by its ID, runs the search, and then iterates over the results. For each result, it creates a JSON object where the keys are the column names and the values are the corresponding values from the search result. It then pushes this JSON object to an array. Finally, it converts the array of JSON objects to a JSON string.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
10/23/2025, 7:40 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855285645
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.850463927
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846740723
Celigo AI
10/23/2025, 7:40 AM