2

Is there possibility to refresh the standard related list from LWC, as we can do it using $A.get('e.force:refreshView').fire() in aura?

Any alternative to "$A.get('e.force:refreshView').fire() " in LWC

2 Answers 2

3

I have used getRecordNotifyChange() function to refresh the required list of records, for more info please follow the below:

https://blog.texei.com/refresh-a-record-page-from-a-lightning-web-component-14a5874ff68e

you can also trick it with

eval("$A.get('e.force:refreshView').fire();");
2
  • I saw this blog, in that it says "getRecordNotifyChange() however can refresh existing Contacts in the related list, but will not bring new Contacts to the page.", so it will not bring new records. I can try with eval one. However, I already used the Lightning message to aura to fire the refreshview.
    – Ajay
    Mar 19, 2021 at 15:09
  • 1
    Use eval it will work. Mar 19, 2021 at 16:48
1

Starting Spring 23, you can use RefreshAPI(Beta). This is currently in BETA but if you have a preview sandbox you can try the below

To refresh it import the module as shown below

import { RefreshEvent } from 'lightning/refresh';

And to refresh the standard components simply dispatch a Refresh event like below

 this.dispatchEvent(new RefreshEvent());
1
  • Becoming GA in Summer 23 btw.
    – bpilling
    May 26 at 2:24

You must log in to answer this question.

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