Activity Forums Salesforce® Discussions Navigate to URL is not refreshing the page in Salesforce Lightning

  • Navigate to URL is not refreshing the page in Salesforce Lightning

    Posted by Shiv Kumar Sharma on May 9, 2018 at 7:05 am

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

    Aleh Vasileuski replied 5 years, 10 months ago 4 Members · 3 Replies
  • 3 Replies
  • Aman

    Member
    May 9, 2018 at 7:34 am

    Hi Shiv,

    It is a known issue to salesforce and possibily it will be fixed in next few releases.

    At present VisualForce navigation methods for sforce.one SOjects are not working for Chatter or Related lists.

    sforce.one.navigateToSObject(recordId, "chatter") and sforce.one.navigateToSObject(recordId, "related")
    will always default to sforce.one.navigateToSObject(recordId, "detail")
    ** NOTE: Calls to sforce.one.navigateToURL may result in an “Unsupported Page” error if the URL references standard pages for objects or Chatter pages. To avoid this error, ensure that the URL begins with a backslash (/_ui instead of _ui). **

     

  • Mayank Jain

    Member
    September 30, 2018 at 4:15 pm

    Dear Shiv,

    Did you get a workaround for this? I am also facing the same issue

     

    Thanks

    Mayank Jain

  • Aleh Vasileuski

    Member
    December 18, 2018 at 10:24 pm

    Hi!
    I have the same problem. Is there a solution to this problem?

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos