[SalesForce] Lightning Global Action Open New Tab URL no modal

I'm trying to create a global action that when clicked opens a new tab for google.com. The only way I have figured out how to do this is by when clicking on the global action drop down and selecting the "Go to Google" action, the modal pops up and then there is a button that when clicked send the user to Google.com in a new tab.

Instead of the 2 clicks, once on the global action, then on the button in the modal, Id like the first click on the global action to send the user to google in a new tab.

This is what I have so far:

.cmp

<aura:component implements="force:lightningQuickAction" >
     <ui:button label="Go to Google" press="{!c.openActionWindow}"/>
</aura:component>

.js

({
    openActionWindow : function(component, event, helper){
        window.open("http://www.google.com");
    }
})

Best Answer

If you want to do this without the need for a button you need your component to handle the init event:

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

Sample Controller:

({
    doInit: function(cmp) {
        window.open("http://www.google.com");
    }
})
Related Topic