When iterating through search results, I know I ca...
# suitescript
m
When iterating through search results, I know I can store the value for each result column like this:
Copy code
searchObj.run().each(function (result){
let colA  = result.getValue('columnA');
let colB  = result.getValue('columnB');
}
However, is it possible to store all columns in a single variable?, I tried, to no avail:
Copy code
searchObj.run().each(function (result){
// I was expecting allRes to contain an object, each column as key with its respective value
let allRes = result.values;
}
b
safest is making your own values object
👍🏼 1
the less safe alternative is to use result.toJSON()
m
Got it, I'll build my own object. I was just wondering if I was missing anything. Thank you.