As many other posts i've read, I am trying to override the standard "New" button in a related list with a lightning component so that we can auto populate some fields for a client. I want to be able to keep the functionality of choosing a record type and displaying the associated page layout for that record type in a "Create new record" modal.(User profiles are irrelevant in this matter) I was looking at the standard salesforce code through the web dev console and was wondering how salesforce determines what page layout to render and if it is possible to manipulate this in a lightning component to pre-populate fields.

Otherwise what would be the best approach to auto-populate fields while dynamically using page layouts

I have been following this example but would like it to appear in a modal, same as standard functionality https://sfcure.com/2018/09/15/rendering-lightningrecordeditform-based-on-the-page-layout/

2 Answers 2


You can simply Use URL hacks to prepopulate field without creating any custom code. Just create a URL button and use below format.


You can use useRecordTypeCheck attribute to display RecordType Selection page. You don't need to create component for this. As we are using standard UI so it will handle the layout changes as well.

You can check more details here: Salesforce URL Hack in Lightning


This can be done if you create two custom components. The first custom component should be used to just show the users available record types to select from. This custom component should be tied to the 'New Button'.

When user selects an option you can direct the user to the second custom component and along with it pass the recordType Id and other pre- prepopulated values to this second custom component which uses lightning:recordEditForm to create the record. In second custom component you must implement lightning:isUrlAddressable to read the values passed from the first component.

You can use overlay library to deal with the modal related requirements of your component.

You must log in to answer this question.

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