0

Here's my code:

<lightning:layoutItem padding="around-small">
    <lightning:fileCard fileId="069XXXXXXXXXXXX" description="logo"/>
</lightning:layoutItem>

I'm using (for now) a hardcoded Id of a ContentDocument that I know exists, but all I get is a box with No preview available in it.
The lightning component sits on the Community Builder page on a site.
The file itself is visible to Your Company. The person trying to view this image is logged in as a community user.
There's obviously some configuration I'm missing, but dammit Jim, I'm a developer, not an administrator.
The ContentDocument I'm trying to view here has a ContentDocumentLink with Visibility=AllUsers and LinkedEntityId=00DXXXXXXXXXXXX.
Doesn't that mean that the file is shared with the entire org? All of the users in the org? Including community users?

2
  • [The person trying to view this image is logged in as a community user] -- Does the Community User have the access to the File?
    – Jayant Das
    Dec 4, 2018 at 13:55
  • @JayantDas from what I can tell, yes. But I'm obviously missing something, I just don't know what. Dec 4, 2018 at 13:59

2 Answers 2

1

Well, it turns out that this is some kind of "feature" of Salesforce.
Any file created before a community exists cannot be shared with the community. That's just the way it is. And my file is older than the community.
However, any file that is created after the community exists and is shared with the entire org (ContentDocumentLink with Visibility=AllUsers and LinkedEntityId=00DXXXXXXXXXXXX) will be visible to community users.
So I uploaded a new file and tried that in the lightning:fileCard and that worked.
Knowledge Article.

2
  • It is saving as LinkedEntityId=005XXXXXXXXXXX for files uploaded after community setup. Is there any other setting I need to do to make LinkedEntityId=00DXXXXXXXXX so that file will be shared to community users as well.
    – Reshma
    Jan 17, 2020 at 9:41
  • I did using code on the controller. Since this is the only way for our community members to upload documents, whenever they upload a document my code shares it with the org. Jan 19, 2020 at 6:16
0

Is this problem occur due to User License? As the Customer Community Login License don't allows for Content availability for files. Refer the document: https://help.salesforce.com/articleView?id=users_license_types_communities.htm&type=5

You must log in to answer this question.

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