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
YiQin HeYiQin He 

How to close lightning quick action modal dialog

Hi, 

I created a lightning component as a quick action button. In the component, I have a cancel button that I want it closed when user clicks.
User-added image

But the problem is that I cannot find any document explain how to close the modal dialog. This is the ui code:
<aura:component controller="ContactController" implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" >
    <style>
        .changeRecordTypeRow {
        margin-top: 1.5rem;
        margin-bottom: 0;
        margin-left: 0;
        margin-right: 0;
        }
        
        .changeRecordTypeLeftColumn {
        float: left;
        text-align: right;
        padding-right: 1.5rem;
        width: 35%;
        font-size: .8125rem;
        color: rgb(84, 105, 141);
        }
        
        .changeRecordTypeRightColumn {
        float: right;
        text-align: left;
        width: 65%;
        }
        
        .modal-body
        {
        	height:auto !important;
        	padding:0;
        }
        
        .forceChatterLightningComponent .bodyWrapper{height:100%;width:100%;padding:0;box-sizing:border-box}
    </style>
    <div class="modal-header slds-modal__header">
        <h2 class="title slds-text-heading--medium" >Change Contact Type</h2>
    </div>
    <div class="scrollable slds-modal__content slds-p-around--medium">
        <div class="changeRecordTypeRow">
            <fieldset class="slds-form-element">
                <div class="changeRecordTypeLeftColumn">
                    <legend class="form-element__legend slds-form-element__label">Select a record type</legend>
                </div>
                <div class="changeRecordTypeRightColumn slds-form-element__control">

                    <span class="slds-radio">
                        <input type="radio" id="radio_PrimaryContact" name="recordType" />
                        <label class="slds-radio__label" for="radio_PrimaryContact">
                            <span class="slds-radio--faux"></span>
                            <span class="slds-form-element__label">Primary Contact</span>
                        </label>
                    </span>
                    <span class="slds-radio">
                        <input type="radio" id="radio_SecondaryContact" name="recordType" />
                        <label class="slds-radio__label" for="radio_SecondaryContact">
                            <span class="slds-radio--faux"></span>
                            <span class="slds-form-element__label">Secondary Contact</span>
                        </label>
                    </span>
                </div>
            </fieldset>
        </div>
	</div>
    <div class="modal-footer slds-modal__footer">
    	<div class="forceChangeRecordTypeFooter">
        	<button type="button" class="slds-button slds-button--neutral .slds-modal__close" aura:id="btnCancel" >
            	Cancel
            </button>
            <button type="button" class="slds-button slds-button--brand" aura:id="btnSave">
            	Save
            </button>
        </div>
    </div>
</aura:component>
Does anyone have similar experience? Thanks in advance.
Best Answer chosen by YiQin He
YiQin HeYiQin He
Hi Karthik,

Thanks for the reply. I've already found the solution.
Call this method $A.get("e.force:closeQuickAction").fire() will close the modal dialog.

Yiqin

All Answers

karthikeyan perumalkarthikeyan perumal
Hello 

Try Below Code: 
 
<aura:component controller="ContactController" implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" >
    <style>
        .changeRecordTypeRow {
        margin-top: 1.5rem;
        margin-bottom: 0;
        margin-left: 0;
        }
        
        .changeRecordTypeLeftColumn {
        float: left;
        text-align: right;
        padding-right: 1.5rem;
        width: 35%;
        font-size: .8125rem;
        color: rgb(84, 105, 141);
        }
        
        .changeRecordTypeRightColumn {
        float: right;
        text-align: left;
        width: 65%;
        }
        
        .modal-body
        {
        	height:auto !important;
        	padding:0;
        }
        
        .forceChatterLightningComponent .bodyWrapper{height:100%;width:100%;padding:0;box-sizing:border-box}
    </style>
    <div aura:id="MainDiv" class="slds-modal__container">
    <div class="modal-header slds-modal__header">
        <h2 class="title slds-text-heading--medium" >Change Contact Type</h2>
    </div>
    <div  class="scrollable slds-modal__content slds-p-around--medium">
        <div class="changeRecordTypeRow">
            <fieldset class="slds-form-element">
                <div class="changeRecordTypeLeftColumn">
                    <legend class="form-element__legend slds-form-element__label">Select a record type</legend>
                </div>
                <div class="changeRecordTypeRightColumn slds-form-element__control">

                    <span class="slds-radio">
                        <input type="radio" id="radio_PrimaryContact" name="recordType" />
                        <label class="slds-radio__label" for="radio_PrimaryContact">
                            <span class="slds-radio--faux"></span>
                            <span class="slds-form-element__label">Primary Contact</span>
                        </label>
                    </span>
                    <span class="slds-radio">
                        <input type="radio" id="radio_SecondaryContact" name="recordType" />
                        <label class="slds-radio__label" for="radio_SecondaryContact">
                            <span class="slds-radio--faux"></span>
                            <span class="slds-form-element__label">Secondary Contact</span>
                        </label>
                    </span>
                </div>
            </fieldset>
        </div>
	</div>
    <div class="modal-footer slds-modal__footer">
    	<div class="forceChangeRecordTypeFooter">
        	<button type="button" class="slds-button slds-button--neutral .slds-modal__close" aura:id="btnCancel" Press={!c.removeCSS} >
            	Cancel
            </button>
            <button type="button" class="slds-button slds-button--brand" aura:id="btnSave">
            	Save
            </button>
        </div>
    </div>
  </div>
