Annotations not moved automatically

When I use Smart Rule action Move to database to move a document, the Annotation is moved automatically (I have that set in Preferences). However, when I use AppleScript to move the document, the Annotation is not moved.

move record theRecord to theLocation

Is this the expected behaviour? Do I need to separately handle the move of Annotation (if any) when I move a document using AppleScript?

AppleScript usually doesn’t depend on preferences to ensure that scripts work the same for all users. Therefore the script would have to move the annotation record on its own too if desired.

OK. I tried to write the script to move the annotation record after moving the main document.

set theAnnotation to annotation of theRecord
set theNewRecord to move record theRecord to theLocation
move record theAnnotation to (annotations group of database of theNewRecord)

I noticed something different in the links.

In the original document & annotations, there are both incoming link and outgoing link for both the document & annotations.

After using AppleScript to make the move of both document & annotations, there is no incoming link for both the document & annotations.

If I use Control-Command-M to move the main document again (which will auto move the annotations), the incoming link is back for both document & annotations.

Did I use the AppleScript correctly to move both document & annotations? I hope the database structure for the document & annotations didn’t spoiled by my AppleScript.

It’s unfortunately a bug, the next release will fix this.