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
Braus SashaBraus Sasha 

How to call get value in aura:iteration

Below code doesn't get the value from the aura:iteration
    <aura:iteration items="{!v.contactList}" var="item">
                <ul class="slds-has-dividers_bottom-space">
                    <li class="slds-item">
                        <lightning:tile label="{!item.Contact__r.Name}">
                        </lightning:tile>
                    </li>
                </ul>
            </aura:iteration>
            
            In Js Helper:- c.set("v.contactList",storedResponse);
            
                    callDetails=[SELECT Name, Contact__r.Name FROM PersonDetails__c ORDER BY CreatedDate desc LIMIT 20 ];
    I want get the contact assoicated information but doesn't get it.
Best Answer chosen by Braus Sasha
Akshay Dhiman 63Akshay Dhiman 63
Hi Braus,

I think you have to write this js storedResponse in this way:-
In JS Helper:
 storedResponse.forEach(e => {
                e['ContactName']=e.Contact__r.Name;  
                });

                then set value in contactList attribute
                c.set("v.contactList",storedResponse);
                
In Component:

            <aura:iteration items="{!v.contactList}" var="item">
                <ul class="slds-has-dividers_bottom-space">
                    <li class="slds-item">
                        <lightning:tile label="{!item.ContactName}"> // Changes in that field
                        </lightning:tile>
                    </li>
                </ul>
            </aura:iteration>

Hope this explanation will resolve your query. Mark it as the best answer if you find it helpful.
Thanks
Akshay

All Answers

SwethaSwetha (Salesforce Developers) 
Same as https://salesforce.stackexchange.com/questions/331457/how-to-call-get-value-in-auraiteration for which more details are needed to be able to suggest further
Akshay Dhiman 63Akshay Dhiman 63
Hi Braus,

I think you have to write this js storedResponse in this way:-
In JS Helper:
 storedResponse.forEach(e => {
                e['ContactName']=e.Contact__r.Name;  
                });

                then set value in contactList attribute
                c.set("v.contactList",storedResponse);
                
In Component:

            <aura:iteration items="{!v.contactList}" var="item">
                <ul class="slds-has-dividers_bottom-space">
                    <li class="slds-item">
                        <lightning:tile label="{!item.ContactName}"> // Changes in that field
                        </lightning:tile>
                    </li>
                </ul>
            </aura:iteration>

Hope this explanation will resolve your query. Mark it as the best answer if you find it helpful.
Thanks
Akshay
This was selected as the best answer