0

I'm currently looking for solutions for how to refresh the related lists on a record page from an LWC.

Here's what to know:

  1. I have an Object Action which has its New button overwridden by an Aura Component.
  2. The Aura Component contains an LWC.
  3. The Action record is created from a Related List on a Parent Object, which we'll call Parent
  4. After saving the Action in the LWC, I want to navigate back to the Parent record and refresh the related list for Action to show changes. I also want to display a Toast Message to let the User know the update finished.

The only thing I've found that works consistently is using window.location to set the page. This as you can guess causes issue displaying the Toast Message. I tried the following with no luck:

  1. Using notifyRecordUpdateAvailable on the Parent record
  2. Executing updateRecord on the Parent record
  3. Dispatching a RefreshEvent
  4. Using the NavigationMixin and setting a State property to see if that makes a difference.
  5. Navigation to the Parent record as a Web Page instead of a record in NavigationMixin's Navigate Method.
  6. In the Aura Override Component, firing a refreshView Event.

My code before was just using the Standard Mixin to Navigate like this:

this[NavigationMixin.Navigate]({
    type: 'standard__recordPage',
    attributes: {
        recordId:recordId,
        objectApiName: 'Record__c',
        actionName: 'view'
    }
}, true);

1 Answer 1

0

So I figured out a workaround I wanted to share at least.

We were updating the related records through a controller. If we kick off an updateRecord statement in the LWC for the same record, however, this refreshes the record in the related list too.

Not sure this will work for everyone, but figured I'd share it anyway.

Edit: This doesn't work for new records, we found kicking off a RefreshEvent on the page every time it loads does cause new records to show up though.

You must log in to answer this question.

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