+ Start a Discussion
Vivekh88Vivekh88 

Close Modal dialog in Lightning

Hi,
when i click an action button on my account detail page it should redirect to a URL and close the action modal page. But the problem is the modal page is still there. Only redirection is happening.

this is my controller code,
({
    myAction : function(component, event, helper) {
        var recordId = component.get("v.recordId");
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url": "http://google.com&SalesforceRecordId="+recordId
        });
        urlEvent.fire();
        var dismissActionPanel = $A.get("e.force:closeQuickAction");
        dismissActionPanel.fire();
    }
})

I used 'closequickaction' method to close the modal window. But it is not working. Any idea..?

Thanks in advance..

Regards,
Vivek
Hemant_JainHemant_Jain
Can you try by moving the code of closequickaction before URL fire event?

Let me know if this works.
Vivekh88Vivekh88
Yeah i have also tried doing that Hemant. But still the same. Its not working.
Priyankar PakhiraPPPriyankar PakhiraPP
Please can you share the component code also
Vivekh88Vivekh88
Component:
<aura:component implements="force:lightningQuickAction,force:hasRecordId">
 <aura:handler name="init" value="{!this}" action="{!c.myAction}"/> 
</aura:component>

Thanks
Vivekh
Priyankar PakhiraPPPriyankar PakhiraPP
Hi

what is v.recordId refering to? 
Please can you post entire code.

happy Lightning learning
 
Vivekh88Vivekh88
This is the entire code. A component code and a controller code.
RamitaDuttaRamitaDutta
@Vivekh88 Were you able to fix this issue? I am struggling with the same problem, inputs will be appreciated.
ChellappaChellappa
Hi @Vivekh88 @RamitaDutta,

Have you found any resolution? I am also finding an answer to this.

Thanks,
Chellappa