[英]Salesforce Lightning Component
I am creating a salesforce lightning component to list the leads of the current logged in user. 我正在创建一个Salesforce闪电组件,以列出当前登录用户的潜在客户。
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 谢谢
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 https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_one_demo_load.htm
This might be because 这可能是因为
You have not added a controller on your lightning component. 您尚未在闪电组件上添加控制器。
<aura:component implements="forceCommunity:availableForAllPageTypes" controller="ContactController" access="global" >
You have not declared the attribute "leads" which you have used in the iteration. 您尚未声明在迭代中使用的属性“ leads”。
<aura:attribute name="leads" type="Lead[]"/>
You have not set the "leads" attribute which you fetched from the Apex controller. 您尚未设置从Apex控制器获取的“线索”属性。
controller.set("v.leads", variableWithLeadsList);
You have not fetched data from the Apex controller. 您尚未从Apex控制器获取数据。 In this case, as mentioned by Rajdeep Dua, https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_one_demo_load.htm link explains the whole process and will help you if you replace Contact with Lead. 在这种情况下,如Rajdeep Dua所述, https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_one_demo_load.htm链接说明了整个过程,如果您替换Contact,将为您提供帮助与铅。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.