javascriptsalesforcesalesforce-lightningaura-framework

force:recordData not working on Quick Actions


I'm using "quick Action" on Task object in order to replace an old js button. I tried to replace some ajax toll queries with "recordData" and use the data in the controller. the result is always null.

I tried both - default and layoutType="FULL", same results null.

<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);

    }
})

task record or at last WhoId is expected but nada.


Solution

  • Like other base Lightning components, including <lightning:recordEditForm>, <force:recordData> does not support the Task or Event objects.

    The list of supported objects is here, in the Lightning Aura Components Developer Guide. The underlying limitation appears to come from the UI API, which doesn't support Task and Event.