Adding or replacing filter to the existing Search

We can add a new filter to the existing search or we can remove an existing filter in a search using suitescript.

   //create filters for search filters:"createddate","onorbefore","threedaysago"
                var filters = searcResult.filters;
                var filterOne = search.createFilter({
                    name: 'createddate',
                    operator: search.Operator.ONORBEFORE,
                    values: threedaysago
                });
                //replace filter created date in the UI with that of script
                //0 is the position where to delete
                // 1 is the deleate count
                //filterOne is the new filter to add 
                filters.splice(0,1,filterOne)
                // log.debug('searcResult',searcResult);

Leave a comment

Your email address will not be published. Required fields are marked *