You need to sign in to do that
Don't have an account?
S Balaji 8
Sharing the files to external users.
On Case object under attachment related lists section , we have to override the upload files button and when we click it we should have two options one is public and another one is private , if user clicks public then he should be able to add the attachment should be visible both in Salesforce as well as in community portal.
If it is private then it has to be visible only in salesforce ( right now the default is private which is out of the box ).
If it is private then it has to be visible only in salesforce ( right now the default is private which is out of the box ).
write a trigger and edit the Visibility field of the ContentDocumentLink that is created when the file is uploaded. Although you might want this to be context aware so that you don't do this whenever any file is created (and also requires some technical knowledge).
https://salesforce.stackexchange.com/questions/149553/how-to-share-files-uploaded-in-files-related-list-to-community-users
Here's an example of how you can implement this:
Create a Visualforce page that overrides the standard attachment upload functionality for the Case object. In the Visualforce page, you will add two radio buttons to allow the user to select either public or private for the attachment. You can use the following code:
In this code, we are using the selectRadio component to allow the user to choose either Public or Private for the attachment visibility. We are also using the inputFile component to allow the user to select the file to upload. Finally, we are using the commandButton component to trigger the upload process.
Create a custom controller to handle the logic for uploading attachments as public or private. In the controller, you will define a method to handle the upload process based on the selected visibility. You can use the following code:
In this code, we are defining a custom controller called CaseAttachmentController. We are using the attachment variable to store the attachment information, and the attachmentVisibility variable to store the selected visibility. We are also using the currentCase variable to get the current Case record.
In the uploadAttachment() method, we are checking whether the attachment file has been selected or not. If the file has been selected, we are then checking the selected visibility. If the visibility is Public, we are setting the IsPrivate field to false so that the attachment will be visible in both Salesforce and the community portal. If the visibility is Private, we are setting the IsPrivate field to true so that the attachment will be visible only in Salesforce. Finally, we are inserting the attachment
If you find this answer helpful,Please mark it as the best answer.