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
Etienne DKEtienne DK 

recordForm cache/refresh - showing OLD data

A lightning:recordForm component is showing old data.
The SF database definitely has fresher data, a SELECT confirms the server has newer data.
Destroying & re-creating the lightning:recordForm doesn't have an affect, it still shows old data. Refreshing the entire browser page does refresh the component.

On a high level there are two components. 
A parent accountManager that creates a child accountForm
The child accountForm contains the Lightning:recordForm and comms with an external server.
The child will detect when it needs to refresh and will emit an event, the parent handles the event by destroying the child and creates a new child.
This new child is the problem child, it keeps showing stale data. 

Any way to switch off caching, or refresh a recordForm component?

Parent Component
<!-- AccountManager.cmp -->
<aura:component controller='CRAccountGetService' 

    <!-- Attributes-->
    <aura:attribute name='recordId' type='string' default='{! v.recordId }' access='global' />
    <aura:attribute name='sObjectName' type='string' access='global' />

    <!-- Handlers -->
    <aura:handler name='init' value='{! this }' action='{! c.handleInit }' />
    <aura:handler name="refreshAccountForm" event="c:CRRefreshAccountForm" action='{! c.handleRefreshAccountForm }' />

    <!-- Screen -->
      <!-- AccountForm dynamically injected here  -->
        {! v.body }

// AccountManagerController.js
    handleInit: function(component, event, helper) {

    // handler for child component refresh event. Destroy & recreate account form component
    handleRefreshAccountForm: function(component, event, helper) {
        var eventMsg = event.getParam('message');
        helper.showToast('Account', eventMsg, 'error', 5000, 'sticky' );
        // destroy existing Account form child component
        var body = component.get("v.body");
        var arrayLength = body.length;
        for (var i = 0; i < arrayLength; i++) {

        // create new Account form child component
        var recId = component.get('v.recordId');
        $A.createComponent("c:AccountForm", { 'recordId': recId }, 
                            function (newAccountForm, status, errorMsg) {
                                if (status === "SUCCESS") {
                                    component.set("v.body", newAccountForm);
                                } else {
                                   // show error

<!-- AccountForm.cmp -->
<aura:component controller='CRAccountGetService' 
                implements='flexipage:availableForAllPageTypes, flexipage:availableForRecordHome, force:hasRecordId, force:hasSObjectName' 
                access='global' >

    <aura:handler name='init' value='{! this }' action='{! c.handleInit }' />

    <!-- Event to let parent (manager) know we need to be refreshed -->
    <aura:registerEvent name="refreshAccountForm" type="c:CRRefreshAccountForm" />
    <aura:attribute name='recordId' type='string' default='{! v.recordId }' access='global' />
    <aura:attribute name='mode' type='string' default='view' access='global' />

    <!-- Screen -->
    <lightning:messages />
        recordId='{! v.recordId }'
        mode='{! v.mode }'
        onsuccess='{! c.handleSuccess }' 

// AccountFormController.js
    // After a successful save to SF database, call external service
    handleSuccess: function(component, event, helper) {
        helper.callExternalService(component, event, helper).then (
            // promise resolved: external server accepted data. SF database unchanged
            $A.getCallback(function () {
                helper.showToast('Account Save', 'All good', 'success', 1000);

            // promise rejected: external server rejected data and overwrote values in SF database, 
            // fire event so the Manager (the parent component) refreshes the form view
            $A.getCallback(function (message) { 
                var refreshMeEvent = component.getEvent("refreshAccountForm");
                refreshMeEvent.setParam("message", message);
// AccountFormHelper.js
    callExternalService: function(component,event, helper) {
        return new Promise($A.getCallback(function(resolve, reject) {

            var externalService = component.get('c.callExternalService');
                'accountId': component.get('v.recordId')

            externalService.setCallback(this, function(response) {
                if (response.getState() === "SUCCESS") {
                    var rspMsg = JSON.parse(response.getReturnValue());
                    if (rspMsg.success) {
                    } else {
                } else {
                    reject('Controller failure:' + response.getState()); 

Deepak GulianDeepak Gulian
Hi, could you just try disabling this option "Enable secure and persistent browser caching to improve performance".

Please refer a screenshot.
User-added image
Etienne DKEtienne DK
Hi Deepak, 
Thanks, this option was already disabled (unchecked)

And I disabled Lightning Debig mode for my user account.

I also tried the browser Devtools setting: Network:'Disable cache (while dev tools is open)

Thank you
Deepak GulianDeepak Gulian
Please try logging in again then.
Etienne DKEtienne DK
I tried re-loggin and also tried Safari & Chrome.

Investigating further ... I added a button on the Parent (AccountManager) to Destroy the child and re-create the child. (copy 'n paste code from AccountManagerController.handleRefreshAccountForm)

destoying and re-creating the child multiple times makes no difference, old data still shows.

Is it  possible to tell recordForm to ignore cache or somehow trick it into doing a clean fetch