Thursday, November 14, 2019

Pre-populate Field Values on Standard Pages in Lightning

In Salesforce classic, we used to specify the field values in URL parameters (URL hacks) to pre-populate the field values in standard page layouts.

In lightning, URL hack don't work. So if we have to open standard page in lightning with pre-populated field values, then we can use "e.force:createRecord" event to open new record page with default field values.

In this blog, I will be creating a lightning component which will be added to account page layout. This component will display button "Create Quick Contact" to create new contact. When user will click on this button, standard new contact page will open with default field values.

Below is complete code:

Now you add this component on account page layout.

Now when you click on Create Quick Contact, standard page will open for new contact creation with pre-filled field values specified in controller.js.


Here you can see recordtypeId, phone, email and account are pre-populated.

Hope this will help!!




1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete