[SalesForce] Lighting Experience Related list not updated when “New” is overridden to use a Visualforce page

This question is pretty much the same as related list not getting updated in Salesforce Lightning from 2 years ago. That doesn't have an accepted answer and has a comment that suggests one answer may not work.

(Note that our aim is to be Lightning Ready for now rather than to do a rewrite of a lot of Visualforce in Lightning Components. One reason is that we have a substantial installed base who want to continue working in Classic.)

The override of the "New" action to use a Visualforce page works in Lightning Experience and returns to the parent page correctly. But the "Related" list is not updated to include the newly created object. Without the override, the platform correctly refreshes the "Related" list.

Does anyone have a reliable solution to this problem? Do I need to start thinking about firing Lightning Events from the Visualforce pages?

PS

Some more Googling has led me to this known issue Data updates are not reflected in UI after a Visualforce+Apex update in Lightning Experience reported by 530 users and more than 6 months old. That relates to the details not the related list, but a fix may address both. For now though, any workarounds?

Best Answer

Not sure I'd recommend this approach, but I ended up making a super simple Lightning component that I put on the record page that calls e.force:refreshView on component load. This forces a reload of the cache of the page on load, and makes sure it is up-to-date after any Visualforce pages have done some updates.

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <lightning:button onclick="{!c.doInit}" label="Refresh" title="Refresh"/>
</aura:component>

controller:

({
    doInit : function(component, event, helper) {
        $A.get('e.force:refreshView').fire();
    }
})
Related Topic