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.
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.
TypeError: Cannot read property "0" from undefined (ATP.js$1362849#42)
Hi,
This is my first real script and I'm getting this error. I ran it through the console and had no problems with it, however it tosses this error when I upload it and try to create a sales order.
The error occurs in line 4 of this code on the demand[j].rawValues[0].value .
function makeComparisons(itemList, itemQuantity, demand, supply){ for ( var i = 0; itemList != null && i < itemList.length; i++){ for (var j = 0; demand != null && j < demand.length; j++){ if (itemList[i] == demand[j].rawValues[0].value){ if( parseInt(itemQuantity[i]) <= parseInt(demand[j].rawValues[2].value) && demand[j].rawValues[2].value != ""){ var today = nlapiGetFieldValue('trandate'); var dateToSet = stringtodate(modifyDateByDays(today,3)); nlapiSelectLineItem('item',parseInt(j)+1); nlapiSetCurrentLineItemValue('item','custcol_expect_ship_date_so_line',dateToSet.dateFormat('m/d/y')); } else { if(demand[j].rawValues[2].value > 0){ itemQuantity[i] = (parseInt(itemQuantity[i]) - parseInt(demand[j].rawValues[2].value)); } } } } } 0