2

I am wanted to have the option to select from files which have already been uploaded in Salesforce in a custom lightning component. I would like to build something similar to what is on the Files related list which are referenced in the pictures below:

enter image description here

enter image description here

Here you are able to select existing files as well as upload the files. Is this something that I will have to build custom? I know that there is lightning:fileUpload which I plan to use to add new files but cant seem to find anything about selecting existing files.

1 Answer 1

5

To answer to your question - Yes this needs to be a custom component. While lightning:fileUpload lets you to upload a file, to be able to view the list of the files already in the system, you need to customize the behavior as you expect by building a new lightning component.

Files are stored in ContentDocument, so you will need to build a logic to retrieve files based on your criterion from the object (and related Content objects) and process accordingly. You will also need to address all the security aspect as which Files may be available to the User to be presented for selection.

You can refer more on ContentDocument on the developer guide.

You may also like to refer few of the components, that may be helpful while building this:

2
  • 1
    Thank you for your response and linking some useful components! Apr 19, 2018 at 16:11
  • I was hoping that wasn't the case, so much wasted effort recreating existing components. May 8, 2019 at 20:57

You must log in to answer this question.

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