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
Rahul Kumar 652Rahul Kumar 652 

When the recordupdated attribute of force:recordData calls the js function in aura component ?

I just play with aura component  and get confused that when the recordupdated attribute of force:recordData calls the js action function .
I read in the documentation that recordupdated attribute calls the js function when the it finds the records changes , but i  use a alert in js function  to debug when the recordupdated attribute calls the action in js , and i find that the recordupdated attribute calls the js function as :
1.) when the page loads
2.) when i try to edit but save without any changes 
3.) when i edit the record 
So i want to know that if recordupdated attribute calls the js action only when the records changes  than why it calls the action in js when i save the record without any changes (as mention in point 2 above)
ANUTEJANUTEJ (Salesforce Developers) 
Hi Rahul Kumar,

Accoding to documentation: https://developer.salesforce.com/docs/component-library/bundle/force:recordData/documentation

The recordupdate event gets called when the record is loaded so after the save button is clicked it could be that the record is loaded again so that recordUpdate is called and the alert window is shown even though there is no change in the record details.

I hope this helps.

Regards,
Anutej