0

I want to redirect to different URL (or open in new window will also work) from Lightning Quick Action Button. Here I am thinking to include Lightning component as-

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

({
    doInit : function(component, event, helper) {
        /*window.setTimeout(
            $A.getCallback(function() {
                $A.get("e.force:closeQuickAction").fire();
            }), 1
        );*/
        $A.get("e.force:closeQuickAction").fire();
    }
})

Still Popup window is coming with a cancel button that I dont want, it should redirect(/open in new window to) different url page. Also, can we achieve this using VF page.

How could I achieve that?

2

You can do like this using lightning quick action

Updated code:

({
    doInit : function(component, event, helper) {
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
          "url": someurl   
        });
        urlEvent.fire();
        setTimeout(function(){
           $A.get("e.force:closeQuickAction").fire();
        },500);

    }
})

But still this will not stop the show dialog

Dialog will open but after 500 millisecond t will disappear.

0

@Tushar007 here you need to understand two things:-

Add the force:lightningQuickAction or force:lightningQuickActionWithoutHeader interface to a Lightning component to enable it to be used as a custom action in Lightning Experience or the Salesforce mobile app. You can use components that implement one of these interfaces as object-specific or global actions in both Lightning Experience and the Salesforce app.

  1. When used as actions, components that implement the force:lightningQuickAction interface display in a panel with standard action controls, such as a Cancel button. These components can display and implement their own controls in the body of the panel, but can’t affect the standard controls. It should nevertheless be prepared to handle events from the standard controls.
  2. If instead you want complete control over the user interface, use the force:lightningQuickActionWithoutHeader interface. Components that implement force:lightningQuickActionWithoutHeader display in a panel without additional controls and are expected to provide a complete user interface for the action.

So, if you want to open your popup to open without cancel button, go for second option. All you need is Implements force:lightningQuickActionWithoutHeader in your component and in your controller add this part :-

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

For more understanding refer to this snippet:-

    ({
    doInit : function(component, event, helper) {
        var action = component.get("c.cloneOpportunity");
        var opp = component.get("v.recordId");
        action.setParams({
                "OppId" : component.get("v.recordId")
                });
        action.setCallback(this,function(data){
           var clonedRecordId = data.getReturnValue();        
             helper.navigate(component);
            var dismissActionPanel = $A.get("e.force:closeQuickAction");
             dismissActionPanel.fire();

        });
 $A.enqueueAction(action);
 }
})

Note:-

components can implement either the force:lightningQuickAction interface or the force:lightningQuickActionWithoutHeader interface, but not both. This should make sense; a component can’t both present standard user interface elements and not present standard user interface elements.

enter image description here

Here you need not to wait for 500 millisecond to get close standard action panel with cancel button.

Reference:- https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_using_lex_s1_config_action.htm?search_text=e.force:closeQuickAction

Hope, it helps you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.