I am working on a Lightning Component and want to create a record using lightning:recordEditForm. using lightning:recordEditForm is great because it allows us to create records without Apex.

However, I need to pass a RecordTypeId to that component and that's where I get stuck. I would like to find the proper recordTypeId clientside so that I don't need an Apex controller that queries the recordTypes and returns them just so I can select the proper Id given a recordType name.

Is it possible to do it entirely clientside?

With the new Lightning Web Components, we have a wire adapter to get Object Info: https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.reference_wire_adapters_object_info

Is there something similar for the 'classic' Lightning Components? Maybe with the Lightning Data Service?

1 Answer 1


The hasPageReference interface provides pagereference object and it's property called state includes RecordTypeId. See the answer below: https://salesforce.stackexchange.com/a/227943/61793

  • Even with links to SFSE, I think it'd be preferable to reproduce the important bits in this answer.
    – Derek F
    Dec 18, 2019 at 15:49
  • If you can put the actual solution in your answer (instead of linking) then I'll be glad to upvote and accept it. Dec 19, 2019 at 9:31

You must log in to answer this question.

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