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
Gopinath418Gopinath418 

Redirect to app page issue

I have a lightning component which will display a New button and if we click on it the standard account creation dialog box will open, fill the details and save the account.

Have created a App page and have included above created to the app page.

once i click on New button the account creation dialog box is opening but after saving it, the controller going to account detail page, actually it shoud not go (it should be in the app page only)

I have used below code to navigate component but when i click on new button the dialog box is opening and with in sec it is redircting to app page.

please suggest me how to handle it?


Please see below my code:

Component - mytest1
=====================

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"
                access="global">
   <aura:handler event="force:createRecord" action="{!c.handlecreateEvent}"/>
    <ui:button label="New" press="{!c.createRecord}"/>
   
</aura:component>

Js controller
=========================

({
    createRecord : function (component, event, helper) {
    var createRecordEvent = $A.get("e.force:createRecord");
    createRecordEvent.setParams({
        "entityApiName": "Account"        
    });
    createRecordEvent.fire();
},
    handlecreateEvent : function(component, event) {
        var evnt = $A.get("e.force:navigateToComponent");
        evnt.setParams({
            componentDef:"c:mytest1"
        });
       evnt.fire();
    }
})

Thanks
Gopi
brahmaji tammanabrahmaji tammana
please post the code of c:mytest1
Gopinath418Gopinath418
I have already posted it, please refer it above.
Thanks,
Gopi
brahmaji tammanabrahmaji tammana
You are referring the same component again ?

Thanks
Gopinath418Gopinath418
Actually i wanted to redirect to lightning page instead of detail page, I have used navigateToComponent as trail, I don't know whether it is correct or not to use it to redierct to lightning page.
Please suggest me how could i redirect to lightning page?

Thanks,
Gopinath