I am working on a Lightning component quick action that opens from a quick action on the Account.

Here is my component so far:

<aura:component controller="MyRestController" implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" access="global">
    <aura:handler name="init" action="{!c.init}" value="{!this}" />  

And here is the controller:

init: function (component, event, helper) { 
    var recordId = component.get("v.recordId");
    var action = component.get("c.getReport");
        "AccountID": recordId
    action.setCallback(this, function(response) {
        var state = response.getState();
        if(state === "SUCCESS") {

        else if(state = "ERROR"){
            var errorMsg = "My Error Message Goes Here"; 
            var toastParams = {
                title: "Error Message Title Here",
                message: errorMsg,
                type: "error"
            var toastEvent = $A.get("e.force:showToast");

The error message displays behind the dialog box that opens when the button clicks. I thought the error would display either inside the dialog box that opened initially when the button was clicked or the toast would replace the dialog. What is the correct way to surface the error message from lightning component quick action?

Your Answer

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

Browse other questions tagged or ask your own question.