Loading
The online Trailblazer Community becomes read-only Oct 30, 2026Read More
Important Advisory: iOS Update Impacting CG Mobile ApplicationRead More
Extend Salesforce with Clicks, Not Code
Custom Button Example: Record Create Page with Default Field Values

Custom Button Example: Record Create Page with Default Field Values

Construct custom buttons and links that pass default field values to a record create page. This feature applies to Lightning Experience in all editions. This feature doesn’t apply to Lightning Out, Experience Builder sites, or the Salesforce mobile app.

  1. Define a custom button or link, and encode any field that is read from a record and contains special characters, like commas.
    Use this sample formula.
    /lightning/o/Account/new?defaultFieldValues=
        Name={!URLENCODE(Account.Name)},
        OwnerId={!Account.OwnerId},
        AccountNumber={!URLENCODE(Account.AccountNumber)},
        NumberOfEmployees=35000,
        CustomCheckbox__c={!IF(Account.SomeCheckbox__c, true, false)}
    Important
    Important The URLENCODE function works only when creating custom buttons and links. You can’t use it for custom fields. The TEXT function is supported for custom number fields, but it returns only the numbers without any separators, like commas.
  2. Add the button or link to the appropriate page layout.
Note
Note Passing the RecordTypeId to defaultFieldValues isn’t yet supported. The recordTypeId influences routing behavior, layout assignment, and page assignment, so you can see unexpected results if you try to use it.
 
Loading
Salesforce Help | Article