How can we change parentid of note and attachment using apex. I wonder if we could even do that. Any help would be appreciated.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
The parent ID is not writeable after insert. You will have to copy the attachment / note to a new attachment/note, then set the parent id there. Insert the new one, and delete the old one.
Nope, you cannot directly update the ParentId field on the note and attachments. You can find more information on the below link what all you can update or insert.
There is a workaround to change the parentId, it involves the below step: