+ Start a Discussion
Team AppSharkTeam AppShark 

Data updates are not reflected in UI after updating record from LWC using UpdateRecord function.

updateRecord(record)
                // eslint-disable-next-line no-unused-vars
                .then(() => {
                    this.dispatchEvent(
                        new ShowToastEvent({
                            title: 'Success',
                            message: 'Record Is Updated',
                            variant: 'Success',
                        }),
                    );
                })
                .catch(error => {
                    this.dispatchEvent(
                        new ShowToastEvent({
                            title: 'Error on data save',
                            message: error,
                            variant: 'error',
                        }),
                    );
                });
AnudeepAnudeep (Salesforce Developers) 
Hi,

Please try adding the following to your code.
 
/ Display fresh data in the form
                    return refreshApex(this.contact);
This line is taken from the example in the following document 
​​​​​​​
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_update_record​​​​​​​

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. Thank You!

Anudeep

 
Anil Bolisetty 2Anil Bolisetty 2
I have tried like this not good way of doing but it works

eval("$A.get('e.force:refreshView').fire();");