Skip to main content
1 of 2
Robert Sösemann
  • 38.2k
  • 29
  • 173
  • 508

Navigate to Lightning component from native record page

I understand that I can add a Quickaction to a custom object to load a Lightning component from a native record page in Lightning.

But..this component is displayed in a Modal on top of the original page. I don't want that. I want to redirect to a new "page".

The best thing I could come up with was a empty "button" component which redirects on init.

Markup

<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId">
    <!-- Note: Just redirects to another page -->
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
</aura:component>

Controller

({
    init : function(cmp, evt, helper) {
        var evt = $A.get("e.force:navigateToComponent");
        evt.setParams({
            componentDef: "c:otherComponent",
            componentAttributes: {
                marketId: cmp.get("v.recordId"),
                isredirect: true
            }
        });
        evt.fire();
    }
})

This works but is ugly as I see that the page is loaded for a second. I also want to get rid of extra button components.

Robert Sösemann
  • 38.2k
  • 29
  • 173
  • 508