0

When associating a Salesforce File to an object in the UI, the associated ContentDocumentLink and ContentVersion records are not returned when a public guest/site user queries for them. An internal Salesforce user can query for them fine. We've tried updating sharing settings, changing owners, and verified the query runs in apex without sharing set. The only thing that seems to work is if I recreate those objects in apex, then the user can query for them.

Has anyone run into this? Is there a way for the site user to have access without recreating the objects in apex?

0

I believe I found a workaround for this issue. Creating a before insert trigger on ContentVersion that sets the Origin field to C, along with a before insert trigger on ContentDocumentLink that sets Visibility to AllUsers, allowed the public force.com site guest user to access the Salesforce File which was uploaded by the out of the box UI. So records started being returned when querying ContentDocumentLink and ContentVersion as the site user after uploading with those trigger changes in place.

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.