I have a SuiteScript Suitelet with this search in it:
var itemfulfillmentSearchObj = search.create({
type: "itemfulfillment",
filters:
[
["type","anyof","ItemShip"],
"AND",
["trandate","within","today"],
"AND",
["location","anyof","2"],
"AND",
["mainline","any",""],
"AND",
["taxline","is","F"],
"AND",
["shipping","is","F"],
"AND",
["cogs","is","F"],
"AND",
["shipmethod","noneof","35"],
"AND",
["custbody_cust_pickedby","noneof","@NONE@"]
],
columns:
[
search.createColumn({
name: "formulatext",
summary: "GROUP",
formula: "{custbody_cust_pickedby}",
label: "Picked By"
}),
search.createColumn({
name: "tranid",
summary: "COUNT",
label: "Fulfilments"
}),
search.createColumn({
name: "lineuniquekey",
summary: "COUNT",
sort: search.Sort.DESC,
label: "Lines"
})
]
});
And this returns the results sorted correctly by the Count of the lineuniqukey column (from largest to smallest).
However, if I remove the sort: line from the third column and put it in the second (the Count of the tranid column) - then the results are not sorted in the correct order (they don't appear to be sorted in any accurate order).
Is there any logical reason why the search will work on one Count field, but not the other?