Wednesday, January 9, 2019

Create a Search Filter Using nlobjSearchFilter for a Select/Multiselect Field

This demonstrate how to use nlobjSearchFilter for select/multiselect fields.

On this sample code, the user wants to search all Sales Orders where Department is HR or Sales.

function SearchSOs()
{
    var filters = new Array();
    filters[0] = new nlobjSearchFilter('mainline', null, 'is', 'T');
    filters[1] = new nlobjSearchFilter('class', null, 'anyof', ['1','13']); // 1 - Internal ID of HR; 13 - Internal ID of Sales

    var results = nlapiSearchRecord('salesorder', null, filters, null);
 
    for (var i in results) 
    {
    //process record
    }
}

No comments:

Post a Comment