Grumpy Bunny
Grumpy Bunny

Reputation: 17

Netsuite - Validate Line Item Function to Check Duplicates

I try to compare the current line item index with the line number and see if they are the same with a new sales order. If the two numbers are the same then skip the validation otherwise check if they are the same item. However, it doesn't always return the line number which I wonder why.

Here are the two variables that I want to compare:

var linenum= nlapiGetCurrentLineItemValue('item','line');
var currentIndex = nlapiGetCurrentLineItemIndex('item');

linenum does return a number sometimes but most of the time it returns null; when that happened the comparison doesn't work. When I logged the variables, index always shows up correct. Is there any other parameter I can use to grab information from creating sales order page?

Any idea/suggestion would be appreciated!

Upvotes: 0

Views: 1523

Answers (1)

NetSuite Help
NetSuite Help

Reputation: 228

var linenum= nlapiGetCurrentLineItemValue('item','line');

linenum will only have a value if the line was saved previously. If linenum is null it means the user is trying to add a new Line item and not edit.

Upvotes: 0

Related Questions