0

I have a Lightning record page that launches a visualforce page via a quick action button as a lightning popup.

Issue: When I save via the command button on the VFpage the redirect reloads the visualforce page as a full window. Not as the lightning popup.

I resolved the redirect issue by setting the redirect to FALSE in the apex controller, but this of course means the VFpage doesn't rerender based on actions triggered when fields update because of the save.

Controller public PageReference save() {

 // first save the incident
    std.save();

 // then save the procurement lineitems
    update lineitems;

 // set current page as reference to be returned to after save commits
    PageReference result=ApexPages.currentPage();
     result.setRedirect(false);       

    // navigates to page set above with updated values
    return result;
}

Visualforce Page excerpt:

            <script language="JavaScript" type="text/javascript">
          function SaveAndRefresh(){
            var newWin = null;          
            newWin =window.opener.location.href="/{!$CurrentPage.parameters.id}";     
            if (window.focus) {
              newWin.focus();
            }
            if (newWin != null) {
              newWin.close();
            }                                    
          }
        </script>
        <apex:commandButton value="Save" action="{!save}" onclick="SaveAndRefresh();return:true;" id="btn" rendered="{!IF(LineItem.Status__c!="Received",true,false)}"/>

Question: How can I rerender the LEX popup when the record is saved?

1 Answer 1

0

I was able to find the solution to my issue.

Thanks to bob_buzzard on https://developer.salesforce.com/forums/?id=906F0000000975sIAA

PageReference pageRef = new PageReference(ApexPages.currentPage().getUrl());
pageRef.setRedirect(true);
return pageRef;

You must log in to answer this question.

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