Search code examples
salesforcesalesforce-communitiessalesforce-lightning

Salesforce Lightning Component


I am creating a salesforce lightning component to list the leads of the current logged in user.

I have managed to write the following code, but when i add the component to the page, and preview it, I dont see any leads.

<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
 <div class="slds"> 

<table class="slds-table slds-table--bordered slds-table--striped">
    <thead>
        <tr>
            <th scope="col"><span class="slds-truncate">Company</span></th>
            <th scope="col"><span class="slds-truncate">Annual Revenue</span></th>
        </tr>
    </thead>
    <tbody>
        <aura:iteration items="{!v.leads}" var="lead">
            <tr>
                <td>{!lead.Company}</td>
                <td>{!lead.AnnualRevenue}</td>
            </tr>
        </aura:iteration>
    </tbody>
</table>
    </div>

It will be great, if someone could tell me what is that I am doing wrong. Thank you


Solution

  • You can follow the tutorial for Displaying a Contact List and replace the Logic with that for Leads

    https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_one_demo_load.htm