function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SUMIT BANERJEESUMIT BANERJEE 

On click of next button i want to call another component lightning page

Hi,
I have created a Component page on that page, I have create a next button, now I want when I press next button it will we call another component page .

Thanks, 
Sumit
Best Answer chosen by SUMIT BANERJEE
Adarsh.SharmaAdarsh.Sharma
Hey Sumit,
try This,this is 100% working.
changes in this  Controller.js
 
({
    gotoURL:function(component,event,helper){
        console.log('Enter Here');
        var evt = $A.get("e.force:navigateToComponent");
        console.log('evt'+evt);
        evt.setParams({
            componentDef: "skbteqforce:AccountCreateComponent",
            //componentAttributes :{ //your attribute}
        });
       
    evt.fire();
    }
})

Hope this helps you!

If this helps you, please mark it as solved so that it will be available for others as a proper solution.

Thanks
soni.sonihemant.hemant@gmail.com

All Answers

Adarsh.SharmaAdarsh.Sharma
Hi Sumit,

try this:
navigateToLightningComponent:function(component,event,helper){
        var evt = $A.get("e.force:navigateToComponent");
        evt.setParams({
            componentDef: "put lightning component name here",
            componentAttributes :{
            //your attribute
            }
        });
       
    evt.fire();
    }

Hope this helps you!

If this helps you, please mark it as solved so that it will be available for others as a proper solution.

Thanks
Adarsh.SharmaAdarsh.Sharma
Hi Sumit,

force:navigateToComponent only work in lightning experience and salesforce1.It is not work on classic.
So how you try this code.plese explain some more information.

please reply asap
SUMIT BANERJEESUMIT BANERJEE
Thanks But I got this error msg :

Action failed: skbteqforce$modal$controller$gotoURL [Cannot read property 'setParams' of undefined] Failing descriptor: {skbteqforce$modal$controller$gotoURL}

Sorry, I am new in lighting 

this is my button code and i want to rerender to viewdask.cmp page
<ui:button label="Next" press="{!c.gotoURL}"/>
Adarsh.SharmaAdarsh.Sharma
hey Sumit,

your button code is fine.but my question is you are switch your org in lightning or not.
because you try in classic then this error will occur
SUMIT BANERJEESUMIT BANERJEE
Yes, I am trying this code in lightning org.

this is my component page

<aura:component implements="force:appHostable" access="global" >
<div role="dialog" tabindex="-1" aria-labelledby="header43" class="slds-modal slds-fade-in-open">
  <div class="slds-modal__container">
    <div class="slds-modal__header">
      <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close">
        
        <span class="slds-assistive-text">Close</span>
      </button>
      <h2 id="header43" class="slds-text-heading--medium">Modal Header</h2>
    </div>
    <div class="slds-modal__content slds-p-around--medium">   
    </div>
    <div class="slds-modal__footer">
        <ui:button label="Next" press="{!c.gotoURL}"/>
    </div>
    </div>
</div>
<div class="slds-backdrop slds-backdrop--open"></div>
</aura:component>

I am calling component page on this app 

<aura:application >
<link href='/resource/bootstrap/' rel="stylesheet"/>

    <div class="navbar navbar-default navbar-static-top" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <a href="#" class="navbar-brand">Account </a>
            </div>
        </div>
    </div>

    <div class="container">
        <div class="row">   
             <skbteqforce:modal /> 
        </div>
    </div> 
</aura:application>

this the Controller.js

({
    gotoURL : function (component, event, helper) {
    var urlEvent = $A.get("e.force:navigateToURL");
    urlEvent.setParams({
      "url": "skbteqforce:AccountCreateComponent"
    });
    urlEvent.fire();
    }
})
Adarsh.SharmaAdarsh.Sharma
Hey Sumit,
try This,this is 100% working.
changes in this  Controller.js
 
({
    gotoURL:function(component,event,helper){
        console.log('Enter Here');
        var evt = $A.get("e.force:navigateToComponent");
        console.log('evt'+evt);
        evt.setParams({
            componentDef: "skbteqforce:AccountCreateComponent",
            //componentAttributes :{ //your attribute}
        });
       
    evt.fire();
    }
})

Hope this helps you!

If this helps you, please mark it as solved so that it will be available for others as a proper solution.

Thanks
soni.sonihemant.hemant@gmail.com
This was selected as the best answer
SUMIT BANERJEESUMIT BANERJEE
@ADARSH SHARMA 8 Thank you so much for great Support :)
Adarsh I am still getting the same error, Is there any need of event for fire this code?User-added image 
SUMIT BANERJEESUMIT BANERJEE
Thanks, Ok, then how can I test it? 
Adarsh.SharmaAdarsh.Sharma
Hey Sumit,
try This:

  1.First create lightnig component/lightning page tab (Select your component).

for salesforce1:
1. in setup search "salesforce1 Navigation" .
2.in salesforce1 navigation select your tab .
3.login salesforce1 app using your credationals.
4.Navigate to your created tabs.

for lightning experience on desktop:
1.for desktop in setup search "app".
2.select any app ,click on  edit and select your tab there.
3. then switch to lightning experience and change default app to your edited app in which your tab added.

Hope this helps you!

If this helps you, please mark it as solved so that it will be available for others as a proper solution.

Thanks
SUMIT BANERJEESUMIT BANERJEE
Thank you So much
 @ADARSH SHARMA 8
I marked as your answer as a Best Answer, Hope your answer will we helpful for others. 
Divya GhodasaraDivya Ghodasara
Hey SFDom,
  I can try to add my custom tab in salesforce navigation but i can't show my tab in dropdown. Please help..

 
paritosh sharma 22paritosh sharma 22
 I can try to add my custom tab in salesforce navigation but I can't show my tab in the dropdown. Please help..

Regards
Paritosh Sharma
Co-owner ( IPL 2020 Points Table (https://sportsnme.com/iplpointstable/) (Sportsnme)
FoodnTravelstory (https://www.foodntravelstory.com/)