1

Our org has exhausted the limit of static resources. Mostly used in storing badge images for the certifications and exposed as a downloadable URL on customer community. I want to remove these images/zip from static resources and move it to Documents. I tried doing that and created a formula field with hyperlink funtion

[HYPERLINK("/servlet/servlet.FileDownload?file=0150U000000F04q", "badgedownload" , "_blank")]

The above field works for internal user but does not work for community users. Any idea why community users cannot download the documents? Note - Community profile has read-only access to documents.

Or are there any other option that I can use to make it work for community users?

0

You can use ContentDocumentLink with ContentVersion for storing your badges. These badges will be linked with records using LinkedEntityId. Set ShareType and Visibility to set visibility access.

Id conDoc = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conVer.Id].ContentDocumentId;

ContentDocumentLink cDe = new ContentDocumentLink();
cDe.ContentDocumentId = conDoc;
cDe.LinkedEntityId = recordId;
cDe.ShareType = 'I'; 
cDe.Visibility = 'AllUsers';
insert cDe;

Visibility to AllUsers will make file accessible for community user as well.

In winter 20, we have feature now to Make Files on Records Visible to Customers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.