Hello all,
Having a problem adding another filter to a saved search in SuiteScript 2.0.
We have a saved searched and now I want to use that saved search in a Portlet script. Okay using the search no problem. My problem comes in where I want to add a date filter to the search to be used in the script. Every time I would get an error. Could not figure out what the error was all about. I changed to filter on salesrep. Well no error but the filter is ignored. I am finding very little information on adding a filter to a saved search in 2.0.
Here is the code. You can see both the latest date and salesrep filter attempts. I have tried many operators without success. Search is a transaction search.
var mySearch = search.load({id: 'customsearch1193'});
var dateone = format.parse({
value: '10/01/2016',
type: format.Type.DATE
});
var datetwo = format.parse({
value: '10/10/2016',
type: format.Type.DATE
});
//mySearch.filters.push(search.createFilter( {name: 'createddate', operator: search.Operator.BETWEEN, values:[dateone,datetwo]} ));
mySearch.filters.push(search.createFilter( {name: 'salesrep', operator: search.Operator.IS, values:['reps name here']} ));
mySearch.save();
mySearch.run().each(function(result) {
do stuff......
return true;
});
So how do you add a filter to a saved search???
Thanks,
Karen