3

I have build a simple lightning component something like :

<aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:lightningQuickAction">
   Hello World
</aura:component>

I have added a lightning action for this page on record home page, let say to be on "Account"

Whenever I click on that lightning action from any account record, it open lightning component in lightning modal. Is there any way to redirect user to standalone "lightning tab" like page instead of lightning modal?

7
  • Why not use a "custom button" with "content source"=URL instead (if all you want is to open a different page)? Jan 31, 2017 at 15:33
  • I have tried that approach too, Using this way, I am not able to pass recordId to lightning component Feb 1, 2017 at 6:12
  • Why not? which page are you trying to open? can you post the code you have tried with? Feb 1, 2017 at 6:14
  • I might not be able to post complete code as its too big and convulated. But I can give you the gist of the issue <aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:lightningQuickAction"> <aura:attribute name="id" type="Id"/> </aura:component> In js controller logic, I need to access this id attribute to fetch data from apex controller. Button url is something like /c/mycomp.cmp?id=a00N000000G8bvEIAR The issue is that I am unable to access this id in js controller of lightning component Feb 1, 2017 at 6:50
  • Will I be able to use URL custom button on salesforce1? Feb 1, 2017 at 6:53

2 Answers 2

1

I managed to open the lightning component in as a tab instead of the popup by using a small component which will redirect to the main component.

You can use the force:navigateToComponent event on init to navigate to your main component.

1
  • i tried using navigateToComponent and it's opening in a tab but the same screen. How did you manage to open in a new tab instead? Aug 3, 2017 at 16:47
1

Component

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

Controller

({
    navigateToeDiscoverySearchCmp : function(component, event, helper) {
        var evt = $A.get("e.force:navigateToComponent");
        evt.setParams({
            componentDef : "c:eDiscoverySearchCmp",
        });
        evt.fire();
    } 
})
1
  • We can also add attributes like : componentAttributes: { contactName : component.get("v.contact.Name") }
    – Srujan
    Apr 18, 2019 at 5:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .