function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

how to use toastmessage on lightning modal

Can someone help me with showing notifications like success/error/warning on lightning modal by firing toastevent
Raj VakatiRaj Vakati
Hi Hemath , 
If You see the below code where I am using success and error message on toast message. e.force:showToast is having an attribute to specify the type link error, warning, success etc. Hope this solves your question.
action.setParams({"recordId": component.get("v.recordId")});
        action.setCallback(this, function(res) {
        var response = res.getReturnValue();
        var state = action.getState();
        if(component.isValid() && state == "SUCCESS"){            
            var toastEvent = $A.get("e.force:showToast");
                  "title": "Success!",
                "message": "This Lead has been converted.",
                  "type ": "success"

         } else if (state == "ERROR") {
                  "title": "Success!",
                "message": "Some Think went Wrond."+ action.getState(),
                  "type ": "error"
            console.log('There was a problem and the state is: '+);

Hi Rajamohan, 

Thanks for your response. But this doesn't resolve my problem. I have a component and on that I have a button, on click of which I am opening a Modal. This modal is used to perform save/edit operation. I wan't to show the message of successful save on this Modal itself, while the modal is open.