Skip to main content

Hello Everyone, Our company is working on migration to lightning from classic. Can you please tell me which is the best way to direct a user to a web url in lightning?

 

In classic we can have a custom button. However in lightning based on my research looks like a component needs to be added. I used the following component code and added it to the a lightning action and it works perfectly except that the modal box is not closing automatically inspite of using 

 

var dismissActionPanel = $A.get("e.force:closeQuickAction");

dismissActionPanel.fire();

 

Entire Code -

 

<aura:component implements="force:lightningQuickActionWithoutHeader" >

       <aura:handler name="init" value="{!this}" action="{!c.openURL}"/>     

</aura:component>

 

({

                openURL : function(component, event, helper) {

 

                 var urlEvent = $A.get("e.force:navigateToURL");

                 urlEvent.setParams({

 

                    "url": 'http://www.google.com'

                 });

                 urlEvent.fire();

 

                 var dismissActionPanel = $A.get("e.force:closeQuickAction");

                 dismissActionPanel.fire();

                }

})

6 comentarios
0/9000