We have a Customer portal that our member log into. Once they log in they have access to a documents library which are are held in the Static Resources section.

I have a document that we will want to share (via URL) with our users, but make sure that the users can only access the document once they have logged in. I've uploaded to the Static Resources, tried both public and private and using a different browser tested the result. With private the document doesn't appear, with public it appears without having to login.

Where is the best place to keep documents - files or static resources? How can I set it so that someone has to log into their portal page to access that document?

Please note we do not use chatter and don't have feeds within our portal. It is a static resource library.

1 Answer 1


Files can be used in this scenario. You have to set Visibility of ContentDocumentLink to AllUsers in trigger. AllUsers means anyone who can see the record can access the file, including community users.

Trigger could be like this

trigger shareFilesWithCommunityUsers on ContentDocumentLink(before insert){
  for(ContentDocumentLink cdl:trigger.new){
         cdl.ShareType = 'I';
         cdl.Visibility = 'AllUsers';

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .