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
Client script to change sales order line item price levels
I'm struggling to build a simple client script that will change all price levels of items on a sales order to a level selected in a drop down box
The first item changes but then the script seems to stop at that point - so the first price level changes but doesn't commit and move to the next line
function changeDiscountLevel() { var itemcount = nlapiGetLineItemCount('item'); //select the first line item nlapiSelectLineItem('item',1); //for the line item iteration var i = 2; do { //set the current item price level to the drop down selected value (dropdown is 'custbody2') if(nlapiGetCurrentLineItemValue('item', 'price') != nlapiGetFieldValue('custbody2')) { nlapiSetCurrentLineItemValue('item', 'price', nlapiGetFieldValue('custbody2'), false,true); nlapiCommitLineItem('item'); i++; //get the next line item nlapiSelectLineItem('item',i); } } while(i <= itemcount); } } 0