How to Close Quick Action Screen Using LWC?

 How to Close Quick Action Screen Using LWC


Sample Code:

HTML:

<template>
    <lightning-quick-action-panel header="My Action">
        <p>Testing</p>
        <lightning-button variant="brand" label="Close" onclick={closeQuickAction}></lightning-button>
    </lightning-quick-action-panel>
</template>

JavaScript:

import { LightningElement } from 'lwc';
import { CloseActionScreenEvent } from 'lightning/actions';

export default class QuickActionScreen extends LightningElement {

    closeQuickAction() {
        this.dispatchEvent( new CloseActionScreenEvent() );
    }

}

JS-Meta.xml:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>54.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordAction</target>
        <target>lightning__RecordPage</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__RecordAction">
            <actionType>ScreenAction</actionType>
        </targetConfig>
    </targetConfigs>
</LightningComponentBundle>

Follow Us

Posted By : Sudeer Kamat Date :

view_module Related

Comments 0