0

I have created one Lightning Component which contains a "Next" button.

//button code

lightning:button class="slds-button slds-button--brand" onclick="{!c.gotoURL}">Next /lightning:button>

Once I clicked on this next button I want to be called another component which is for creating new record.

I have written below function in controller.JS

//Calling a next component clicking on the "Next" button
gotoURL:function(component,event,helper){
    var evt = $A.get("e.force:navigateToComponent");      
    evt.setParams({
     componentDef:"NewOpportunityCreation",
    });

evt.fire();
}

But when I am clickin on the "Next" button I am getting below error message.

No COMPONENT named markup://NewOpportunityCreation found

STackTrace: org.auraframework.throwable.quickfix.DefinitionNotFoundException: No COMPONENT named markup://NewOpportunityCreation found

0

Instead of this componentDef:"NewOpportunityCreation" use componentDef:"c:NewOpportunityCreation"

1

You have one syntax error here

componentDef:"NewOpportunityCreation",

This line will be

componentDef:"c:NewOpportunityCreation" //you don't need the comma as well

You can navigate only to a component that’s marked access="global" or a component within the current namespace

  • Thanks Tushar, Yes I do have access="global" and tried by removing comma but still the same issue. – SFDC Dev Mar 29 '18 at 10:46
  • @SFDCDev Please will you mention how the other answer solve your problem? – Tushar Sharma Mar 29 '18 at 11:28
0
({
next : function(cmp, event, helper) {
alert('1');
 var navService = cmp.find("navService");
 var pageReference = {
                     "type": "standard__component",
                     "attributes": {
                                     "componentName": "c__Questionary2"
                                   }, 
                     "state": {
                         'message':'This is the target page'
                     }
                    };
 navService.navigate(pageReference);
}
})
  • <lightning:navigation aura:id="navService"/> //put this in your component and *quesionary2 is the name of new component that wa want to call on click on the next button – pramod bhardwaj Sep 3 at 5:43

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.