I am trying to fetch the results of a saved search programmatically using a restlet. The saved search is for all open sales and I have set it to show the job number, company and date created. Results look fine in a csv however when I fetch them through a script the company names come as internal ids instead of the actual company names. How can I make so that Netsuite returns the actual company display names. Example script below:
/**
* @NApiVersion 2.0
* @NScriptType Restlet
* @NModuleScope SameAccount
*/
define([
'N/search',
], function (search) {
function getSearch() {
var s = search.load({
id: "customsearch123",
});
var results = [];
var slice = [];
var i = 0;
var resultSet = s.run();
do {
slice = resultSet.getRange({ start: i, end: i + 999 });
slice.forEach(function(row) {
var resultObj = {};
row.columns.forEach(function(column) {
resultObj[column.name] = row.getValue(column);
});
results.push(resultObj);
i++;
});
} while (slice.length >= 1000);
return JSON.stringify(results);
}
return {
get: getSearch
};
});
Instead of row.getValue, use row.getText.