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
Setting a line item value to null
We have a few defaults set up for sales entry but for the majority of our products we don't need them so I made a script that should set them to null.
function beforeSubmitSalesOrderDefaults(type) { if (type == 'create') { var newRecord = nlapiGetNewRecord(); for (var i = 1;i <= newRecord.getLineItemCount('item'); i++) { var desc = newRecord.getLineItemValue('item','item_display',i); if (desc.indexOf('82002') == 0) { /*do nothing*/ } else if (desc.indexOf('82002') == 0) { /*do nothing*/ } else if (desc.indexOf('82004') == 0) { /*do nothing*/ } else if (desc.indexOf('pDNA0') == 0) { /*do nothing*/ } else if (desc.indexOf('pDNA1') == 0) { /*do nothing*/ } else if (desc.indexOf('3000') == 0) { /*do nothing*/ } else { //undo defualts nlapiSetLineItemValue('item','custcol3',i,null); nlapiSetLineItemValue('item','custcol6',i,null); } } } } 0