0

In my org, a user with license "Customer Community Plus" is not able to access a particular ContentVersion record. (When trying to access the record using Standard API, a 404 [Not Found] error is thrown.) However, a system admin user is able to access the same ContentVersion record. I found that the "Visibility" field on related ContentDocumentLink record can control the sharing. However, when logged in as the system admin user (who is able to access the ContentVersion record), when I tried to query the ContentDocumentLink records, the query resulted in no records.

Suppose the Id of the Content Version record is "068XXX" and the "ContentDocumentId" on this record is "069XXX". The below query results in no records->

SELECT Id FROM ContentDocumentLink WHERE LinkedEntityId='069XXX' OR LinkedEntityId='068XXX'.

In this scenario, what could be the reason behind the "Customer community Plus" not being able to access the ContentVersion record? Or rather how is the access to ContentVersion record controlled in this case?

2 Answers 2

1

You can execute the SOQL in this manner: SELECT Id FROM ContentDocumentLink WHERE ContentDocumentId='069XXX'. (Since the associated file would be stored in "ContenDocumentId"). You might then want to refer to the LinkedEntityId on the record(s) returned, and if the LinkedEntityId belongs to an sObject, then determine if the commmunity user has access to this sObject record. A possible reason behind that user not being able to access the ContentVersion could be : the user not having access to the sObject Record which is the LinkedEntity for the ContentVersion.

1

Couple of things to look at. As a general rule, any ContentVersion you want a Community User to be able to see needs a Visibility of AllUsers. If a Community User uploads a fie, it is always set to All - an Internal User usually default to Internal, so you need to change that to All via a trigger\flow for a Community User to have access.

LinkedEntity Id refers to the related record, not the Content Record. By default, there is usually a ContentDocumentLink to relate a ContentDocument to a the original owner e.g. SELECT Id FROM ContentDocumentLink WHERE ContentDocumentId='069XXX' AND LinkedEntityId='005XX'. If the record is related to a sObject, then there would be another entry linking it to that record, and the ShareType will determine the access.

You must log in to answer this question.

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