Activity Forums Salesforce® Discussions how to show toast message box in a lightning component ?

  • K

    Member
    October 20, 2019 at 5:27 am

    Hi Yogesh,

    You can use "showToast" out-of-box event.

     

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

    showToastMsg.setParams({

    message : "Your error message" ,

    type : "error"

    });

    showToastMsg.fire();

     

     

    if you want you can pass dynamic params to message.

     

    Thanks

    Srinivas

     

     

  • Saddam

    Member
    October 21, 2019 at 9:58 am

    Hi,

    A toast displays a message below the header at the top of a view. The message is specified by the message attribute.

    force:showToast is not available on login pages.

    This example displays a toast message "Success! The record has been updated successfully.

    showToast : function(component, event, helper) {
    var toastEvent = $A.get("e.force:showToast");
    toastEvent.setParams({
    "title": "Success!",
    "message": "The record has been updated successfully."
    });
    toastEvent.fire();
    }

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos