1

I've wanted to re-use my lwc quick action on another object, but turns out it's not supported. Hence I'm wrapping my lwc in aura component.

I want to close the modal via button press. Was hopping I could just fire the event from lwc, without doing additional wrapping.

Naively tried this, but no luck:

this.dispatchEvent(new CustomEvent('e.force:closeQuickAction'));

Got error

Invalid event type "e.force:closeQuickAction" dispatched in element <c-my-modal>. Event name must start with a lowercase letter and followed only lowercase letters, numbers, and underscores

1 Answer 1

-1

There are several ways to do it:-

  1. The lwc can be directly used with quick action, check this. To close the quick action panel, you can use CloseActionScreenEvent of 'lightning/actions' adaptor.

minimal required piece of code:-

    import { CloseActionScreenEvent } from 'lightning/actions';
    handleCancel() {
        this.dispatchEvent(new CloseActionScreenEvent());
    }
  1. You can wrap lwc in aura and fire an event from lwc that can be listened in Aura and event handler will fire close quick action event.

You must log in to answer this question.

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