How to make existing Salesforce records work with CloudFiles
Introduction
With CloudFiles, you can set up flows to automate tasks like folder creation on record create/update, automatically copying files to external storage on certain events etc. However, unless your Salesforce account is brand new, you would always have exisitng records which need to have the same file/folder setup. In this article, we will see how to achieve this. This process is generally called Data Migration. However, it doesn't migrate any data out of Salesforce, it's just the widely used term
Pre-requisites
Data migration is best done when you have setup CloudFiles processes completely for your new records. This ensures that our processes are finalized and flows are setup correctly.
Setting up the Migration Flows
- Create a field on the Salesforce record type for which you want to run the migrartion, for example - Account. Use the following settings -
- Type - Checkbox
- Name - "CloudFiles Migration" or similar
- Default Value - Unchecked
- Remember to remove the field from all page layout, as we don't want people to edit it normally

- Open the flow that we have setup for new records. Temporarily update it to run when "A record is created or updated". Use following settings -
- Conditional Requirements - All conditions are met(AND)
- Field - CloudFiles Migration Equals True
- When to Run the Flow for Updated Records - Only when a record is updated to meet the condition requirements

- Save the flow and activate it
- Open the list view for the Record and Add the field "CloudFiles Migration" to list view


- From the list of records, check the "CloudFiles Migration" checkbox for a couple or records at one time. Click "Save" and it will trigger the migration
- Try to select the migration checkbox for a small number of records at a time to avoid hitting Salesforce Governor limits or the API limits of external storage
- Don't forget to update the flow back to original trigger condition and delete the migration field after the migration is complete