top of page

How to Migrate FeedItems (Chatter) with Attachments from One Salesforce Org to Another



Migrating FeedItems with attachments between Salesforce orgs can be a daunting task, but with a clear and organized approach, it becomes manageable. This guide will walk you through the process step by step, ensuring that you can successfully move your data while maintaining its integrity.


Step 1: Move the Parent Items First

Before migrating FeedItems, it’s crucial to migrate the parent items first. For instance, if your FeedItems are related to Opportunities, you must migrate the Opportunities first. Here’s how to do it:


  1. Export the Parent Items: Export the Opportunities from the source org, including their IDs.

  2. Import the Parent Items: Import the Opportunities into the target org, generating new IDs in the process.

  3. Map the IDs: Create a spreadsheet mapping the old IDs from the source org to the new IDs in the target org. This mapping will be essential for linking the FeedItems correctly.


Step 2: Export Data from the Source Environment

Perform a Data Export from the source org. You cannot use dataloader to export the attachments.


  1. Include Required Data: Perform a data export that includes FeedPosts (the actual Chatter messages) and ContentVersion.

  2. Check Export Options: This export will provide you with CSV files of ContentVersion and FeedPosts, as well as the ContentVersion documents themselves in MIME type format.

  • Include images, documents, and attachments.

  • Include Salesforce Files and Salesforce CRM Content document versions.


Step 3: Convert MIME Type Documents

ContentVersion documents exported from Salesforce are in MIME type format. You need to convert these to their correct formats. Use the appropriate shell script for your operating system:


Step 4: Prepare the ContentVersion CSV

Before importing the ContentVersion data into the target org, you need to prepare the CSV file:


  1. PATHONCLIENT and VERSIONDATA: Set these fields to the local path of the documents on your machine.

  2. Set the Owner: Ensure the Owner field is correctly populated.

  3. FirstPublishLocationId: Set this field to the ID of the record you plan to add the FeedPost to (matching the ParentId in the FeedPost CSV).

  4. Rename the ID Column: Rename the ID column to something like 'Old_Id' to avoid overwriting it during the import process. This way, in the success file, you will have the new Ids and the Old_Ids together. If you left the column as 'Id', it would be overwritten.


Step 5: Import ContentVersions into the Target Environment

Import the ContentVersions into the target environment. Note that Dataloader has a 50MB size limit for uploads. If your documents exceed this size, you will need to load them manually.


Step 6: Update FeedPost Records

After importing the ContentVersions, you will have a success file containing the new IDs along with the Old_Ids from the source org. You need to update the FeedPost records as follows:


  1. Identify ContentPost Records: Filter the FeedPost records to identify those with a type 'ContentPost'.

  2. Update RelatedRecordId: Replace the RelatedRecordId in these records with the new ContentVersion IDs from the target org.


Step 7: Load FeedPost Records

Finally, load the FeedPost records into the target environment. Ensure that the relationships between FeedPosts and their parent records are correctly maintained using the mapped IDs.


Conclusion

Migrating FeedItems with attachments involves careful planning and execution. By following these steps, you can ensure a smooth migration process, preserving the integrity of your data and maintaining the relationships between records. Happy migrating!

Comments


bottom of page