Script Trigger Circus
Arggh. Script triggers are giving me fits. Get all kinds of unpredictable behavior. Is there any good plain English explanation of when and how to use the different script triggers? The "before event" and "after event" etc. terminology is very confusing to me. Specifically, the "Object" set I can't seem to wrap my brain around.
Today, I was trying to display a warning dialogue when a portal record amount exceeds the amount of a field value in the parent record. Got the script but none of the "Object" script triggers work right. Tried "on save, on modify, on exit, on validation". Am I using the wrong set of triggers for this situation?
In other words, record A has a value of 100. Values of related records to A in another table should total up and not EXCEED the value of 100. The field in record A is AMOUNT and the calculated field in A that totals the amounts in the related records is ALLOCATED_AMOUNTS. So if there are 3 related records each of which has a value of 30 in the AMOUNT field, the value of ALLOCATED_AMOUNTS in Record A calculates to 90 and is therefore OK because it doesn't exceed 100. I think the issue is when is the value of ALLOCATED_AMOUNTS calculated. Apparently, it only changes AFTER the related record is added.
Anyhow, hope this is clear enough to get some help. Stumped on it.