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
vinny rvinny r 

Lightning Super Badge Step 2 - Error in firing force:createRecord

Hi,
 
I have the below code to create a new boat record using the selected boat type as the default value for boat type field.
 
handleNewClick:function(component,event,helper)
{
    var selectedBoatTypeId = component.get("v.selectedBoatTypeId");
    console.log('Selected Boat Type Id' + selectedBoatTypeId);
    var event = $A.get('event.force:createRecord');
    event.setParam({"entityApiName":"Boat__c",
                    "DefaultFieldValues":{
                        "BoatType__c": selectedBoatTypeId
                    }
                   });
    event.fire();
}
I am getting the error

“Looks like there's a problem.
Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the error ID shown here and any other related details.
Error ID: 486631403-396 (-2024287495)”

User-added image
Can you please let me know why I am getting this error.

Thanks
Vinny
Best Answer chosen by vinny r
vinny rvinny r
I used event.setParam instead of event.setParams. Changing this has resolved this isue.

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Vinny,

Sorry for this issue you are facing.

May I suggest you please refer to below link from the forums community with a similar discussion which might help you further. Hope this helps.

Thanks,
Nagendra
vinny rvinny r
I used event.setParam instead of event.setParams. Changing this has resolved this isue.
This was selected as the best answer