Any see why my filter isn't working? I am loading ...
# suitescript
m
Any see why my filter isn't working? I am loading a saved search in client (fieldChanged) script. I am taking the customer internal ID to pass to the filter, but it's returning me address for all customers:
Copy code
var customer_internal_id = customer_id;
            var customer_search_obj = search.load({
                id: "customsearch_customer_add_search"
            });
            customer_search_obj.filters.push({
                name: 'internalid',
                operator: 'is',
                value: customer_internal_id
            });

            var myPagedData = customer_search_obj.runPaged({
                "pageSize": 1000
            });
            log.debug({title: "Count", details: myPagedData.count});
            myPagedData.pageRanges.forEach(function (pageRange) {
                var myPage = myPagedData.fetch({index: pageRange.index});
                myPage.data.forEach(function (result) {

                    const internal_id = result.getValue({
                        name: 'internalid',
                    });
                    const addressinternal_id = result.getValue({
                        name: 'addressinternalid',
                    });
                    const  address = result.getValue({
                        name: 'address'
                    });

                    //TODO - work with return data
                    return true;
                });
            });
s
when you push into the search.filters, you need to push in a searchFilter, not a generic object. Turn your object into a searchFilter with search.createFilter
👍 1
m
thanks, I have it working