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
Shanaka MunasingheShanaka Munasinghe 

e.force:closeQuickAction is not working after Winter '20 preview on sandbox.

Hi Everyone,

does anyone know why the $A.get("e.force:closeQuickAction").fire(); event is not working on aura component after the Winter '20 sandbox update? Or anyone experienced this issue?
AlvaroCostaAlvaroCosta
What is the behavior are you facing? Only shaded backdrop pops up and no modal notice window?
System Admin 1103System Admin 1103
I am facing the same issue. When I click on cross icon on top right, nothing happens and the modal stays
Shanaka MunasingheShanaka Munasinghe
I have raised a support ticket with Salesforce for this and they came back and said it seems to be a multi-user issue and they are still investigating it. Hopefully get an update within next few hours.
Shanaka MunasingheShanaka Munasinghe
@AlvaroCosta
If you are implementing lightningQuickActionWithoutHeader and having a custom lightning button to close the modal window using  $A.get("e.force:closeQuickAction")fire(); event, it will not work after the update. The modal popup will remain open and will not close.
Brian Matthews 45Brian Matthews 45
@Shanaka Munasinghe
Experiencing the same behavior, exactly as you described with a component implementing lightningQuickActionWithoutHeader . . .
AlvaroCostaAlvaroCosta
A Known Issue was created: https://success.salesforce.com/issues_view?id=a1p3A000001Yn18QAC
Brian Matthews 45Brian Matthews 45
@AlvaroCosta
Thanks for creating the known issue, 

The workaround is insufficient, in that I also use the "e.force.closeQuickAction" event to close the quick action dialog after a successful Save! 

It's nice that the "save" completes as expected, and I move the user to the newly created case tab in service console.  But, there's still a tab labeled "loading . . ." which is the original QuickAction dialog and it's just begging to be saved again, and so on.  

Not being able to close the dialog when needed, is a big problem.

Thanks,
-Brian

 
Brian Matthews 45Brian Matthews 45
@AlvaroCOsta
Got a "Real"  Workaround:

            // Original
            $A.get("e.force:closeQuickAction").fire();
            
            // Workaround
            var element = document.getElementsByClassName("DESKTOP uiModal forceModal");    
            element.forEach(function(e, t) {
                $A.util.addClass(e, 'slds-hide');
            });                        


-Brian
Henrique CabralHenrique Cabral
Thank you @Brian Matthews
disharee raydisharee ray
I am still facing this issue. is there any workaround to close the quick action?
Henrique CabralHenrique Cabral
Try the following code:

            var element = document.getElementsByClassName("DESKTOP uiModal forceModal");    
            element.forEach(function(e, t) {
                $A.util.addClass(e, 'slds-hide');
            });     
            $A.get("e.force:refreshView").fire();
Shivesh PandeyShivesh Pandey
//This code worked for me today. 

// Declare this at the start of your function and then 
var close = $A.get('e.force:closeQuickAction');

// use this where you want to close the quick action.
close.fire();
孝純 黄 4孝純 黄 4
I was encountered with this same issue recently and got it resolved by wrapping the callback with $A.getCallback.

My VF page communicates with the Aura-wrapper component via widnow.postMessage(), hence my code looks somthing like this:
```
var handleMessage = $A.getCallback(function (message) {
  if (some_logic) {
     $A.get('e.force:closeQuickAction').fire();
     window.removeEventListener('message', handleMessage);
  };
});
window.addEventListener('message', handleMessage);
```

What didn't work looks something like this:
```
window.addEventListener('message', function handleMessage(messasge) {
    if (some_logic) {
       $A.get('e.force:closeQuickAction').fire();
       window.removeEventListener('message', handleMessage);
    };
});
```
I came from the ReactJS world, so it seems to that the getCallback() wrapper provides something similar to the hooks in reactJS behind the scences.
Documents here: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_cb_mod_ext_js.htm
孝純 黄 4孝純 黄 4
According to the document, the key point is to ensure your code to be within the render-lifecycle of aura. Otherwise, we should hook it up with the render-lifecycle using $A.getCallback()