0

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");
                            createSearchNotes.setParams({
                                "entityApiName": "SearchNote__c",
                                "defaultFieldValues": {
                                    'Search__c' : searchField.replaceAll("like","").replaceAll("'","")
                                }
                            });
                            createSearchNotes.fire();
0
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.

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.