I have a LWC Component added on Case object. Purpose of the component is to Change Ownership of the records and updates other fields on Case object. Once Ownership is changed, I have trigger which automatically creates Case Comments records. So for each ownership change, new Case Comment Records gets created.
Problem: When I navigate from LWC to Case record Page, with getRecordNotifyChange() I can see updated values in Case fields but I could not see updated count of Case Comment records in Case Comments Related objects (Looks like only Case Records get refreshed not their Related Child Records). In order to see latest Count of Case Comment, I have to navigate to Case Comments or refresh the screen.
Below is the sample Code:
handleSave(event) {
this.template.querySelectorAll('lightning-input-field').forEach(element => {
element.reportValidity();
});
changeOwnership({
userId: this.userId
})
.then(result => {
if (result === 'Success') {
// To refresh the page
getRecordNotifyChange([{
recordId: this.casesId
}]);
this[NavigationMixin.Navigate]({
type: 'standard__recordPage',
attributes: {
recordId: this.casesId,
objectApiName: 'Case',
actionName: 'view'
}
});
} else if (result === 'Error') {
}
})
.catch(error => {});
}
Can someone please help?