Create record in Lightning with populated fields

URL hacks are not supported in Lightning Experience. The best way to prepopulate fields in Lightning Experience is to use actions.

For example:

  1. on the Account object I created an action to create a new opportunity and prepopulate some fields by going to: Setup -> Object Manager -> Account -> Buttons, Links, and Actions -> New Action.
  2. Next add whatever fields you would like to have on the layout that will popup up in LEx when the button is clicked.
  3. Then add each predefined field and the default values.

Predefined Fields

  1. Finally add the button to the page layout in the Quick Actions section for Salesforce1 and Lightning Experience Actions.

The button will be available in the top right of the account and when clicked the page layout will popup with the defaults.

Popup New Opportunity


From the Summer '17 Release Notes - Prepopulate Fields on a Record Create Panel

Speed up record creation with prepopulated field values. The sforce.one.createRecord function now includes defaultFieldValues (optional) so you can define fields on a record create panel, including fields not displayed on the panel. This change applies to Lightning Experience and the Salesforce1 mobile browser app.

Users must have create access to prepopulated fields. Errors during saving that are caused by field access limitations do not display error messages.

So defaultFieldValues will become the official supported mechanism to preset fields with sforce.one.createRecord.


It's not documented, so use at your own risk, but you can pass the default values on an attribute named "defaultFieldValues". So for instance, you could create a task and send defaults like this:

var evt = $A.get("e.force:createRecord");
evt.setParams({
   'entityApiName':'Task',
   'defaultFieldValues': {
      'Status':'Completed'
   },
   'recordTypeId':YOUR_RECORDTYPE_ID_HERE
});

evt.fire();