0

I have a lightning-record-edit-form in which I am editing a record. Once the record is updated successfully, I want to refresh the related lists automatically on the record page. Can I use notifyRecordUpdateAvailable([{recordId: this.recordId}]) or getRecordNotifyChange([{recordId: this.recordId}]) inside the onsuccess handler function to refresh the related lists. I tried to implement this but did not work for me:

handleSuccess() {
    notifyRecordUpdateAvailable([{recordId: this.recordId}]);
    //location.reload();
}

I am calling this handleSuccess() method inside onsuccess handler of my lightning-record-edit-form. I don't want to refresh the entire page by using location.reload(). Can someone help me with this?

2
  • Of course, you can call but you don't need notifyRecordUpdateAvailable when you are using lightning-record-edit-form. Commented Oct 4, 2023 at 10:09
  • Thank you for responding, but i need to reload the related lists on the record page once the record is updated, is there any way to achieve this without reloading the entire page?
    – Celsy
    Commented Oct 6, 2023 at 7:34

1 Answer 1

0

You can do it like this

async handleSuccess(event) {
    let recordId = event.detail.id;
    await notifyRecordUpdateAvailable([{recordId: recordId}]);
    //location.reload();
}
5
  • Thank you, I tried this code, but it didn't work
    – Celsy
    Commented Oct 6, 2023 at 10:50
  • @Celsy are you getting any error? Commented Oct 6, 2023 at 11:01
  • it is not throwing any error, I even tried by fetching the ID of the related list record and passed it in await notifyRecordUpdateAvailable([{recordId: this.tprId}]) but still not working
    – Celsy
    Commented Oct 6, 2023 at 11:53
  • @Celsy can you share the relevant code? are you sure tprId is not null? Commented Oct 6, 2023 at 16:13
  • Also, you can try this - salesforce.stackexchange.com/questions/337280/… Commented Oct 6, 2023 at 16:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .