we need to open (preview) files in communities by clicking on link. After searching I found lightning:openFiles event, but in documentation is written that it is no longer recommended and it should be replaced with lightning navigation service. But when I look into the documentation, I found that the filePreview page is not available in community.

So does someone an idea how we can achieve this? Can we use lightning:openFiles event in community since there is no alternative? Or it will be deprecated and removed in future?

Thanks for any advice.

EDIT: We need open preview directly after click on link, without next click or doing any action.

1 Answer 1


Assuming that you have the ContentDocumentId of the file, then use lightning:fileCard to display the preview of the file. This is compatible with Lightning communities

    <lightning:fileCard fileId="069XXXXXXXXXXXX" description="Sample Description"/>

Refer to full documentation here

  • well, I forgot mention that we need directly open preview.
    – sunny
    Nov 5, 2019 at 13:16
  • @sunny hmm its not very clear, at some point in time the user will have to initiate an action. could you edit your question further to elaborate a bit more about the expected behavior of the file preview ? do you mean that file preview should display on page load ?
    – Shamina
    Nov 5, 2019 at 13:32
  • I did. We need open preview when user click on link, not on page load
    – sunny
    Nov 5, 2019 at 14:25
  • did you try this filecard open asmodal popup?
    – sdandamud1
    Nov 5, 2019 at 15:56
  • @sdandamud1 yes, I tried. But in this case you need 'click' on small preview to show full screen preview. We need show preview without showing them modal and requiring next click on it.
    – sunny
    Nov 5, 2019 at 18:18

You must log in to answer this question.

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