Currently, I'm working on lightning migration & i have a custom javascript button named convert. This button will display multiple toast messages based on record criteria. Everything working as expected.

Suppose if the user is clicking the button it will open quick action as well as toast message. The user will feel duplicate actions because he needs to close both toast and blank quick action. So, i have added below functionality


But the problem is now I'm able to see opening & closing the quick action view. Is there any better way to handle like displaying the message within quick action or closing the quick action in a better manner

My Component

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global"  controller="JavaScript_migration_controller">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
 <lightning:navigation aura:id="navigation"/>


    doInit : function(component, event, helper) {
        var action = component.get("c.fieldCheker");
        var recordId=component.get("v.recordId");
            "recId" : recordId
        action.setCallback(this, function(response){
            var state = response.getState(); 
            if(state == 'SUCCESS') {                
                var returnValue= response.getReturnValue() 
                    if(returnValue.Promo__c==null || returnValue.Promo__c =='undefined'){
                        var toastEvent = $A.get("e.force:showToast");
                            title: "Error!",
                            message: "To convert this lead, Please specify whether Marketing Promo is applied or not.\n\nYou can update this information using the 'Promo' field under 'Marketing Information' section.\n\nThank you for your co-operation.",
                            type: "Error"});
                    else if(returnValue.Flag_Type__c == 'Related'){
                        alert("You don't have sufficient access to convert a related lead.\n\nPlease swap this lead to master by clicking the swap to master button\n\nFor more information contact SMO team.") 
                            var navLink = component.find("navigation");
                            var pageRef = {
                                type: 'standard__recordPage',
                                attributes: {
                                    actionName: 'edit',
                                    objectApiName: 'Lead',
                                    recordId : recordId  
                            navLink.navigate(pageRef, true);
        if(recordId !=null && 'undefined' ){

Please guide me where i lost

  • Can you show the messages in the quick action model instead of a toast? That way users can see multiple messages, they wouldn't need to close 2 things.
    – manjit5190
    Jul 20 '20 at 12:32
  • Could you please share your inputs as an answer
    – Pavan tej
    Jul 20 '20 at 12:44

You cannot remove the opening of the model, it will be there. I would suggest to show messages in the quick action model instead of a toast using slds alert.


That way users can see multiple messages, they wouldn't need to close 2 things.

  • Hey, alert contains SVG tags.i'm not able to access. Could you please help
    – Pavan tej
    Jul 20 '20 at 16:50

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.