Loading

List Buttons to Create Related Records with Default Values

Udgivelsesdato: Apr 2, 2026
Beskrivelse

Salesforce allows for a limited number of Flows and Process Builder processes (Process Builder was retired Dec 31, 2025). Because of this, it is important to use them sparingly and only when needed. 

A common use case of the automation tools is to pull information from a related account and use it as a default value when creating an Opportunity. Instead of using up an automation process, use List Buttons instead by the following the steps.

In the example below, we are providing default values for the following fields when an Opportunity is created by clicking a custom button on the related Opportunity list within an Account record:

  1. Opportunity Name
  2. Stage
  3. Account ID
  4. Close Date

If you would like to create default values for different fields than the ones used in this example, please note that you will need to add them to your formula.

 

    Løsning

    Create a New Button

    1. Click the gear icon on the top-right corner
    2. Click Setup
    3. Click the Object Manager tab
    4. Select Opportunity
    5. Click Buttons, Links, and Actions in the left navigation
    6. Click New Button or Link
    7. Provide a Label like New w/ Acct Info as an example
    8. Select List Button as the Display Type 
    9. Select Display in existing window with sidebar as the Behavior
    10. Select URL as the Content Source

    Create the Formula

    1. Click in the formula text box on the bottom-left side of the screen
    2. Select URLFOR from the Functions section on the right side of the screen
    3. Highlight target, id, [inputs], [no override]
    4. Paste the following into the section you just highlighted
      1. '/lightning/o/Opportunity/new?defaultFieldValues=Name=' +
    5. Select URLENCODE from the Functions section on the right side of the screen
    6. Highlight text
    7. Select Account from Select Field Type
    8. Select Account Name from Insert Field
    9. Paste the following into the section after (Account.Name)
      1. + " Opportunity" + ',AccountId=' + Account.Id + ',StageName=' + "Qualification" + ',CloseDate=' + TEXT(TODAY()+30))}
    10. Your entire formula should now look like this
      1. {!URLFOR( '/lightning/o/Opportunity/new?defaultFieldValues=Name=' + URLENCODE(Account.Name)+ " Opportunity" + ',AccountId=' + Account.Id + ',StageName=' + "Qualification" + ',CloseDate=' + TEXT(TODAY()+30))}
    11. This formula is saying when it is clicked, create a new Opportunity with the following default values
      1. Name = (Name of the Account that you clicked this button from) Opportunity
      2. Account = (the Account that you clicked this button from)
      3. Stage = Qualification
      4. Close Date = (30 days in the future from when you clicked this button)
    12. Click Check Syntax
    13. You will see a message No syntax errors
    14.  Click Save

    Add Button to Page Layout

    1. Click the gear icon on the top-right corner
    2. Select Setup
    3. Click the Object Manager tab
    4. Select Account
    5. Click Page Layouts in the left navigation
    6. Select the Page Layout that you are using
    7. Scroll down to the Opportunities related list
    8. Click the wrench icon
    9. Click the + to expand the Buttons section
    10. Uncheck the box for New
    11. In the Custom Buttons section
      1. Move the New w/ Acct Info button to the Selected Buttons column
    12. Click OK
    13. Click Save.

     

    Vidensartikelnummer

    000389967

     
    Indlæser
    Salesforce Help | Article