Display the record type picklist on-load of the page

  • 2
  • Question
  • Updated 3 years ago
  • Answered
I want to have my Record Types picklist be available prior to render the particular content on a page. Is there a direct way to do this

ex: on creation of a new record just want user to select the record type 'A' or 'B'
based on the selected record type the page content would be rendered.
Photo of Hasantha Liyanage

Hasantha Liyanage

  • 1,446 Points 1k badge 2x thumb

Posted 3 years ago

  • 2
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
You can add the RecordTypeId field to your page in a Field Editor, mark it as Required, and Render As Picklist. 

Then wrap the rest of your page's content in Conditional Rendering based on the RecordTypeId. If RecordTypeId is A and not blank, then show some areas. If RecordTypeId is B and not blank, then show some areas. 
Photo of Hasantha Liyanage

Hasantha Liyanage

  • 1,446 Points 1k badge 2x thumb
Thanks for the reply Zach. I have another question, if the record is new and there will not be an existing record to show the record type. How could I overcome this?
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
I'm not sure what you mean - whether you're creating a new record or editing an existing record, the RecordTypeId field should be on the same Model as the rest of the fields on your record that you want to edit, and the field should provide you with Record Type options to select.
Photo of Hasantha Liyanage

Hasantha Liyanage

  • 1,446 Points 1k badge 2x thumb
Hi Zach, Ignore my last question I realized it doesn't make sense :)
Thanks for the answer it resolved my problem.