Sample script to give a warning when a sales order is created for a specified amount

function saveRecord(scriptContext) {
        var currentRecord = scriptContext.currentRecord;
        var totalAmount = currentRecord.getValue({ fieldId: 'total' });


        if (totalAmount <= 10000) {
            var con = confirm("Total amount is less than 10000. Click OK to continue");
            if (con) {
                return true;
            } else {
                return false;
            }
        } else {
            return true;
        }
    }


    return {
        saveRecord: saveRecord
    };

Leave a comment

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