<aura:component implements="force:lightningQuickAction">
    <ui:inputNumber aura:id="num1"/> +
    <ui:inputNumber aura:id="num2"/>
    <ui:button label="Add" press="{!c.showToast}"/>


        showToast : function(component, event, helper) {
        var n1 = component.find("num1").get("v.value");
        var n2 = component.find("num2").get("v.value");

        // Display the total in a "toast" status message

        var resultsToast = $A.get("e.force:showToast");
            "title": "Quick Add: " + n1 + " + " + n2,
            "message": "The total is: " + (n1 + n2) + "."

        // Close the action panel

        var dismissActionPanel = $A.get("e.force:closeQuickAction");


This page has an error. You might just need to refresh it. Action failed: c$TestCheck1$controller$showToast [Cannot read property 'setParams' of undefined] Failing descriptor: {c$TestCheck1$controller$showToast}

  • 2
    how are you running the component? Is it inside a vf page? – Praveen Jan 16 '17 at 17:06
  • No not in a vf in an aura:application I'm calling this component – david raj Jan 16 '17 at 18:39
  • As Phil points standard force event like force:showToast will not work in lightning-out as well in Standalone App. It will work only in one.app container(sf1 or LEX) – Praveen Jan 17 '17 at 3:49
  • Check Nordine's Post he got it when he previewed it i guess he created a lightning app and added it a tab and then might have previewed it let me do it and check – david raj Jan 17 '17 at 4:14
  • 1
    I see it as a specific app where all the Lightning tabs are hosted. – Praveen Jan 17 '17 at 4:58

If you're using Preview from Dev Console this won't work (or, as Praveen pointed out from Visualforce), you'd have to test it in lightning experience.

The documentation states:

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

I can only assume that Aura preview is not Lightning Experience (would think its to do with the full app framework not being loaded in preview).


When you try to launch the component via app , standard events (toast, navigateToSobject, etc) will be undefined.

var resultsToast = $A.get("e.force:showToast");

toastEvent will have "undefined " always.

Therefore launch your toastComponent in LEX via app builder or lightning quickaction or drag to detail page to check how it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.