Notes and attachments migration issues.
Question:
I attempted to import attachments from the Account object using this query:
SELECT Id, ParentId, Title, IsPrivate, Body FROM Note WHERE Parent.Type = 'Account'
However, the Plugin failed to insert records and displayed this error:
[ERROR] Error during execution of the command:
Name, ParentId, CreatedBy.Name, Parent.Name FROM Attachment
^
ERROR at Row:1:Column:136
No such column 'Name' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
Execution of the command sfdmu:run has been finished. Exit code 4 (COMMAND_EXECUTION_ERROR).
What am I doing wrong?
Answer:
The error occurs because ParentId is a polymorphic field. You must explicitly define the
parent object type.
You can do it directly in the query. Here is the corrected version:
SELECT Id, ParentId$Account, Title, IsPrivate, Body FROM Note WHERE Parent.Type = 'Account'
If you are migrating file-like entities end-to-end (ContentVersion/Attachment/Note with binary
handling), use core:ExportFiles as the recommended approach.