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.
Please note that on Saturday, April 11, 2026, at 8:00 PM Pacific time, our Case Management System will undergo a scheduled maintenance for approximately 30 minutes. During this time, case creation via SuiteAnswers will be unavailable and inbound calls will be routed to Customer Service.
Trouble with some Scripting - Wont run :-( PLEASE HELP
Hi there, I am putting the following code into an item template, and rightly or wrongly, I am expecting it to search the current item and tell me how much stock is (available) at location (1). Am I missing something major here, do I need to insert it somewhere differently, or add code to make it run? At present it appears to do nothing, even looking at the source, I can see my code, but there are no results in it.....
function beforeSubmit(type) { var itemRecord = nlapiGetNewRecord() var vitemId = itemRecord.getId(); var filters = new Array(); filters[filters.length] = new nlobjSearchFilter('internalid', null, 'anyof', vitemId, null) filters[filters.length] = new nlobjSearchFilter('inventorylocation', null, 'anyof', 1, null) var columns = new Array(); columns[columns.length] = new nlobjSearchColumn('inventorylocation',null,null); columns[columns.length] = new nlobjSearchColumn('locationquantityavailable',null,null); var searchresults = nlapiSearchRecord('item', null, filters, columns); for ( var i=0; searchresults != null && i < searchresults.length; i++) { var searchresult = searchresults[i]; var vinventorylocation = searchresult.getValue('inventorylocation'); var vlocationquantityavailable = searchresult.getValue('locationquantityavailable'); // The v12:33pm is to make sure there is not a cached version of this *.js nlapiLogExecution("Debug", "ItemLocation Values", "v12:33pm-" + vinventorylocation + 0