0

I have created a Quick action of type VF page, Where it is calling Lightning Component APP. This Lightning component APP is calling LWC. Whenever a record gets saved, then i need to refresh the whole record page. But it is refreshing the Lightning component only. Here is the sample code what i have tried. Quick action is using this VF page :

  <apex:page StandardController="ServiceAppointment" showHeader="false">
    <apex:includeLightning />
    <div id="LcDisplayId"></div> 
    <script>
     $Lightning.use("c:LightningComponentAPP", function() {
        $Lightning.createComponent("c:LWCComponent", 
                                   { "recordId" : "{!$CurrentPage.parameters.Id}"}, 
                                   "LcDisplayId", 
                                   function(component) {
                                   });
    });
    </script>
</apex:page>

And Lightning App:

 <aura:application extends="ltng:outApp">
      <aura:dependency resource="c:LWCComponent" />
    </aura:application>

This is the LWCComponent.html button:

<div slot="footer" class="slds-grid slds-gutters slds-align--absolute-center">
<lightning-button label="Save" slot="actions" variant="brand" disabled={disableInput}
  onclick={createRecord}>
</lightning-button>
This is the lwc.JS action method.
createRecord() {
     this.isLoading = true;
        updaterecord({ value1: this.input1, acc1: this.acc1, seracc: this.seracc}).then(result => {
                 if (result === 'Success') {
                    this.isLoading = false;
                    //eval("$A.get('e.force:refreshView').fire();"); //This is what i tried, but did not work
                     location.reload(); //If i am using this the component is reloading. But i need whole record page needs to be refreshed which is in classic and lightning.

                }

        }).catch(error => {
            this.isLoading = true;
            console.log('Error occured while processing - ' + error);
            });
        }
}

Can someone please provide any inputs. This will be more helpful.

Thank you

0

You need to use the top-level window to refresh the entire area:

window.top.location.reload();
1
  • hI @sfdcfox, Thanks for your response. But this did not work. Even not refreshing the current component as well. When am using location.reload(); it is refreshing the component level. – anji reddy Oct 29 '20 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.