• #28579
    Forcetalks

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

     

    #28592
    Salesforce | Aman Aman #4
    Forcetalks

    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). **

     

    #41794
    Forcetalks

    Dear Shiv,

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

     

    Thanks

    Mayank Jain

Viewing 3 posts - 1 through 3 (of 3 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?