I am trying to modify the behavior of Default "New" button on Opportunity tab on Salesforce Lightning Experience. (My requirement is to open the create record popup with some pre-filled values)

I created a Lightning component

<aura:component implements="lightning:actionOverride" >
    <aura:handler name="init" action="{!c.myEvent}" value="{!this}"/>

Here is the Controller code

    myEvent : function(component, event, helper) {

        var createRecordEvent = $A.get("e.force:createRecord");
            "entityApiName": "Opportunity",
            "defaultFieldValues": {
                "Name" : "TestOpportunity",


Then I overridden the default New button behavior to Lightning component bundle.

When I click the New button on opportunity tab, it open the create record popup and suddenly close. Before it close, I can see that the default field value also set. But why it suddenly close automatically? Appreciate your help.

  • I have just tried the same in my sandbox - on a custom object and it works fine. please try on a different object, maybe something on your opportunity is interfering. – Itai Shmida Jul 9 '17 at 5:54
  • Hi @ItaiShmida, Thanks a lot for your reply. I created a brand new Developer Org and tested the above mentioned code. It is working fine. But in my old Org, problem exists. Anyway thanks for the support. – Dinesh Wickramasinghe Jul 10 '17 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.