0

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">
            {!obj.Name}
            <!--<a href="{! '/' + $Label.c.AMEXCOMM_Domain + '/s/sfsites/c/servlet/servlet.FileDownload?file=' + obj.Id }" target="_blank">
                {!obj.Name}
            </a>-->
            <br></br><br></br>
        </aura:iteration>
</span>

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

1

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 
{
    @AuraEnabled
    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;
    }

}
| improve this answer | |

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.