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.
Update: Narrative Insights has been restored and is now available.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
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