Salesforce Files connect can be used to link files from a Cloud Storage to any record in Salesforce. You can easily setup Files Connect following the instructions here. However, Files Connect does not support uploading files directly to a Cloud Storage platform from within the Salesforce.
With CloudFiles, you can upload files in Salesforce which directly go to the Cloud Storage platform like SharePoint, Google Drive etc. without ever consuming your Salesforce storage. Using CloudFiles flow actions, you can also copy a Salesforce file to a Cloud Storage platform automatically.
Using "Create File Connect Files" action, you will be able to create a File sConnect object for a file uploaded/copied through CloudFiles.
1 - Create a Platform Event Triggered Flow
Select the platform event "CloudFiles Event"as the trigger in your flow builder. Use a decision element to only process the CloudFiles events of the type "file-uploaded". You can checkout the guide on CloudFiles platform event here
2 - Add "Get Event Details" Action to your Flow
Next, use the Get Event Details action to get the details of our "file-uploaded" event
3 - Add "Create File Connect Files" Action to your Flow
In your flow builder, search for the element named "Create File Connect Files". You can also find this action in the CloudFiles category when you click "action" element in "Add Element" box. Select the action to insert it into the flow.
4 - Configure parameters
Please configure following parameters after inserting the flow action
- External Data Source Name - This is the name of the external data source, you creates as part of Files Connect setup process
- File Connect Resource Id - You can get this from the output of "Get Event Details" action we used in the last step. Please use the field name "FileUploaded.FileConnectResourceId"
- Name - Name of the uploaded file. You can get this from the output of "Get Event Details" action we used in the last step. Please use the field name "FileUploaded.Name"
- Salesforce Object Id - Id of the Salesforce record, to which the files connect object should be attached. You can get this from the output of "Get Event Details" action we used in the last step. Please use the field name "FileUploaded.RecordId"
That's it. Once this flow is activated, it will automatically create Salesforce Files Connect object for any file uploaded through CloudFiles. Salesforce File Connect objects can be used by other apps like Conga as input.
Here is how the complete flow looks