=====
Grid Static ID: detailsid
Column Static ID:
- ALLOCATION_NEED
- ALLOCATION_AMOUNT
=====
Create Dynamic Action On Page Load.
Action Name: Row Level New Allocation Check
Action: Execute JavaScript Code
Code:
function validateAllocationAmount() {
var amountInput = document.getElementById('ALLOCATION_AMOUNT');
var needInput = document.getElementById('ALLOCATION_NEED');
if (amountInput && needInput) {
amountInput.addEventListener('change', function() {
var amount = parseFloat(this.value) || 0;
var need = parseFloat(needInput.value) || 0;
console.log("Direct Event - Amount:", amount, "Need:", need);
if (amount > need) {
apex.message.alert("New Allocation cannot be greater than Allocation Need!");
this.value = need; //auto input actual need value
}
});
console.log("✅ Allocation Amount validation attached successfully!");
} else {
console.log("⏳ Inputs not found, retrying...");
setTimeout(validateAllocationAmount, 500);
}
}
validateAllocationAmount();
