Is it possible to fire another javascript method when the ShowToastEvent popup is closed?

Here is the code I have that trigger the toast event:

            .then(() => {

                    new ShowToastEvent({
                        title: 'Success',
                        message: 'Event Message',
                        variant: 'success',
                        mode: 'sticky'
            .catch(error => {
                    new ShowToastEvent({
                        title: 'Error Message',
                        message: error.body.message,
                        variant: 'error'

What I would like to have happen is when the Success popup 'X' is click another JS method would be called.

1 Answer 1


I don't think there is native support of what you are looking for. The best you can do so far with toasts is show some clickable links which would redirect you to certain record or webpages.

You have to re-invent the wheel and implement complete toast functionality yourself using SLDS Toast.

  • 1
    Oof that's what I was kind of expecting. The link to the Lightning Design System page is super helpful though, so thanks for that!
    – Zach
    Commented Feb 21, 2020 at 22:17

You must log in to answer this question.

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