I currently have a lightning component from which I want to save a string into a record. In my javascript controller I create a record when a button is clicked. A dialog is shown to save the record and after saving goes to the recorddetail page.

How can I prevent going to the record detailpage. I want to save the record on the background and stay on the current page. Thanks in advance.

Javascript controller:

var createSearchNotes = $A.get("e.force:createRecord");
                                "entityApiName": "SearchNote__c",
                                "defaultFieldValues": {
                                    'Search__c' : searchField.replaceAll("like","").replaceAll("'","")

1 Answer 1


Presenting my comment as answer:

You are using the standard createRecord event whose default behaviour, which we cannot change - handled by one.app container, is to naviagate to record after creating. You could use apex to save the record in the background or switch to LWC, if that's an option, and use lightning/uiRecordApi's createRecord method.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .