0

A heads up, i'm a newbie to lightning and i'm building a new component on top of a existing lightning component.

A little background to the problem: There is a lightning quick action on contact which opens in a modal window when ever the button is clicked. But the requirement is to open the quick action in a new tab instead of modal. Hence i looked at posts online and found out that i need to use force:navigateToComponent

I created a new lightning component with below code

<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId,force:appHostable" access="global" >
    <aura:attribute name="contact" type="Contact" />
    <aura:attribute name="contactId" type="String" default="{!v.recordId}"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> 
</aura:component>

Controller:

    ({
    doInit : function(component, event, helper) {
    var evt = $A.get("e.force:navigateToComponent");
    evt.setParams({
        componentDef : "c:newCoachingCallAction",
    });
    evt.fire();
}
})

Code snippet of c:newCoachingCallAction

<aura:component controller="CoachingCallActionController" implements="force:lightningQuickAction,force:hasRecordId,force:appHostable" access="global" > 
<aura:attribute name="contact" type="Contact" />
<aura:attribute name="contactId" type="String" default="{!v.recordId}"/>
<aura:attribute name="statuses" type="List" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

So now the component opens in same tab instead of a modal window but I dont know how to open this compoent in a new tab.

6
  • can you provide a minimal code sample for newCoachingCallAction so others can reproduce?
    – glls
    Aug 3 '17 at 18:37
  • Documentation for this component Says "When fired from a component embedded in Lightning Experience or Salesforce1, the app creates and renders the target component in the app content area, replacing the current content. If you create a Lightning component tab and associate it directly with the component, this event lets you navigate to the tab associated with the target component." Try creating a lightning tab and then use the quick action. Instructions on how to create a lightning tab : developer.salesforce.com/docs/atlas.en-us.lightning.meta/…
    – Nihar
    Aug 3 '17 at 19:19
  • @glls: i added the code snippet of newcoachignCallAction component. Aug 3 '17 at 21:15
  • @Nihar do you mean, i have to use navigateToUrl instead of navigateToComponent? Aug 3 '17 at 21:16
  • @nightcrawler Nope. What I meant was try creating a lightning tab..just like the object tabs/visual force tabs. Create a lightning tab with the component "c:newCoachingCallAction" and then try executing the quick action and see if it redirects you to that tab that you created. I have not tried it though. It might or might not work. I will see if I can replicate the scenario.
    – Nihar
    Aug 3 '17 at 22:29

Your Answer

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

Browse other questions tagged or ask your own question.