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
SFDC NewbeeeSFDC Newbeee 

How to jump to a link with quick action button?

I have a new quick action custom button. Based on a value on in the record, i want to go to either url A or url B. I want to be able to achieve it with a click on the quick action button, NOT with a "onclick" button in the modal box. Is there any way to do this?
Naveen PoojaryNaveen Poojary
Hi,
You can achieve this task by using window.setTimeout and force:navigateToURL events.Please refer my code and make it as per your requirement.if you want conditional redirection to URL A or URL B  you have to enter URL in any custom URL field and use it in the component.
Make it as Best answer if it is helpful.
Thanks
<!--Component-->

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,
                            flexipage:availableForRecordHome,
                            force:hasRecordId,forceCommunity:availableForAllPageTypes,
                            force:lightningQuickAction" 
                access="global" >
	    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> 

</aura:component>

<!--conttroller-->

({
    doInit : function(component, event, helper) 
    {
        window.setTimeout(
            $A.getCallback(function() 
                           {
                               $A.get("e.force:closeQuickAction").fire();
                           }), 0
        );
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url": "https://www.google.com"
        });
        urlEvent.fire();
    }
})