1

I've got a pretty basic lightning component that pulls some Account information for accounts related to a Case. This component sits in Service Console.

<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global">


<aura:attribute name="recordId" type="Id" />
<aura:attribute name="record" type="Object" />
<aura:attribute name="Account" type="Object" />
<aura:attribute name="Case" type="Object" />
<aura:attribute name="recordError" type="String" />


<force:recordData aura:id="record"
            recordId="{!v.recordId}"
            targetError="{!v.recordError}"
            targetRecord="{v.record}"
            targetFields="{!v.Case}"
            layoutType="FULL"
            mode="VIEW"
            />



<lightning:card iconName="standard:account" title="Account Details" >
    <lightning:recordViewForm recordId="{!v.Case.AccountId}" objectApiName="Account">
            <div class="slds-box slds-theme_default">
                <lightning:outputField fieldName="Name" />
                <lightning:outputField fieldName="BillingStreet" />
                <lightning:outputField fieldName="BillingCity" />
                <lightning:outputField fieldName="BillingState" />
                <lightning:outputField fieldName="Phone" />
                <lightning:outputField fieldName="Customer_Type__c" />
                <lightning:outputField fieldName="Seek_And_Find_Widget_Deployed__c" />
                <lightning:outputField fieldName="Seek_And_Find_Widget_Deployed_Dt__c" />
            </div>
    </lightning:recordViewForm>
</lightning:card> 
</aura:component>

When the page loads, it's throwing the following error:

Action failed: lightning:recordViewForm$controller$handleRecordIdChange [Cannot read property 'getList' of null]

Component Descriptor

markup://lightning:recordViewForm

Function:

Object.getFields

There is an account related to the case and it does actually pull in the correct data. But it's throwing this error every time. When I remove that specific component from the page, the error goes away.

0
1

Your component implements force:RecordId, and that you also have the recordId attribute declared as <aura:attribute name="recordId" type="Id" />.

From the documentation of force:RecordId, refer to the excerpt (emphasis mine):

Note If your component implements force:hasRecordId, you don’t need to add a recordId attribute to the component yourself. If you do add it, don’t change the access level or type of the attribute or the component will cause a runtime error.

In your case, because the recordId attribute's type is that of Id, it is causing a runtime error as mentioned in the documentation.

For your component to work correctly, follow one of the below steps:

  • Remove the recordId attribute declaration from your component

    OR

  • Change the type of the recordId attribute to String as <aura:attribute name="recordId" type="String" />

3
  • I tried both of these changes and it's still throwing the error.
    – brandonl
    Dec 18 '18 at 15:55
  • I can confirm this that I was able to replicate the error, and then following this approach it was resolved. You may like to make the change, clear the cached contents and then try it out.
    – Jayant Das
    Dec 18 '18 at 15:58
  • Yep. Was just going to comment and say I think it's a caching issue. Thanks!
    – brandonl
    Dec 18 '18 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.