2

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?

  • Why not use a "custom button" with "content source"=URL instead (if all you want is to open a different page)? – Itai Shmida Jan 31 '17 at 15:33
  • I have tried that approach too, Using this way, I am not able to pass recordId to lightning component – Vaibhaw Raj Feb 1 '17 at 6:12
  • Why not? which page are you trying to open? can you post the code you have tried with? – Itai Shmida Feb 1 '17 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 – Vaibhaw Raj Feb 1 '17 at 6:50
  • Will I be able to use URL custom button on salesforce1? – Vaibhaw Raj Feb 1 '17 at 6:53
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.

  • 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? – night crawler Aug 3 '17 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();
    } 
})
  • We can also add attributes like : componentAttributes: { contactName : component.get("v.contact.Name") } – Srujan Apr 18 '19 at 5:57

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.