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.
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