4

I have a vf page in lightning which opens up on button click from the case detail page. The vf page will close the case upon save. I have an oncomplete method in vf 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 any one help me in this regard.

I tried using page reference without using on complete, even in there the page is not getting refreshed.

vf 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();"/>

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);

2 Answers 2

0

As per salesforce this seems to be a know issue. Intermittent fix will be released in spring 18.

3
  • do you have a link to the known issue?
    – hamayoun
    Commented Apr 3, 2018 at 21:00
  • Here is the link for known issue success.salesforce.com/…
    – Sneha
    Commented May 17, 2018 at 18:09
  • Is there any workaround for the same? Commented Apr 5, 2019 at 6:58
0

JavaScript won't understand the Sforce function. You can use this to navigate to another window:

window.open(window.location.origin+'/'+"/one/one.app#/sObject/'+caseId+'/view'",'_parent');

You can use '_blank' to open it in new tab also and keep the parent window as it is.

2
  • Its not getting refreshed, it is opening the case in the detail mode(not getting the updated value from db) + another window of the vf page.
    – bksfdc
    Commented Dec 28, 2017 at 9:28
  • I have a raised a case with salesforce and this seems to be a know issue. Intermittent fix will be released in spring 18.
    – bksfdc
    Commented Feb 15, 2018 at 9:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .