Unzip (7 min)
01 Getting Started
This tutorial covers how to use Titan Files to automatically extract all files from a zip archive, and then delete the original zip file.
This is a useful process to implement if you need to upload multiple documents to Salesforce, as you can upload a single zip archive containing all the files. By extracting the files, they are readily available.
02 Flow
1. Navigate to Process Automation Flows in Salesforce and click New Flow.
2. Select Record-Triggered Flow and click Create.
3. Configure the following:
- Object - TFile
- First condition - The Parent Object equals Case (you can set this to be any Object where the zip file will be uploaded to.
- Second condition - The file extension equals zip.
4. Save and Label your flow.
5. Click the + icon.
6. Search for the File Action node and select it.
7. Configure the following:
- Label - Unzip
- Parent Object - Case
8. Select the Settings icon in the Flow window.
9. Click the Files menu item under Variables, Add a Files Variable, and name it output_file. Click Apply.
10. In the Titan Flow window, click the Any + icon and select Extract as the node. Click Next.
11. Select the file variable in the File In dropdown.
12. Select the output_file variable using the File Out dropdown. Click Next.
13. Add a tag and click Insert.
14. Click the Extract Zip File + icon and choose Salesforce Action as the node. Click Next.
15. Click Salesforce Integration.
16. Select the Push tab and click Create New.
17. In the Object Settings tab configure; files as the Salesforce object, create as the action, and create files as the description.
18. In the Mapping tab configure the following and click Apply.
- Map the Version Data to the output_file variable. This will create a separate Content Version for each extracted file.
- Map First Publish Location ID to the parentRecordId global variable
19. Click Create New to configure a new push.
20. In the Object Settings tab configure; Content Document as the Salesforce object, Delete as the Action, and add a description.
21. In the Conditions tab, configure that the Content Document ID equals the contentDocumentId field. Click Apply and Close.
22. Using the dropdown to select both Salesforce pushes. Ensure you select the pushes in the order they should run i.e. push the extracted files first then delete the zip file. Click Next.
23. Add a Tag and click Insert.
24. Click Done in the Apex configuration window.
25. Save the updated flow and Activate.
The current configuration will be triggered when a zip file is uploaded to a case, the file will be unzipped, and the original archive zip will be deleted.