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);