In new release, Netsuite allows to use Filter Expression for advance search. Earlier we had to use nlobjSearchFilter API to filter a search which makes filtering records as per our requirements much easier.
To start we have to check the Use Expressions checkbox to set advance criteria a feature previously not available in suitescript.
Now we can do the same using code.
Here is the with sample code:
var filterExpression = [
[
[
['custrecord_strt_date', 'before', startDate],
'and',
['custrecord_strt_date', 'before', endDate]
],
'and',
[
['custrecord_end_date_custom', 'after', startDate],
'and',
['custrecord_end_date_custom', 'after', endDate]
]
],
'and',
['internalidnumber', 'notequalto', recordId],
'and',
['custrecord_customer', 'is', customer]
];
//Search contract record with above criteria
var contractResults = nlapiSearchRecord("customrecord_contract_pricing_custom_rec", null, filterExpression, null);