I'm using $A.get("e.force:createRecord") to display record create page for an object, but this doesn't display record type selection screen, we have to pass it explicitly. Default salesforce lightning behavior when user clicks on new record button is it shows record type selection. How I can implement same behavior. I don't want to build custom component for this.

  • do you see record type screen when you are out of lightning and try to create new record from Salesforce classic?
    – Himanshu
    Commented Feb 6, 2017 at 9:04
  • $A.get is useful in lightning only, in classic I am using URLFOR($Action.ObjectName.New). In classic it shows record type selection screen.
    – Soham
    Commented Feb 6, 2017 at 9:58
  • Any Luck? Did any one find a way to achieve this functionality?
    – Din_y
    Commented Feb 23, 2017 at 16:08

3 Answers 3


Currently, it's not possible select a record type in the createRecord component. You can create a dropdown or something with the record types options and then call the createRecord component passing the record type.


var createRecordEvent = $A.get("e.force:createRecord");
        "entityApiName": "Contact",
        "recordTypeId": ""

This a dropdown example for select the record type

<div class="source-center-slds" >
        <div class="slds-p-around--x-large">
            <ui:inputSelect class="slds-select_container myselector"  label="{!'Select ' + v.label +  ' Record Type: '}" aura:id="levels">
                <aura:iteration items="{!v.types}" var="item">
                    <ui:inputSelectOption class="slds-select" text="{!item.Id}" label="{!item.Name}"/>      
            <button class="slds-button slds-button--neutral slds-not-selected slds-m-top--medium" onclick="{!c.create}">New</button>

v.types is an array with the record types values


3 things to be done to achieve this functionality.

  1. Get the all available Record Types for that object.
  2. Make them available as a list for selection on component.
  3. Pass the selected recordTypeId as second parameter to force:createRecord.

    Check here for more.


first you need to passed down the RecordType label to apex controller After that apex controller will return the value from the RecordType Id then you need to use $A.get("e.force:createRecord"); funcion to locate the record type page in the org. like following example.

public static String getRecTypeId(String recordTypeLabel){
    String rtID = '';
        rtID = Schema.SObjectType.Object_Api _Name.getRecordTypeInfosByName().get(recordTypeLabel).getRecordTypeId();    
    }catch(Exception e){
        System.debug( e.getMessage());
    return rtID;

javaScript controller.

var recordId = "..6xxxxxxxxx";
 var recordTypeLabel =  "RT Lable";

var action = component.get("c.getRecTypeId");
    "recordTypeLabel": recordTypeLabel

     action.setCallback(this, function(response) {
    var state = response.getState();
    if (state === "SUCCESS") {
        var createRecordEvent = $A.get("e.force:createRecord");
        var RecTypeID  = response.getReturnValue();
            "entityApiName": 'Object_Api_Name',
            "recordTypeId": RecTypeID,
            'defaultFieldValues': {
                "PEL_Engagement__c" : recordId



This code works for me as well.sfdcMonkey

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .