I tried a search script in NetSuite and the problem I'm having is that the search is getting several results despite I put the order number in the transaction table search. If I do the same search by the IU I just get 1 result which is the correct one.
The script is
var filters = new Array();
filters[0] = new nlobjSearchFilter('item', null, 'is', 'ITEM123');
filters[1] = new nlobjSearchFilter('type', null, 'is', 'SalesOrd');
filters[2] = new nlobjSearchFilter('companyname', 'customer', 'contains', 'CustomerName');
filters[3] = new nlobjSearchFilter('number', null, 'is', 'ORDER9887');
var columns = new Array();
columns[0] = new nlobjSearchColumn('item');
columns[1] = new nlobjSearchColumn('type');
columns[2] = new nlobjSearchColumn('name','item');
columns[3] = new nlobjSearchColumn('companyname','customer');
columns[4] = new nlobjSearchColumn('number');
var searchResults = nlapiSearchRecord('transaction', null, filters, columns);
var values = 'TOTAL RESULTS: ' + searchResults.length;
if(searchResults != null)
{
for( i = 0 ; i< searchResults.length ; i++)
{
values = values + '\r\nITEM ' + searchResults[i].getValue(columns[0]) +
'\r\nTYPE ' + searchResults[i].getValue(columns[1]) +
'\r\nITEM NAME ' + searchResults[i].getValue(columns[2]) +
'\r\nCOMPANY NAME ' + searchResults[i].getValue(columns[3]) +
'\r\nTRANSACTION NUMBER ' + searchResults[i].getValue(columns[4]);
}
alert(values);
}
So it doesn't make much sense to me, it's suppose that filters are implicitly with an AND operator.
Is there any clue which I'm doing wrong?
Thanks in advance.
Pablo.