I have a lightning component and in my component i have on button for new record its work fine but after record created it goes to record detail page. I want to prevent navigate event and close the model and show the toas message on the same page. here is my sample code .
<ui:button label="New" class="newbtn right" press="{!c.newEvent}"/>
JS-controller
newEvent : function(component, event,helper) {
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
"entityApiName": "Event"
});
createRecordEvent.fire();
}
Best Answer
This code work for me..