I have a working script to check
1. Item available quantity is <=5,
2. popup a message " Available quantity is running low, please reorder".
However, the behaviour is not consistent.
1. When first item added is = 0, it gives the default netsuite message saying that item is .. 0 in back order, 0 available - which is fine.
2. If first item added is >= 5 but not 0, it gives my message saying"Available quantity is running low..."
Then, if my script was triggered first, it will never display the Netsuite message when item is less than or equal 0 again and not let user enter anything else or save the record.
How can I make sure my script caters to all cases.
1. when item is <= 0, display netsuite message
2. when item is <= 5 but >=1, display my script message and let user move on to the next line item.
and I also want to add in what the "Available" is but can't get it to display the value. What is the function to show the value?
My script is below
//Alert to check item quantity <=5
function checkQuantity()
{
var QtyAvailable=nlapiGetCurrentLineItemValue("item", "Available");
if(QtyAvailable<="5")
{alert("Available quantity is running low, please reorder"); return false;}
return true;
}