Yvonne
Yvonne

Reputation: 31

SuiteScript 1.0 - Set pricelevel on line items

I've been trying to save my price level for a quote (estimate) in NetSuite using SuiteScript 1.0 (I want it to be a "Custom" price level, not "Base Price (exc. GST)").

I came across this post in StackOverflow, but trying that same method doesn't seem to set the price level for me and it always gets created as "Base Price (exc. GST)" regardless of what I try.

I was wondering if anyone might have managed to get this working using SuiteScript 1.0?

Here are two example approaches that I've tried (imagining there's a for loop around both):

1.

for (var i = 1; i <= items.length; i++) {
     quote.selectNewLineItem('item');
     quote.setCurrentLineItemValue('item', 'item', myId);
     quote.setCurrentLineItemValue('item', 'quantity', myQuantity);
     quote.setCurrentLineItemValue('item', 'rate', '100');
     quote.setCurrentLineItemValue('item', 'priceLevel', '-1'); // Custom price
     quote.commitLineItem('item');
}
for (var i = 1; i <= items.length; i++) {
     quote.setLineItemValue('item', 'item', i, myId);
     quote.setLineItemValue('item', 'quantity', i, myQuantity);
     quote.setLineItemValue('item', 'rate', i, '100');
     quote.setLineItemValue('item', 'pricelevel', i, '-1'); // Custom price
}

Thanks in advance

Upvotes: 0

Views: 1617

Answers (1)

Yvonne
Yvonne

Reputation: 31

So I had some help and was able to figure out what was causing the issue.

In my case, I was using 'pricelevel', but what I really should have been using was 'price' (see: https://1325230.app.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2021_1/script/record/estimate.html)

Then, setting that to '-1' seemed to do the trick. Shoutout to the intuitive naming in NetSuite but...at least now the script is up and running. Sample code below for anyone else who might come across this issue in the future:

for (var i = 1; i <= items.length; i++) {
     quote.setLineItemValue('item', 'item', i, myId);
     quote.setLineItemValue('item', 'quantity', i, myQuantity);
     quote.setLineItemValue('item', 'amount', i, '100');
     quote.setLineItemValue('item', 'price', i, '-1'); // Custom price
}

Upvotes: 1

Related Questions