Why doesn’t my Territory Assignment validation work correctly for the Quantity field?

The isAttributeChanged('Quantity') validation Groovy script for the opportunity Quantity field always evaluates to true on Territory Assignment rules even when the value hasn’t actually changed. This can cause Revenue Territory Assignment validations to behave unexpectedly.

Use the compareTo ('Quantity') logic to compare the old and new quantity values. The compareTo script validates whether the value of the opportunity revenue quantity has changed so that territory assignment works as expected.