How could i migrate all related Attachments and Notes from a custom object to Cases?

We had a customized case object which we're trying to migrate, so far we've succesfully migrated all the custom fields, triggers, classes and everything we needed.

Exporting our custom cases from the Dataloader didn't migrate the related attachments, maybe because in this particular relation the parent is the Attachment and not the custom object.

So, how could i migrate all related attachments to a case? or to a new custom object?


Simplest way would be to create an apex batch class to do attachment migration. ParentId field in attachment is not editable. So you will have to create another attachment instance with same body,name,description and type. Then insert it with new parentId. Then if insertion is success, delete the old attachment.

  • Thanks, will wait a couple days to marking it as the answer to wait for another alternatives or workarounds – FuuRe May 4 '15 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.