I know by title it feels not acceptable but hear me out. I have registered below event in my cmp file

<aura:registerEvent name="showToast" type="force:showToast" />

and an helper method as

showToast : function(component, title, message, type) {
        var toastEvent = $A.get("e.force:showToast");
            "title": title,
            "message": message, 
            "type": type,
            "mode": "sticky",
            "duration": "50000"

and i am calling this method on success callback of xyz functionality as

helper.showToast("",'SUCCESS', 'The Document has been Removed', "success");

but I see nothing on the page. It's a lightning page only.

I have even tried to give more duration so that I can inspect if it is there in the DOM or not but no I can not see.

I have checked SLDS.css, it's loading properly, I have event kept toast css classes in concerned component style also but to no avail.

Could you please provide some more directions on how to debug this to resolution.

Thanks, Akash

  • No need to register the event.......
    – Eric
    Commented Jan 31, 2017 at 11:48
  • No still not working, if I remove it then its throws an error; setParams of undefined
    – Test
    Commented Jan 31, 2017 at 12:35
  • What browser are you using? Try starting from a empty component with a button that calls showToast using code from here: developer.salesforce.com/docs/atlas.en-us.lightning.meta/… - then add your stuff to it and see where it breaks. Also, seems stupid but use " instead of ' just in case.
    – Eric
    Commented Jan 31, 2017 at 12:39
  • Odd, cause I do not have the event registered and the toast works fine. is the helper in a different component? We may need to see the whole code
    – Eric
    Commented Jan 31, 2017 at 12:43
  • 3
    @Test Where are you running the component ? Is it inside standalone app or your own custom app or vf page?
    – Praveen
    Commented Jan 31, 2017 at 12:45

2 Answers 2


You are view the lightning page from preview? if yes, the toast is not working because the event is handled by one.app.

Quoting from documentation:

This event is handled by the one.app container. It’s supported in Lightning Experience, Salesforce1, and Lightning communities.

You can create your own toast component if you want to preview the page, or simply create a tab for the lightning page.

Check documentation for more details: force:showToast


You can use lightning:notificationsLibrary. In your aura component, add:

<lightning:notificationsLibrary aura:id="notifLib"/>

And change your helper method to:

showToast : function(component, title, message, type) {
            "title": title,
            "message": message,
            "variant": type,
            "mode": "sticky"

You must log in to answer this question.

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