Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Saved Search Filter in SuiteScript
I am trying to pull the quantity billed for an item, based on a UI-created saved search that pulls in sales orders for all items. Having difficulty with passing the item to filter by on to the search in SS. My first attempt at doing so, so I am hoping I am missing something simple.
function afterSubmit(type)
{
if (type == 'edit');
var results = nlapiSearchRecord('salesorder','customsearch109', new nlobjSearchFilter('item',null,'is','01839 Test'));
var mtd = 0;
for(var i = 0; results != null && i < results.length; i++)
{
var val = results[i].getValue('quantitybilled');
mtd = parseFloat(mtd) + parseFloat(val);
}
nlapiSetFieldValue('custitem_mtd',mtd);
0