-
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/2023/11/16043823/sa_1700109425Copy%20of%20Copy%20of%20Untitled%20Design-1024x576.png)
What is Salesforce Data Migration Solution?
Salesforce, a leading customer relationship management (CRM) platform, offers businesses a powerful set of tools to manage their sales, marketing, and customer service activities. As…
![Net Zero Cloud](https://images.forcetalks.com/wp-content/uploads/2023/03/12124233/Blog-banner-Sep-2022-2023-04-12T180909.429.png)
Dig Deeper into Salesforce Net Zero Cloud | The Ultimate Guide
In our last blog, we told you about one of the latest products from Salesforce called Net Zero Cloud designed to help businesses measure and…
![](https://images.forcetalks.com/wp-content/uploads/2023/05/30103225/Blog-banner-Sep-2022-2023-05-30T160156.299.png)
Salesforce Integration with Dropbox | The Ultimate Guide
Following are the steps to Integrate Salesforce with Dropbox: Click AppLauncher and visit AppExchange, search for Dropbox for Salesforce, and click Get it now, Install…
Popular Salesforce Videos
Basic Concepts of Salesforce | Salesforce Training Online
This video session on Salesforce online training covers the basic concepts of Salesforce and will give intense knowledge on Salesforce at a very high level.…
Auditing Account Deletion Using Salesforce Flow
This demo video walks through an example of Auditing Account Deletion Using Salesforce Flow Ever had an instance where users have accidentally deleted Accounts and…
Salesforce Lightning User Tips and Tricks Spring 2023
SalesPath Corporation has created a video explaining tips and tricks that every Salesforce user will find helpful in order to increase productivity. This video also…