Is it possible to use lightning:inputField with RecordTypeId as fieldName. I want to create form that will dynamically change his own fields according to selected record type? I wonder that I need to create custom code to retrive RecordTypes?


For code like following placed inside lightning:recordEditForm

<lightning:inputField fieldName="RecordTypeId"></lightning:inputField>

edit such field results with:

[Field: RecordTypeId is not a valid lookup field.]]

1 Answer 1


It is not possible. Mentioned within lightning-record-edit-form under Displaying Forms Based on a Record Type.

Passing in a record type as a field on this component is not supported.

What you can do, is provide your own mechanism of changing the record type (ex. picklist of all record types available or button with modal for selection). Upon change by user input, update the variable passed in as the recordTypeId to the edit form so it re-renders. Similar to how the standard layouts provide a change record type modal that is separate from the edit page.

<lightning:recordEditForm recordTypeId="{!v.recordTypeId}"....

You must log in to answer this question.

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