Use Flows to migrate files from Salesforce Storage to SharePoint
In some cases, 24Files is deployed into a Salesforce environment that has already a substantial number of documents stored on Salesforce Storage. 24Files can be configured to automatically upload new files stored on Salesforce Storage to SharePoint, but it will not automatically migrate files that were stored prior to the deployment of 24Files.
In this section, we describe an example Flow that does exactly that: it helps you migrate existing Salesforce Storage files to SharePoint. The Flow is shipped with the 24Files package: it is not part of the product but is an example Flow that you can copy and use as an example to build your own use case. Look for the Flow named “Migrating Existing Document to 24Files”.
The Flow works well if the number of files is limited (~300 files). For a large number of files, you may hit the Salesforce Flow limitations and the Flow may timeout. In such case, you can write your own batch classes that still make use of the 24Flow Apex methods.
Below we succinctly describe the main steps in this Flow:
Prerequisites: the Flow assumes you have already properly configured 24Files and have associated the correct SharePoint Sites and Document Libraries with the respective objects.
The Flow starts with a Selection Screen that allows to configure:
The objects for which files need to be migrated to SharePoint.
The email address to which error/status information needs to be sent.
Next in Convert Semi Colum Separated to Collection, the picklist is split.
Then, we iterate over all objects and gather all files to be migrated.
For each file, we then configure in which SharePoint folder it should end up and whether Anonymous Access is to be used for upload.
In the final step in the Flow, Upload File to SharePoint, all files will be uploaded in batch to SharePoint, in an asynchronous way. An email will be sent in case of errors.
Finally, note that this Flow does NOT remove any files on Salesforce Storage. In case the upload would fail, you still have access to the files on Salesforce. If you want to remove the files as well, use this Flow as an example to create a second Flow that removes the files.