How would I detect whether an entry's asset field has been updated on save? We need to send a notification email when an entry's asset field, Custom Image, has been updated on entry save. We're able to do this consistently for text fields but I'm having trouble doing the same for an asset field.
// Use statements etc

...

// Register the event handler
Event::on(Entry::class, Entry::EVENT_AFTER_SAVE, [$this, 'handleAfterSave']);

...

public function handleAfterSave(ModelEvent $event): void
{
    $entry = $event-&gt;sender;
    $revisions = Entry::find()-&gt;revisionOf($entry)-&gt;status(null)-&gt;orderBy('revisionId DESC')-&gt;all();
    $lastRevision = Craft::$app-&gt;getElements()-&gt;getElementById($revisions[1]-&gt;id);

    $fields = Craft::$app-&gt;getFields();
    
    // text fields
    $notificationHandles = [
        'textField1',
        'textField2',
    ];
    $updatedFields = array_map(
        fn ($h) =&gt; [
            'fieldName' =&gt; $fields-&gt;getFieldByHandle($h)-&gt;name,
            'oldValue' =&gt; $lastRevision[$h],
            'newValue' =&gt; $entry[$h],
        ],
        // Only need to show field if different from last revision
        array_filter($notificationHandles, fn ($h) =&gt; $lastRevision[$h] !== $entry[$h])
    );
    
    if (count($updatedFields) &gt; 0) {
        self::$notifications-&gt;notifyUpdated($entry, $updatedFields);
    }
}

The above works for text fields. However, when adapting for an asset field, it appears that $lastRevision[$h] is not immediately updated.
If we have an entry with an empty Custom Image asset field:

Assign an image to Custom Image
Save
Email is sent
Return to the entry
Remove the asset from Custom Image
Save
No email is sent

To put it another way, if I have an entry with an empty Custom Image field:

Assign an image to Custom Image
Save
Email is sent
Return to the entry
Remove the asset from Custom Image
Save, but dump $lastRevision using EVENT_AFTER_SAVE
We can see that customImage is still null, where I would expect it to show the previously attached image (an AssetQuery etc)
No email is sent because both $lastRevision['customImage'] and $entry['customImage'] are null.

Thanks!
Have you tried the $element-&gt;isFieldDirty() method, or checking through the $element-&gt;dirtyFields array for your asset field, rather than checking revision dates?
There may be a good reason why you're not using those, but I thought I'd suggest it in case you hadn't considered it.