I am looking for a way to display my related content to my case using Lightning, I currently can display attachments perfectly as seen below:

<span class="text-blue">
        <aura:iteration items="{!v.record.Attachments}" var="obj">
            <!--<a href="{! '/' + $Label.c.AMEXCOMM_Domain + '/s/sfsites/c/servlet/servlet.FileDownload?file=' + obj.Id }" target="_blank">

Which returns a list like so:

enter image description here

I have tried iteration through {!v.record.ContentDocumentLinks} as well as some others but none seem to work


You may get a better answer if you can help explain what is not working ... This code gets all documents related to an object which is passed in the record ID.

public class FilesListApexController 
    public static List<ContentDocument> getContentDocs(Id arecordId)
        List<ContentDocumentLink> CDLs = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :arecordId];
        if (CDLs.size() < 1) return new List<ContentDocument>(); 

        // Make a List of ContentDocument IDs
        List <Id> CDIdList = new List <Id> ();
        for (ContentDocumentLink nextCDL : CDLs) {
            CDIdList.add(nextCDL.ContentDocumentId); }        

        List<ContentDocument> entries = [SELECT Id, Title, FileType FROM ContentDocument WHERE ContentDocument.Id IN :CDIdList];
        return entries;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.