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
Adarsh G 6Adarsh G 6 

Detect trigger event from lightning component

Hi everyone,

Currently I have a trigger which will copy values from related list and I also have a custom lightning component which will display these values. I have a requirement to automatically refresh this lightning component whenever values are updated by trgger at the backend. Any suggestion on how to achieve this?

Note: I have tried with recordupdated functionality from force :recordData, but its not working since I want the component to be refreshed when  record is updated at the backend and recordupdated does not support this functionality.
AnudeepAnudeep (Salesforce Developers) 
Hi Adarsh, 

Have your tried Force:refreshView to refresh your component and the data? Thanks 
({
	createContact : function(component, event, helper) {
		console.log('inside create contact');
        $A.get('e.force:refreshView').fire();
        console.log('event fired');
	}
})

https://developer.salesforce.com/docs/component-library/bundle/force:refreshView

Anudeep
Adarsh G 6Adarsh G 6
Hi Anudeep, Thanks for your reply I can't use Force:refreshView since I want the component to refresh whenever the record is updated at the backend from the trigger. Requirement is to refresh whenever the record is updated at the backend and not when the record gets updated at the ui level. Any other suggestions to achieve this?
SUCHARITA MONDALSUCHARITA MONDAL
Hi Adarsh,
Please check the following link:
https://salesforce.stackexchange.com/questions/170542/automatically-refresh-lightning-component

Thanks,
Sucharita
Adarsh G 6Adarsh G 6
Thank you Sucharita for your reply.