Sciuridae54696d
06/16/2022, 8:56 AMrequire(['N/record','N/runtime','N/search','N/format'], function(record,runtime,search,format) {
try{
const recordType = record.Type.CASH_SALE; //'cashsale'
const recordType2 = search.Type.CASH_SALE;//'cashsale'
const recordType3 = "CashSale"
var transactionSearchObj = search.create({
type: "transaction",
filters: [
["type", "anyof", recordType3],
"AND",
["mainline", "is", "T"],
],
columns: [search.createColumn({name: "internalid", label: "Internal ID"})],
});
var searchResultCount = transactionSearchObj.runPaged().count;
//log.debug("transactionSearchObj result count", searchResultCount);
/*
transactionSearchObj.run().each(function(result) {
matched = true;
recId = result.id;
return false;
});
*/
var abc = 1;
} catch (e) {
var scriptId = runtime.getCurrentScript().id;
log.error('ERROR:'+scriptId+':fn:'+runtime.executionContext, JSON.stringify({type: e.type,name: e.name,message: e.message,stack: e.stack,cause: JSON.stringify(e.cause),id: e.id}));
}
});
why would the search enum not equal "CashSale" ???
And why doesn't the search work with the enum???CD
06/16/2022, 9:13 AMtype: "transaction",
?Sciuridae54696d
06/16/2022, 9:23 AMCD
06/16/2022, 9:24 AMvar transactionSearchObj = search.create({
type: search.Type.CASH_SALE,
`CD
06/16/2022, 9:24 AMCD
06/16/2022, 9:24 AMSciuridae54696d
06/16/2022, 12:54 PMSandii
06/16/2022, 2:12 PMShawn Talbert
06/16/2022, 2:49 PMsearch.Type
enum only applies to the type
property when creating the search. It doesn't apply to filter values.Marvin
06/22/2022, 10:03 PManyof
operator you want to pass the values as an array.
Like this:
["type", "anyof", ["cashsale", "salesorder"]]