+ Start a Discussion
RbnRbn 

toast messages not displaying When embedding a lightning component inside a lightning app

Toast message works when i work from standalone LEX component, however when i save the record from the lightningApp the toast messages are not getting fire.

I know there is a limitation since we can not fire toast events from classic and app, 

I am looking out for an workaround here. Appreciate your help


Below is my controller.
onSave : function (component, event, helper) {
        helper.saveRec(component, event, helper);
    },
Helper :
 
saveRec:function(component, event, helper) {
        var gbmObj= component.get("v.newGBMPlan");
        var action = component.get("c.creatGBMRecord");
        if(component.get("v.recId")=="new")
        {
            action.setParams({
                "gbm": gbmObj ,
                "recId":component.get("v.recId"),
                
            });
        }
        else
        {
            action.setParams({
                "gbm": gbmObj ,
                "recId":component.get("v.recId"),
                
            });
        }
        action.setCallback(this,function(response){
            if (response.getState() === "SUCCESS") {
                //alert("Record Created/Updated Successfully");
                //window.close();
                
               // var toastEvent = $A.get("e.force:showToast");
              
                  helper.showToast({
                    title: "Record Created/Updated Successfully",
                    message: " ",
                    type: "success"
                });
             //toastEvent.fire();

Lightning App
<aura:application extends="force:slds" access="GLOBAL" >
    <aura:dependency resource="markup://force:showToast" type="EVENT"></aura:dependency>
	 <c:SC_Plans/>
  </aura:application>


 
Annu ChoudharyAnnu Choudhary
Hi Rbn,
Toast event in a lightning component not run in standalone-app (Lightning App). please this component to a or any record page and then run its work properly.
Please select the best answer if it works for you.
Thanks,