1

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?

1

1 Answer 1

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.

You must log in to answer this question.

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