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.
Applying Coupon Code via Suitescript
I am trying to create a sales order and apply a coupon code to the order via suitescript however I always receive "invalid couponcode reference key 123"
If I exclude the coupon code and go into the sales order I have created I can apply the code 123 without issue.
Am I missing something obvious here?
Code I am using is:
// Create a new sales order and set the customer var record = nlapiCreateRecord('salesorder'); record.setFieldValue('entity', 1645); record.selectNewLineItem('item'); record.setCurrentLineItemValue('item', 'item', 1008 ); record.setCurrentLineItemValue('item', 'quantity', '1'); record.setCurrentLineItemValue('item', 'custcol9', '1123123'); record.commitLineItem('item'); record.setFieldValue('couponcode', 123); var id = nlapiSubmitRecord(record, true); 0