简体   繁体   中英

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM