Newer Version Available

This content describes an older version of this product. View Latest

force:createRecord

Opens the page to create a new 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}

This event is supported in Salesforce1 only. If used outside of Salesforce1, this event won’t be handled properly.

Note

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.