I found that the RefreshView event doesn't always reload record data. I'm writing a Lightning Component that updates a record, then tries to reload the record details to show the changes, but sometimes the view is not updated and shows old values.

This usually happens on the first record interaction (on the first or second button click), or after a reload (F5).

Any idea why?

For example: two buttons that update the record Status with different values. Buttons are rendered based on the server status (and this works well), but the record details sometimes are obsolete. I also double-checked with server data, and I can confirm that client view is obsolete, despite the cache Session Setting.

If I click on the button Confirm (Status 2), the component updates Case.Status = "Status 2" and reloads itself. Then the button Reset (Status 1) appears, but the record detail page still shows the old value (Status 1). See the screen below:


This is the code of the Component:

<aura:component controller="SampleButtonCmpCnt" access="global" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName">
    <aura:attribute access="global" name="recordId" type="ID" />
    <aura:attribute access="private" name="status" type="String" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:handler event="force:refreshView" action="{!c.doInit}"/>

    <aura:if isTrue="{!v.status == 'Status 2'}">
        <ui:button press="{!c.reset}">Reset (Status 1)</ui:button>

    <aura:if isTrue="{!v.status == 'Status 1'}">
        <ui:button press="{!c.confirm}">Confirm (Status 2)</ui:button>

The controller:

    doInit : function(component, event, helper){
        helper.setCurrentStatus(component, event, helper);
    confirm : function(component, event, helper) {
        helper.updateRecordHelper(component, event, helper, 'confirm');
    reset : function(component, event, helper) {
        helper.updateRecordHelper(component, event, helper, 'reset');


The helper:

    setCurrentStatus : function(component, event, helper){
        component.set("v.status", null);
        var action = component.get("c.queryRecordStatus");
            sfid : component.get("v.recordId"),
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var status = response.getReturnValue();
                component.set("v.status", status);
            } else {
    updateRecordHelper : function(component, event, helper, actionName) {
        var action = component.get("c.updateRecord");
            sfid : component.get("v.recordId"),
            actionName : actionName
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var result = response.getReturnValue();
                    alert('Error occurred');
                    this.setCurrentStatus(component, event, helper);

While this is the server-side controller:

public static String queryRecordStatus(String sfid){
    return [Select Status From Case Where Id =:sfid][0].Status;

public static Boolean updateRecord(String sfid, String actionName){
        String objectName = ((Id)sfId).getSObjectType().getDescribe().getName();
        SObject sObj = Schema.getGlobalDescribe().get(ObjectName).newSObject() ;
        sObj.put('Id', sfid);
        if(actionName == 'Confirm'){
            sObj.put('Status', 'Status 2');
        }else if (actionName == 'Reset'){
            sObj.put('Status', 'Status 1');
        update sObj;
    }catch(Exception e){
        return false;
    return true;

So now that I understand correctly your problem, I have a better answer. This is a known issue.

You can subscribe to it to receive a notification once it's fixed.

  • You can edit your previous answer to include the link to the known issue there. – Vigneshwaran G Jun 20 '17 at 14:23
  • I thought about it, but my answer was off topic as I didn't understood correctly the issue. The issue was a custom component that does not update the standard UI, while I answered why a standard update would not update a custom component. I prefer to keep it anyway as I think it could be useful for someone else, what do you think ? – Fabien Taillon Jun 20 '17 at 14:29
  • I accepted the answer because it's the correct one, even if it doesn't solve the problem. At the moment there aren't solution or workarounds, so I just subscribed to the issue you linked – ctrl-z Jun 20 '17 at 15:08
  • Any ideas when salesforce going to fix this issue? – Yury Bondarau Oct 6 '17 at 9:48

It's supposed to work, but I think there is currently an issue around that. In the meantime, you can add a handler and update your component manually:

<aura:handler event="force:refreshView" action="{!c.updateRecord}"/>

Note that refresh is working if you're using Lightning Data Service instead of a custom Apex Class/SOQL.

I'll update the answer if I can find some additional information about the issue itself.

  • thank you @Fabien Taillon but adding the refreshView handler didn't solve, record detail page sometimes shows old data – ctrl-z Jun 19 '17 at 12:19
  • Did you add some code in your JS controller to update your component ? Here I used a "updateRecord" method as an example, but you should call your own method to call the server again and update your component accordingly. – Fabien Taillon Jun 19 '17 at 12:22
  • Edited the question with a screenshot and an explanation. Even forcing the component reload with the setCurrentStatus function, the record detail page is not updated and shows the old Case.Status value. In fact, the screenshot shows "Status 1" while the real value (in the database) is "Status 2". – ctrl-z Jun 19 '17 at 12:55
  • Oh ok sorry I understand now, it's not your component that isn't refreshed, but the standard Salesforce view. Need to have a deeper look. – Fabien Taillon Jun 19 '17 at 13:08
  • 1
    Just to be sure, if you refresh the page, the value is always updated ? And if you use the Lightning Inspector (chrome.google.com/webstore/detail/salesforce-lightning-insp/…), your event is fired ? – Fabien Taillon Jun 19 '17 at 16:44

I encountred also the same issue!

As a workaround, I forced the refresh with the javascript function location.reload() like below:

In the cmp, I added a Handler for the force:refreshView event

<aura:handler event="force:refreshView" action="{!c.isRefreshed}" />

In the Controller, I used the native Javascript function location.reload() to reload the page.

isRefreshed: function(component, event, helper) {

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.