Sneaky smart Quick Action to open record create, edit or like pages/panels for an object

This gives you great control over the standard lightning record actions like create and edit.

One of the best use cases for this can be, when you have done override of the standard action and still you want the Standard Lighting Panel for create, edit or so, for specific profiles or like, this will be a great option.

The idea is to trigger record page/panel events like e.force:createRecord through quick action and close the quick action immediately.



Component:

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

Client side Component controller:

({
    doInit : function(component, event, helper) {
        window.setTimeout(
            $A.getCallback(function() {
                $A.get("e.force:createRecord").setParams({
                    "entityApiName": "Contact"
                }).fire();
                $A.get("e.force:closeQuickAction").fire();
            }), 0
        );
    }

})


Steps:
1. Create a Lightning Component with the above code
2. Create an Action button of type Lightning Component with the above Lightning Component.
3. Add the button created in step 2 to the layout.
4. Click the button on layout to see the record panel.
5. Cheers!!!


Comments

Popular Posts