function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
balaji manikandanbalaji manikandan 

how to display a table with showing case objects details like case number along with the attachment details in same table?

I want to display all the cases with have attachments in a table along with the File name and other file related information in lighting component
try below code

public class caselist {
    public static List<case> fetchcase(){
        return [select Id,casenumber,(Select Name From Attachments) from case limit 10];


<aura:component controller="caselist"  implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
	  <aura:attribute name="setMeOnInit" type="case[]"  />
 <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
     <table class="slds-table slds-table_bordered slds-table_cell-buffer">
            <tr class="slds-text-title_caps">
                <th scope="col">
                    <div class="slds-truncate" title=" Id">Id</div>
                 <th scope="col">
                    <div class="slds-truncate" title="Case Number">Case Number</div>
                 <th scope="col">
                    <div class="slds-truncate" title="Attachments">Attachments</div>
            <aura:iteration items="{!v.setMeOnInit}" var="user">
                 <td><div class="slds-truncate">{!user.Id}</div></td>
                   <td><div class="slds-truncate">{!user.CaseNumber}</div></td>
                   <td><div class="slds-truncate">
                    <aura:iteration items="{!user.Attachments}" var="item">

    doInit: function(component, event, helper) {
        var action = component.get("c.fetchcase");
        action.setCallback(this, function(response) {
            if (response.getState() == "SUCCESS") {
                var allValues = response.getReturnValue();

Mark as best answer if it helps you.
Ghanshyam Choudhari
balaji manikandanbalaji manikandan
i cannot get the attachment deatils its only displaying case details
Hi Balaji,
Remove limit from the query and make sure that in cases you have attachments.
[select Id,casenumber,(Select Name From Attachments) from case ]
balaji manikandanbalaji manikandan
ya i have tried it already but it only displaying all the case in my org not file details
select Id,casenumber,(Select Name From Attachments) from case  are you getting attachments details in the query?

balaji manikandanbalaji manikandan
No nothing
please make sure that you are getting proper data in the query and once you get the data show on a lightning component.