Skip to content

A Custom Event meant to validate one just-entered field's value against another field entered in the very same transaction (e.g. comparing a newly entered custom Net Weight against a newly entered standard Gross Weight on the same save) can't actually see the sibling field's just-entered value when it runs inside an autonomous transaction. Why, and how is this validation actually implemented?

Answer

This is the classic autonomous-transaction mutating-table limitation — code running under PRAGMA AUTONOMOUS_TRANSACTION executes in its own separate transaction, so it can't see uncommitted changes still pending in the outer transaction that's still in the process of saving the record, even though both values are being entered together in what looks like one single save action. The practical workaround is to move the validation to a later point where a genuinely separate, already-committed transaction exists to hook into — for example, a downstream history/audit-trail record that only gets created after the original record's transaction has actually committed, rather than trying to validate within the same transaction the fields were entered in. This only works cleanly as long as there's no further uncommitted activity happening in between the original save and that later event firing.

← Browse Developer Studio, deployment, and upgrades questions