</aura:component>

in Controller add Below Method

removeCSS: function(cmp, event) {
        var cmpTarget = cmp.find('MainDiv');
        $A.util.removeClass(cmpTarget, 'slds-modal__container');
    }

Hope it will help you. 

Thanks
Karthik 
 
YiQin HeYiQin He
Hi Karthik,

Thanks for the reply. I've already found the solution.
Call this method $A.get("e.force:closeQuickAction").fire() will close the modal dialog.

Yiqin
This was selected as the best answer
Joko SiJoko Si
in Controller add Below Method

removeCSS: function(cmp, event) {
        var cmpTarget = cmp.find('MainDiv');
        $A.util.removeClass(cmpTarget, 'slds-modal__container');
    }

Hope it will help you. 

Thanks
Karthik

This is work with me.. Thank you sir (https://mp3juice1s.cc/)
Joko SiJoko Si
Hi Karthik,

Thanks for the reply. I've already found the solution.
Call this method $A.get("e.force:closeQuickAction").fire() will close the modal dialog.

Yiqin

Yeah.. this is work too. Thank you so much (https://mp3juice1s.cc/" rel="dofollow)
Suraj Kumar 182Suraj Kumar 182
thanks, a lot of for sharing your knowledge love you (https://modapkapp.xyz/" target="_blank)
tommy R 3tommy R 3
This is really helpful for me. Thanks a lot (https://thetechbytes.net/among-us-mod-apk/)
Clone ApkClone Apk
Township Mod Apk premium 2022 (https://cloneapk.com/township-mod-apk/), unlimited Money and cash. It is developed by Playrix. You can make your dream village with us and take care of members, animals who lived in the village. Stay tuned with us to know how it removes stress. As always we are back with a new modded game that unlocks so many new features.
li luuli luu
Thanks for sharing, it is very useful for me! Can come to fmwhatsapp above chat ah!<a href="https://www.new-gbwhatsapp.com/fmwhatsapp-download/">fmwa latest version official fmmods</a>
faizan elahifaizan elahi
Use the below methods to close the quick action popup and refresh the page from custom Salesforce Lightning Component.
( FmWhatsapp Apk (https://apknike.com/fmwhatsapp-apk/) )
Taylor NormaTaylor Norma
The article posted was very informative and useful. You people are doing a great job. (https://wisereview.com.au/best-massage-cushion.html)
jhon Vasilenkajhon Vasilenka
yah This is really helpful for me and useing on my site and grate example https://mp3juices.mx (https://mp3juices.mx" target="_blank)
Robin Uthapa 4Robin Uthapa 4
Thanks for the special data in this topic. It’s very hard to discover nowadays to recognize approximately the basics however you did it a lot nicely and I cherished it . https://gbwhatsapp.net/gb-whatsapp-pro-apk/
Loran HubLoran Hub
The article posted was very informative and useful. You people are doing a great job. https://www.bbqvilla.com/weber-vs-traeger/
Loran HubLoran Hub
The article posted was very informative and useful. You people are doing a great job. https://www.bbqvilla.com/weber-vs-traeger/
Brown rangBrown rang
It helped me on a current project, thank you! Getmyoffer capitalone com (https://getmyoffer.life/)
Simavo SmithSimavo Smith
Have you tried creating a custom event to handle this?
Create a custom component event using the <aura:event> tag in a .evt resource. Events can contain attributes that can be set before the event is fired and read when the event is handled. Use type="COMPONENT" in the <aura:event> tag for a component event. For example, this c:compEvent component event has one attribute with a name of message. 
Thanks https://milestoneapply.cards/wwwmilestoneapplycom/
xiy akigxiy akig
I am working on a similar project and it helped me. I find some more useful answers at Coursesanswer.com (https://coursesanswer.com/) you can also find the solutions of any questions you need. 
Smith RorgerSmith Rorger
You can also create this kind of dialogue box background using Canva Pro Apk. Check here: https://hackemtu.com/canva-pro-mod
UniAcco OfficialUniAcco Official
If you want to study abroad and looking for Student Accommodation, Uniacco is here to help you! Check out these article to know more - Student Accommodation PerthStudent Accommodation Brisbane
Robin AlexRobin Alex
Let's talk about the modified version of official whatsapp like whatsapp plus (https://gbappsking.com/whatsapp-plus/). have you ever tried it?
Daly daly 10Daly daly 10
Great written and come with approximately Lots (https://townapps.net/word-lots-answers/) important infos .
big basketbig basket
Find all the Products for your need on Huda Beauty (https://bigbasket.pk/): This site was really built with you in mind and we hope you will find it useful products Especially related to cosmetics.
Mark Johnson 107Mark Johnson 107
love it, I found the solutio now 


getmyoffer.capitalone.com  (https://getmyoffer.live/)
Alin JohnAlin John
You describe it in a very nice and interesting way, This problem become more dificult now a days but you make iteasy for evryone who did not solve it yet. Thanks for this act. https://editorsmodapk.com/download-picsart-for-android/
lisa Sharmalisa Sharma
Download latest version of WhatsApp Plus official APK. WhatsaApp+ latest APK download from the website, updated version no ban free. 32 MB APK file.
Visit Us: https://whatsappplus.cc/
Shaad Amin 2Shaad Amin 2
Vegamovies is a fantastic website for downloading the latest TV series, Talk shows, and films. It is like torrent websites that provide online watching stuff with no money. Before introducing Vegamovies (http://vegamovies.com.in), most people, including you, never consider its facilities. Many sites are legal, but they need a lot of money for a subscription. The most common example of such a type of website is Netflix. Everything in the world has two faces first one is the positive one and the second one is the negative sight. So, Vegamovies.com.in has disadvantages with unique advantages. visit to read more
Andro YunAndro Yun

Andro Yun (https://androyun.club/) is a group of Android and Technology enthusiasts. Our team loves to discover and write about the latest Apps and Games. We will keep you updated with Premium Apps and Games on our website. You can add us to your favorites to never miss any updates.

Mia JhonMia Jhon
Thanks for sharing iam using same box on my blog https://remiapk.com/  (https://remiapk.com/) and its realy awesome and grap more user on website.
abeera sultanabeera sultan
The article posted was very informative and useful! https://finderhub.com.au/woolworths-catalogue/
erika millserika mills
The ye old vibes from when I watched Flappy Bird (https://flappy-bird.io) this when it first came out struck hard
Sofia Henry 3Sofia Henry 3
Try out this attractive and sporty type The Sopranos Tony Soprano Blue Tracksuit (https://www.wilsonjackets.com/product/the-sopranos-tony-soprano-blue-tracksuit/" target="_blank) if you want to grab the sporty style look
Mia JhonMia Jhon
Thank You for explaning this ill use this code om ny website please check my website https://parafarmaceja.pl/ and tell is this code works or not.
Akshay Akshay 5Akshay Akshay 5
BGMI APK 2.6 Download the latest version here, download the bgmi apk + OBB File for your Android Smartphone and Enjoy the Indian PUBG BGMI 2.1 APK Game
.
https://bgmiapkupdate.in/
https://capcutmodsapk.in/
isabella janeisabella jane
es ist wirklich erstaunlich und informativen Beitrag und ich bin auf aktuelle Schrottpreise (http://schrottleitfaden.de) für diese arbeiten Sie können diese Website zu überprüfen. 
elizabet sawanelizabet sawan
In https://gbinstaa.com/oginstagram-apk/ settings you can close it by going to privacy and security settings.
Alex Morton 13Alex Morton 13
Your article is very informative. If you want car shipping service.Our company provide car shipping from hawaii to east coast (https://quickshipcars.com/car-shipping-to-hawaii-made-simple-a-step-by-step-guide/)go and visit
Tanya ChandiTanya Chandi
hey there I am a graphics designer experience almost  years of experience i am editing photos using AI Photo Enhancer (https://reminipro.net/remini-mod-apk/) a professional video editing and photo editor thanks for sharing
Aman bhardwaj 10Aman bhardwaj 10
In Salesforce Lightning, you can close a Quick Action modal dialog using JavaScript or by utilizing built-in functionality, depending on your specific use case. Here are two common methods:
Using JavaScript (Recommended for Custom Actions): If you want to close a Quick Action modal dialog programmatically, you can use JavaScript code. Here's an example of how to close a modal dialog:
javascriptCopy code

$A.get("e.force:closeQuickAction").fire();

You can place this code in a Lightning component controller or helper function, or even in a Visualforce page embedded within the Quick Action.
Using Built-in Functionality: For standard actions (such as "Create a Record," "Update a Record," etc.) and some custom actions, Salesforce provides a built-in mechanism to close the modal dialog automatically after the action is completed successfully. You don't need to write custom JavaScript for these actions; Salesforce handles it for you.
Just ensure that your Quick Action configuration is set up correctly, including setting the "Behavior" to "Display in existing window" and "Target Object" to the appropriate object.
Remember that the availability of these methods may vary depending on the specific Quick Action (http://toolcent.com) and Lightning component context in which you're working. Always test your implementation to ensure it works as expected for your use case.