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.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
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