-
Navigate to URL is not refreshing the page in Salesforce Lightning
I have a visualforce page in lightning which opens up on button click from the case detail page. The visualforce page will close the case upon save. I have an oncomplete method in visualforce page which navigates to the case detail page once database update is done. The case detail is not getting refreshed. How can i refresh the page?
Can anyone help me in this regard?
I tried using page reference without using on complete, even in there the page is not getting refreshed.
Visualforce page with on complete
function refreshpage() { alert("method invoked 1"); var caseId='{!record.Id}'; if (sforce.console.isInConsole()) { window.top.location = '{!JSENCODE($CurrentPage.parameters.parent_domain)}/console'; }if({!$User.UITheme == 'Theme4d'}){ alert('Lightning-->'+caseId); sforce.one.navigateToURL('/one/one.app#/sObject/'+caseId+'/view',true); } else { window.top.location = '/{!$CurrentPage.parameters.id}'; }
<apex:commandbutton value="Save" action="{!save}" rendered="{!displayItems}" oncomplete="refreshpage();"> </apex:commandbutton>
Controller with Page Reference
public PageReference save() { update record; PageReference pageRef = new PageReference('/' + record.Id); return pageRef; //return controller.view(); }
I have tried all the below possibilities nothing seems to be working.
//window.open(window.location.origin+'/one/one.app#/sObject/'+caseId+'/view','_parent');
//sforce.one.navigateToSObject(caseId);
//window.location.href='/one/one.app#/sObject/'+caseId+'/view';
// window.top.location = '/{!$CurrentPage.parameters.id}';
// $A.get('e.force:refreshView').fire();
//Sfdc.canvas.publisher.publish({ name : "publisher.refresh", payload : { feed:true }});
//Sfdc.canvas.publisher.publish({name : 'publisher.refresh', payload : {feed: true, objectFields: true, objectRelatedLists: {}}});
//window.reload(true);
//window.close();
//sforce.one.navigateToURL('/one/one.app#/sObject/'+caseId+'/view',true);
Log In to reply.
Popular Salesforce Blogs
![](https://images.forcetalks.com/wp-content/uploads/2021/05/19122252/sa_1621426923SecretSauce_banner01.jpg)
How A Leading Equipment Manufacturer Boosted its Sales Potential by Adopting Advanced Salesforce CPQ Solutions
Decades ago, organizations relied on legacy systems to meet their CPQ requirements. Software systems have advanced significantly since then. Today, we have cutting-edge SaaS platforms that…
![](https://images.forcetalks.com/wp-content/uploads/2020/10/05141724/sa_16019074185%20Reasons%20to%20Embrace%20Salesforce%20Managed%20Service.png)
5 Reasons to Embrace Salesforce Managed Service
The managed service model has proven to be highly effective for businesses over the years. With no necessity to set up office infrastructure or hire…
![](https://images.forcetalks.com/wp-content/uploads/2017/10/25084013/sa_1507183756shutterstock_193326614.jpg)
Implemented All In One Donation Management System Using Salesforce
The Challenges The client was using a legacy system for all its donation related data entries, while leveraging a suite of vendors to enable their…
Popular Salesforce Videos
Crash Course on Apex Triggers Salesforce | Complete Guide with Real Time Scenarios
Complete guide on Apex Triggers Salesforce 0:00 Intro 0:33 Is Triggers difficult to Learn 0:50 What is Trigger? 3:03 What are Trigger events? 11:55 How…
Salesforce Einstein Keynote: Meet Your Smart CRM Assistant
Salesforce Einstein is your smart CRM assistant, making your employees smarter and your customers happier. With Einstein, everyone has an AI-powered assistant to help them…
Exploring Salesforce composite Resources | Composite API
Exploring Salesforce composite Resources-- 0:00 Introduction 1:30 What is Composite Resources? 2:00 Composite Resources consists of 2:25 Composite request body 5:30 Composite request response 6:33…