To append the Case numbers to the downloaded Case Email Attachments' names, We need to create the formula field on the Email Attachment object and add the same field to the downloaded file name's suffix.
Please follow the below steps -
1) Create the formula field on the Email Message Object -
- Go to the Setup.
- Click on the Object Manager and go to the Email Message Object.
- On the Email Message object, click on the Fields & Relationships --> Click on the NEW button and select Formula Data Type.
- Give the following label and name to the field -
a) Field Label - Case Number
b) Field Name - Case_Number
c) Add the following formula - Parent.CaseNumber
- Click on the Save Button.
2) Now follow the below steps to bring the following field to the downloaded file name of the Email Message object.
- Go to the App Launcher(by clicking on the 9 dots in the top left) and Search for the "Excluded Object" tab.
- If no results were found for the "Excluded Object", then you have to create one tab with the same name. Please follow the steps below -
1- Go to the Setup and search for "Tabs" in Quick Find. Click on "Tabs" and create a new "Tab" for the object excluded object (Namespace: download files). Follow these steps to create a tab: https://help.salesforce.com/articleView?id=creating_custom_object_tabs.htm&type=5.
- On Excluded Object tab, choose the All List view --> Search for the Email Message and edit the File name Suffix as Case_Number__c(API Name of above-created formula field).
Mass File Download App:
- Open the Mass file Download App and go to the Mass file Download Tab
- Click on Related Files & Attachments and select the Email Message object from the drop-down.
- Select Search mode as Advance Search(SOQL) and leave it blank.
- Hit the Search button and Download the Files and Attachments displayed on the table.
Open the Downloaded Zip File and go to the Sub-Folders, there you can see the downloaded files' name in this syntax - "fileName - Case Number.extension" as shown in the below image