is there any lightning event to show record type selection during record creation.force:create record doesnt have this capability.please provide your inputs.I tried a lot but couldnt find anything
1 Answer
Since I cannot mark as duplicate as the answer is not accepted or upvoted I am copying the answer from Carlos Iribar here:
Record Type selection in $A.get("e.force:createRecord") in lightning
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.
Example
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
"entityApiName": "Contact",
"recordTypeId": ""
});
createRecordEvent.fire();
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}"/>
</aura:iteration>
</ui:inputSelect>
<button class="slds-button slds-button--neutral slds-not-selected slds-m-top--medium" onclick="{!c.create}">New</button>
</div>
</div>
v.types is an array with the record types values