function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Migrating rich text fields with images

Hi All,


I'm trying to copy some custom objects that have a rich text field included in them from a sandbox org back to it's production org. I've tried doing this with the data loader but the images came over as broken links - likewise with copying and pasting the data between orgs.


Is there really no way to move the image data over along with the rich text fields? This seems like a major oversight if so.




We too had a similar situation, and the SF premier support's answer was "No". Since the images are hosted on a separate server, and data being hosted on a separate server, data was migrated successfully but then images showed up as broken links.


All you can do is download those images on to your machine, upload them to the SF documents, then use this path to refer to the images. This is the only way which i was able to figure out, else you have to copy paste the images in all the records.


I too feel this is a major issue with Sf on the migration projects.




Well after playing around with the API and some googling I found that you can upload image data as base64 and salesforce will be smart enough to convert it to a sperate image file, which also lets you go over the 32k character limit with base64 data.


This means in theory somebody would write a visualforce page that loads the record, and then calls the PageReference.getContent() method on the image to grab it's binary data, convert it to base64 in apex, and then find/replace the image link with the base64 data. If you then saved all this to a CSV file it would be dataloader import ready, but **bleep** that's a lot of work for something that should really be built in.


Am I really going to have to go build this abomination to do it?

@ca_peterson_old, I realize this thread is extremely old, but do you recall if you ended up writing code to do this image migration? If so, did it work out for you? I'm not aware of any alternatives to migrate images, other than manually replacing each one.

Raksha Meanger 10Raksha Meanger 10
@ca_peterson_old @scott-dev  Did either of you manage to do this?