Open Salesforce Files In LC

Dynamically Open Salesforce Files or ContentDocument In Lightning Component

Lightning Component

Hi guys today in this post we are going to learn, how we can open or display a preview of contentDocument or salesforce files dynamically in salesforce lightning component using <lightning:fileCard> base component. A <lightning:fileCard> component displays a preview of a file (Image, Text, PDF…etc.). On desktops, clicking the file preview opens the SVG file preview player, enabling you to preview images, documents, and other files in the browser. The file preview player provides quick access to file actions, such as upload, delete, download, and share. On mobile devices, clicking the file preview downloads the file. The file type determines the icon used on the file preview and caption area.

So In this post we will create a component to display list of all available salesforce files records and on clicking on the file title we will display a preview of file.

file in sfdc LC

Step 1. Apex Controller [fileViewerCtrl.apxc]

Step 2 : Lightning Component [filePreviewer.cmp]

JavaScript Controller : [filePreviewerController,js]

Opening the file preview player is supported in Lightning Experience, the Salesforce mobile web, and Lightning communities.

Steps To Add Lightning Components as Custom Tabs in a Lightning Experience App

Lightning Component Files Preview :

files in sfdc LC demo

Related Resources :

Other popular Post :

Like our facebook page for new post updates. & Don’t forget to bookmark this site for your future reference.

if you have any suggestions or issue with it, you can post in comment box.

Happy Learning ?

(Visited 629 times, 21 visits today)

One thought on “Dynamically Open Salesforce Files or ContentDocument In Lightning Component

Leave a Reply