1

I have LWC wrapped in quick action Aura component and on button click I am trying to close the quick action but the functionality is not working. After clicking on close button modal is still open. My code is below:

Aura comp

<aura:component implements="force:lightningQuickAction,force:hasRecordId" access="global">
   <c:sapEquipmentLookup recordId="{!v.recordId}" onclose="{!c.closeQA}"/>
</aura:component>   

Controller

({
  closeQA : function(component, event, helper) {
    console.log('parent comp')
    $A.get("e.force:closeQuickAction").fire();
  }
})

LWC component js file

import { LightningElement, api } from 'lwc';

export default class SapEquipmentLookup extends LightningElement {
  @api recordId
  closeQuickAction() {
    const closeQA = new CustomEvent('close');
    this.dispatchEvent(closeQA);
  }
}

LWC html

<template>
<section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_medium" 
aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
    <div class="slds-modal__container">
        <header class="slds-modal__header slds-theme_shade">
            <button class="slds-button slds-button_icon slds-modal__close slds-button_icon- 
  inverse" title="Close" onclick={closeQuickAction}>
                <lightning-icon icon-name="utility:close" variant="inverse" title="Close" 
                size="small"></lightning-icon>
            </button> 
            <h2 id="modal-heading-01" class="slds-modal__title slds-hyphenate">Close Case</h2>
        </header>
        <div class="slds-modal__content" id="modal-content-id-1">

        </div>
    </div>
</section>
<div class="slds-backdrop slds-backdrop_open"></div>

</template>
2
  • 1
    Solved. Controller methods updated to: closeQA : function(component, event, helper) { $A.get("e.force:closeQuickAction").fire(); $A.get("e.force:refreshView").fire(); }
    – mSinisa
    Jun 21, 2021 at 12:56
  • 3
    you can self answer your question! Please feel free to add your answer as well. Jun 21, 2021 at 13:01

1 Answer 1

2

Controller methods updated to:

closeQA : function(component, event, helper) { 
  $A.get("e.force:closeQuickAction").fire(); 
  $A.get("e.force:refreshView").fire(); 
} 
1
  • great solution!
    – prem22
    Jul 13, 2023 at 7:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .