Alert when an item with quantity greater than Reorder point is selected in the Sales Order

//Info: POW-292

function validateLine(context) {
                if (context.sublistId == "item") {
                    var currentRecord = context.currentRecord;
                    var itemid = currentRecord.getCurrentSublistValue(
{sublistId: 'item', fieldId: 'item'});                    
                    var itemtype = currentRecord.getCurrentSublistValue(
{sublistId: 'item', fieldId: 'itemtype'});
                    var locationId = currentRecord.getCurrentSublistValue({sublistId: 'item', fieldId: 'location'});

                    var qtyEntered = currentRecord.getCurrentSublistValue({sublistId: 'item', fieldId: 'quantity'});
                    console.log("Qty Entered", qtyEntered)
                    if (itemid && locationId) {


                       //function where item details were collected
                        var resultObj = searchItemDetails(itemid, locationId)
                      
                        var obj = resultObj['data']
                            if (qtyEntered >= reorderPointNew) {
                                alert("Please note the order quantity exceeds the reorder point for this item and may result in a stock out for this item.");
                            };
        }
    }
}

Leave a comment

Your email address will not be published. Required fields are marked *