+ Start a Discussion

I need to refresh the parent page that a Lightning Component was launched from

I have created a custom button on a custom object.  The button, when clicked, opens up a Visualforce Page, in which the Lightning Component is placed:
<apex:page docType="html-5.0" standardController="Business_Request__c" extensions="BusinessRequest_BRtoCaseController" showHeader="false" sidebar="false" standardStylesheets="false">
    <apex:stylesheet value="{!URLFOR($Resource.SLDS260, '/styles/salesforce-lightning-design-system.min.css')}"/>    
    <apex:includeScript value="{!$Resource.jQuery331}"/>
    <apex:includeLightning />    
    <apex:outputPanel layout="block">
        <div id="lightning"/>
    <!--Lightning Component--> 
        var base = location.protocol+"//"+location.hostname+(location.port && ":"+location.port);
        var brRecordId = "{!recordId}";
        $Lightning.use("c:BusinessRequest_BRtoCaseDependencyApp", function() {
                                           recordId : brRecordId,
                                           baseUrl : base
                                       function(component) {

The component (for which I cannot post the code, sorry) consists of a Lightning Design System modal, with a lightning:recordEditForm inside of it.  Once the form is filled out and saved, the Apex controller creates a related record and passes a success/fail boolean to the Lightning Helper.  

In the Helper I have the code written to show a Toast and automatically close the window after a timeout:
action.setCallback(this, function(response){
            var state = response.getState();  
            var caseCreated = Object.keys(response.getReturnValue())[0];
            var caseComCreated = Object.values(response.getReturnValue())[0];
            if(state === "SUCCESS" && caseCreated === "true" && caseComCreated === "true") {
                this.showToastHp(component, true);

(later in the code...)

    showToastHp : function (component, success){
        var $j = jQuery.noConflict();


Now, the window itself closes just fine.  However, I need something else to happen as well.  I need the record on which the button was pushed to refresh/reload.  I've tried many different Javascript methods, but the one I think may work is prohibited by lightning (uses the "opener" syntax).

Is there any way to do this?
Try window.parent.location.href = 'parent page url'; 
Yeah, I tried that, it sees the VF page that pops up after clicking the button as the "parent". So, it refreshes that correctly, but the record on which the button was clicked remains the same. The other option I tried was "window.opener.location.href", but you get an error there that doesn't allow cross-page tech. I was trying to think of a way to do it within the Lightning app itself, but haven't found anything that works.
Jigar TrivediJigar Trivedi
@knght4yshua, were you able to get this issue resolved? I am facing the same issue. I am not able to close the sub-tab. I tried implementing

- which you have used here - to close the tab. However, it is also not working. Do you know how we can close the tab and reload the parent page?
@Jigar, unfortunately I was not able to find a solution. The limitations of Lightning working within classic, I suppose.  If done as a lightning component within a lightning page would provide more options.  Sorry! ☹️
Jigar TrivediJigar Trivedi
@knght4yshua, ok thanks.