function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kiran Jain 15Kiran Jain 15 

How to refresh lwc when any change is occurred in apex

Hi Experts,
I am finding a solution of How to refresh lwc when any change is occurred in apex. In Lwc Component I am showing Contact records and I want to auto refresh when any changes is occurred in Apex.
I have no any apex class linked by lwc. my Lwc is inDepandent.
when I click a button at that time my Cmp is refreshing and getting new records but When any update is occurred in apex (LIke Via Trigger or user doing query and manually  update records in apex) at that time my Lwc automatic get refresh.

I hope someone will help me.
I will be greatfull.
Thanks In Advance
SUCHARITA MONDALSUCHARITA MONDAL

Hi Kiran,
 

Corresponding to this, you may need to have apex class and can use @track decorator to fetch latest changes in you LWC. If you aren't not using any apex class then you might check the below link: (but it works only if record is updated on Record Page)

https://salesforce.stackexchange.com/questions/274390/how-to-get-an-lwc-component-on-a-record-page-to-refresh-when-that-page-is-update

Hope this help!
Thanks
Sucharita