Newer Version Available
force:createRecord
Opens a page to create a record for the specified entityApiName, for example, “Account” or
“myNamespace__MyObject__c”.
To display the record create page for an object, set the object name on the entityApiName parameter and fire the event. recordTypeId is optional and, if provided, specifies the record type for the created object. This example displays the record create panel for contacts.
1createRecord : function (component, event, helper) {
2 var createRecordEvent = $A.get("e.force:createRecord");
3 createRecordEvent.setParams({
4 "entityApiName": "Contact"
5 });
6 createRecordEvent.fire();
7}| Attribute Name | Type | Description |
|---|---|---|
| entityApiName | String | Required. The API name of the custom or standard object, such as “Account”, “Case”, “Contact”, “Lead”, “Opportunity”, or “namespace__objectName__c”. |
| recordTypeId | String | The ID of the record type, if record types are available for the object. |