Activity Forums Salesforce® Discussions How to implement a custom toast message without firing a event in a Salesforce lightning component?

  • Deepak

    Member
    December 10, 2019 at 2:05 pm

    The correct method would be to use the lightning:overlayLibrary (or create your own modal dialog). How it works is given in the documentation. First, you include overlay library:

    <lightning:overlayLibrary aura:id="overlayLib"/>
    And then you call it when you need it:

    var modalBody;
    $A.createComponent("c:modalContent", {},
    function(content, status) {
    if (status === "SUCCESS") {
    modalBody = content;
    component.find('overlayLib').showCustomModal({
    header: "Application Confirmation",
    body: modalBody,
    showCloseButton: true,
    cssClass: "mymodal",
    closeCallback: function() {
    alert('You closed the alert!');
    }
    })
    }
    });
    Where c:modalContent is the thing you want to show in the modal dialog. I suggest you read the documentation for more information.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos