I've confirmed the same logic works fine with sear...
# suitescript
k
I've confirmed the same logic works fine with search.create, it just doesn't seem to like overwriting
search.columns
for some reason?
b
go through the Property Description of Column.sort
k
Good call, I missed a very important paragraph.
After you create a column, you cannot change the sort order of the column. If you use the same column in another search and specify a new sort order, the previous sort order is still used.
a
You can load the search and simply replace the .columns, meaning re-create them and re-add them to .columns.
k
Replace how? I tried searchObj.columns =
a
Did you tried adding the column like this:
Copy code
searchObj.columns.push(search.createColumn({name: 'internalid'}));
// Adding your sort option using the native method "createColumn"?
k
Wouldn't that just add a duplicate of the original column? Oh but I suppose the last one in determines the sort order?