I have a script that is called from a button on a sales order. It takes the customer's id and price level and applies them as filters to a saved search.
This script works perfectly well for the first customer however if you change the customer on the sales order without refreshing the page and click the button again it returns the same search results.
I checked and it seems to be pulling the new filter values correctly (customer id and price level from the second customer).
The code below is just a snippet of the entire function but it contains everything that I can imagine would be relevant.
var customer=nlapiGetFieldText('entity'); alert(customer) var customerid=nlapiGetFieldValue('entity'); alert(customerid) var pricelevel=nlapiGetFieldValue('custbody_pricelevel'); alert(pricelevel) if (customer!=null && pricelevel!=null && customer!='' && pricelevel!=''){ var pricelevelid=nlapiGetFieldValue('custbody_pricelevel'); for (y=0;y<2;y++){ if (y==0){ arrfilters[0] = new nlobjSearchFilter('custrecord_limitspricelevel',null,'is',pricelevelid); arrfilters[1] = new nlobjSearchFilter('custrecord_limitcustomerid',null,'anyof','@NONE@'); arrsearchlimitsresults=nlapiSearchRecord('customrecord_orderlimits','customsearch_orderlimitssearch',arrfilters); } else{ arrfilters[0] = new nlobjSearchFilter('custrecord_limitcustomerid',null,'anyof',customerid); arrsearchlimitsresults=nlapiSearchRecord('customrecord_orderlimits','customsearch_orderlimitssearch',arrfilters[0]); }Thanks for any help.