I tried to use this.dispatchEvent(new RefreshEvent())
to refresh standard related list on the same page but not working after I close the quick action panel. Below is the sample code
HTML
<template>
<lightning-quick-action-panel header="Edit Fields Action">
<lightning-record-edit-form
record-id={recordId}
object-api-name={objectApiName}
onsuccess={handleSuccess}>
<lightning-input-field field-name="Name"></lightning-input-field>
<lightning-input-field field-name="Phone"></lightning-input-field>
<lightning-button variant="neutral" label="Cancel"></lightning-button>
<lightning-button variant="brand" class="slds-m-left_x-small" label="Save" type="submit">
</lightning-button>
</lightning-record-edit-form>
</lightning-quick-action-panel>
</template>
JS
import { LightningElement, api } from "lwc";
import { CloseActionScreenEvent } from "lightning/actions";
import { RefreshEvent } from 'lightning/refresh';
export default class QuickEditFormExample extends LightningElement {
@api recordId;
@api objectApiName;
handleSuccess(e) {
this.dispatchEvent(new CloseActionScreenEvent());
this.dispatchEvent(new RefreshEvent());
}
}
meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>58.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__RecordAction</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__RecordAction">
<actionType>ScreenAction</actionType>
<objects>
<object>ObjectName</object>
</objects>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>