function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BPOORBPOOR 

Lightning Page Refresh component erroring out

We have a lightning page where a section is getting updated via a third party webservice. In order to show the updated values, we have a lightning component to refresh the page once the values are updated. However, this page is currently throwing the below error.
Uncaught Error in A$.getCallback() [Cannot read property 'reloadRecord' of undefined]

The code is given below.
PageRefresh.cmp:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name="dataRecord" type="Object"/>
<aura:attribute name="recordSaveError" type="String" default=""/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<force:recordData aura:id="recordLoader" recordId="{!v.recordId}" layoutType="FULL" targetFields="{!v.dataRecord}" targetError="{!v.recordSaveError}" recordUpdated="{!c.handleRecordUpdated}" />
<aura:if isTrue="{!not(empty(v.recordSaveError))}">
<div class="recordError">
        {!v.recordSaveError}</div>
</aura:if>
</aura:component>

PageRefreshController.js:
({
doInit: function(component,event,helper){
    component.find("recordLoader").reloadRecord(true);
    //set time-out
    helper.setTimer(component);
},

    handleRecordUpdated: function(component, event, helper) {
    var eventParams = event.getParams();
    if(eventParams.changeType === "CHANGED")
    {
        component.find("recordLoader").reloadRecord();
        // get the fields that are changed for this record
        var changedFields = eventParams.changedFields;
        // record is deleted and removed from the cache
    } else if(eventParams.changeType === "ERROR") {
    }
},
})

PageRefreshHelper.js:
({
setTimer:  function(component){
var that = this;
window.setTimeout(
        $A.getCallback(function() {
        component.find("recordLoader").reloadRecord();
        that.setTimer(component);
    }),1000 //time after which the component reloads to check for any change in the record data
);
}
})

The same code works fine in Dev sandbox, but not in QA sandbox. Can someone help?
ShirishaShirisha (Salesforce Developers) 
Hi,

Greetings!

You can debug the lightning component using the lightning inspector to narrow down the code to figure out the root cause of the issue.

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

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri

 
BPOORBPOOR
I get this error message when I try to view the page.

Lightning Inspector Page.

Is there a video or something else that can help me to debug this issue?