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?