Navigating to record detail page after edit does not reflect new data

Used window.location as mentioned in the comments which opens the salesforce app inside child container/page.

Finally ended up using window.parent.location as below (instead of using $A.get("e.force:navigateToSObject") or sforce.one.navigateToSObject for Lightning component or VF page respectively.) -

window.parent.location = '/' + recordId;

Not sure if this is completely supported by Lightning but works for now.


Added:

  1. Tested and this works in Lightning UI when standard button is overridden:

    • Directly with Lightning component
    • Indirectly via Visualforce using Lightning out
    • When component is used in app builder.
  2. I have disabled toast message, showing a success message via toast is weird as message appears following by redirection.


I found other workaround without redirection.

Adding an empty Lightning component for the affected layout:

Component code:

<aura:component implements="flexipage:availableForAllPageTypes"  access="global">
    <aura:handler name="init" value="{!this}" action="{!c.handleInit}"/>
</aura:component>

Controller code:

({
    handleInit : function(component, event, helper) {
        setTimeout(function(){ 
            $A.get('e.force:refreshView').fire();
        }, 1);


    }
})

In this case when you use "e.force:navigateToSObject" the layout is refreshed.