The solution I found is to reload the page, both to cancel and to save.

HTML Code:

<div class="slds-float_right botoes">
                        <lightning-button class="slds-m-top_small" variant="Neutral" type="Cancel" name="Cancel"
                            label="Cancelar" onclick={closeAction}>

                        <lightning-button class="slds-p-horizontal_x-small slds-m-top_small" variant="brand"
                            type="submit" name="save" label="Salvar" onclick={handleSalvar}>

JS Code:

closeAction() {

handleSalvar(event) {
        event.target.disabled = true;
            OpptId: this.internalrecordId.Id,
            Categoria: this.categoriaselect,
            TipodeVenda: this.tiposelect,
            Fabricante: this.fabricanteselect,
            ValorVenda: this.valorvendaselect,
            Produto: this.produtoselect,
            ValorCompra: this.valorcompraselect,
            Bu: this.buselect,
            Margin: this.marginselect,
            Arquiteto: this.arquitetoselect,
            QuemPaga: this.quempagaselect,
            Fornecedor: this.fornecedorselect,
        }).then((data) => {
            if(data == 'success'){
                this.createToastEvent('Item adicionado com sucesso');
        }).catch((error) => {
            error && window.console.error(JSON.parse(JSON.stringify(error)));

I Try to use other solution, but not working... enter image description here

3 Answers 3


Use the CloseActionScreenEvent to close the Quick Action.

import { CloseActionScreenEvent } from 'lightning/actions';

closeAction() {
   this.dispatchEvent(new CloseActionScreenEvent());



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

export default class SampleLWCQuickAction extends LightningElement {
  handleCase() {
    this.dispatchEvent(new CloseActionScreenEvent());


  <lightning-quick-action-panel header="My action">
    Here's some content for the modal body.
    <div slot="footer">


<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <targetConfig targets="lightning__RecordAction">
  • It is working absolutely fine in my dev org. I have updated the answer with the example. Commented May 21, 2021 at 21:25
  • Thanks Friend! It's Working, the problem was in XML tag... <actionType>ScreenAction</actionType>
    – Jheron W
    Commented May 24, 2021 at 12:48

Per today's Summer 21 release webinar, you will need to do two things Add a new import:

import { CloseActionScreenEvent } from 'lightning/actions';

Then add a simple method to close it:

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

You can then call that and it will close the quick action. More details here

H/T to Fabien Taillon for the heads up on this one

  • Not working because is a LWC, and not Aura Comp..
    – Jheron W
    Commented May 21, 2021 at 19:40
  • Definitely works for LWC, but you need to be using Summer 21 API version I think Commented May 21, 2021 at 19:50
  • Thanks Friend! It's Working, the problem was in XML tag... <actionType>ScreenAction</actionType>
    – Jheron W
    Commented May 24, 2021 at 12:49

You can wrap your LWC component into Aura, pass event to it when you want to close and it'll call $A.get("e.force:closeQuickAction").fire();

you can also use the same approach I described here - https://salesforce.stackexchange.com/a/336026/16508.

TLDR; you can create Aura component which will use QuickActionApi and communicate with it via Messaging Channel.

You must log in to answer this question.

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