我在 Task 对象上使用“快速操作”来替换旧的 js 按钮。我试图用“recordData”替换一些 ajax 收费查询并使用控制器中的数据。结果始终为空。
我尝试了两者 - default 和 layoutType="FULL",相同的结果为空。
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId,force:lightningQuickAction" controller="wsc_checkResponse">
<aura:attribute name="record" type="Task" />
<force:recordData layoutType="FULL"
recordId="{!v.recordId}"
targetFields="{!v.record}"
recordUpdated="{!c.recordUpdate}" />
<aura:attribute name="taskWhoId" type="id"/>
<force:recordData aura:id="recordLoader"
recordId="{!v.recordId}"
fields="WhoId"
targetFields="{!v.taskWhoId}"
targetError="{!v.recordLoadError}"
recordUpdated="{!c.onTaskLoadingCompleted}"
/>
<div class="Record Details">
<lightning:card iconName="standard:account" >
<div class="slds-p-horizontal--small">
<p class="slds-text-heading--medium"><lightning:formattedPhone title="taskWhoId" value="{!v.record.Id}" /></p>
<p class="slds-text-heading--medium"><lightning:formattedPhone title="taskWhoId" value="{!v.record.taskWhoId}" /></p>
</div>
</lightning:card>
</div>
</aura:component>
ctrl.js
({
recordUpdate: function(component, event, helper){
console.log('record',component.get("v.record"));
},
onTaskLoadingCompleted : function(component, event, helper) {
var taskWhoId = component.get("v.taskWhoId");
console.log('taskWhoId',taskWhoId);
}
})
任务记录或最后 WhoId 是预期的,但 nada。