Discussions
Join the NetSuite community to innovate, connect, and discover what’s next.
SuiteWorld brings thousands of innovators, builders, and leaders together to learn, connect, and shape what’s next. This October, explore how to build a stronger foundation for growth through inspiring keynotes, major product reveals, hands-on sessions, and unforgettable moments—all in one place for our biggest event of the year. Register now
Searching especifics tasks
I need lists tasks whose status is terminated, but I dont know how. I find this in other thread but dont work...
///////////////////////********************/////////////////////////////
var filters = new Array();
filters[0] = new nlobjSearchFilter('company', null, 'is', salesOrder.getFieldValue(TRANSACTION_FIELDS.ENTITY));
filters[1] = new nlobjSearchFilter('status', null, 'noneof', new Array(TASK_STATUSES.COMPLETE));
var columns = new Array();
columns[0] = new nlobjSearchColumn('status');
columns[1] = new nlobjSearchColumn('transaction');
var results = nlapiSearchRecord(REC_IDS.TASK, null, filters, columns);
if(results != null)
{
var filteredResults = new Array();
for(var i = 0; i < results.length; i++)
{
if(results[i].getValue('transaction') == salesOrder.getId())
{
filteredResults[filteredResults.length] = results[i];
}
}
// Do stuff with the filtered results