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
Rick Paugh 3Rick Paugh 3 

How to load standard detail record page w/o cache in Lightning

I have a page layout that display some basic information about a custom object.  I have a button on that detail page that fires off a VisualForce page that runs some code from a custom controller to update the data for the record in question then redirects the user back to the record detail page.  The problem is that after the redirect to the standard record detail page from the VisualForce page, none of the new data is there - only the old data is shown.  If I refresh the page (simple F5 or Ctrl+F5), all of the new data shows up.  My question is this, how do I force a standard record detail page to refresh everytime it's loaded rather than pulling from cache?
Khan AnasKhan Anas (Salesforce Developers) 
Hi Rick,

Please refer to the below link with a similar discussion which might help you further with the above issue.

https://salesforce.stackexchange.com/questions/134111/salesforce-lightning-component-cache

https://salesforce.stackexchange.com/questions/144979/lightning-experience-how-to-prevent-the-display-of-obsolete-data


I hope it helps you.

Kindly let me inform if it helps you and close your query by marking it as solved so that it can help others in future.

Thanks and Regards,
Khan Anas​
Rick Paugh 3Rick Paugh 3
Didn't work.  Old data still shows unless I manually refresh the browser window.
Russ Spears 7Russ Spears 7
I'm running into the exact same issue:
- Button on Lightning (Order) Record Detail Page calls a Visualforce Page.
- Visualforce Page uses standarController (Order). Only field updated is Pricebook.
- "Save" returns to unchanged record detail page.
- Manual browser refresh on the record detail page shows the updated values.

I also tried all the Javascript refresh tricks I could think of, but there was never a way to reference the record detail page to be the target to refresh.  
Russ Spears 7Russ Spears 7
As an addendum to the above, going to Home > Security > Session Settings and Unchecking the option: Enable secure and persistent browser caching to improve performance still kept the cached results.
Ravi Dutt SharmaRavi Dutt Sharma
Hi Rick, and Russ,

Can you please let me know how your VF page opens? Does it open in a pop-up or it opens in the same tab or in a different sub-tab? Whenever there is a cross communication between Lightning component and VF page, and either of them makes a data update, there is no way that the other component/page will automatically receive that information. You need to handle this explicitly by making use of communication pattern available between Lightning component and VF. You have to make use of postMessage to make this happen. After updating the data, your VF page will make a postMessage to the LEX component and the LEX component will have a listener which will capture this message and rerender itself. More information about this pattern can be found here: 

https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html

I have implemented this in my previous project, so if you need any help, do let me know. Thanks.
Rick Paugh 3Rick Paugh 3
Hi Ravi,

Thanks for the information, but your proposed solution seems to apply to cross origin calls and/or a VisualForce page wrapped in a Lightning Component - netiher of which are my scenario.  The issue is that in a redirect to a standard detail page within the same browser tab/window the data on that page is loaded from cache, not from the updated DB source.  As a result the old data is still shown and I have to manually refresh the page to get it to recognize the changed information.  Now if there's a way to tell a standard record detail page to refresh its data from a postMessage() then that would be great.  But I'm guessing this isn't something that can be done.
Rick Paugh 3Rick Paugh 3
Unfortunately, I can't enter the code "force:refreshView" in a standard detail page.