-
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

5 Benefits of Salesforce for Insurance
When it comes to insurance CRM, Salesforce enjoys massive popularity, and deservedly so. Salesforce goes beyond the typical CRM functionalities and offers out-of-the-box capabilities. It…

Simplified Guide To Debugging In Salesforce
Debugging is a critical skill for anyone working in Salesforce. It helps identify and resolve issues in various components like Apex classes, triggers, Flows, Lightning…

5 Essential Aspects of a Successful Salesforce Data Security Policy
Data security should never be an afterthought when growing a business. Whether it’s customer data or client lists, or proprietary business information, the importance and…
Popular Salesforce Videos
How Much I Earn as a Salesforce Consultant!
In this video, Adam Foyston gives a detailed look at the earnings of Salesforce consultants, how they compare to the earnings of Salesforce admins, and…
Creating an Approval Process in Salesforce with Example
Approval Process in Salesforce is an automated process that automates how Salesforce records are approved in your org. Approval Process in Salesforce is a combination…
How To Use Javascript Editor In Formstack Part 2 - Learn Salesforce Series By Algoworks
Learn how to integrate Javascript editor in Formstack in this Salesforce tutorial brought to you by Algoworks. Did you miss the complete tutorial? To watch…