Record Type selection in $A.get(“e.force:createRecord”) in lightning

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.


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

Source : Link , Question Author : Soham , Answer Author : Carlos Iribar

Leave a Comment