Loading

Make Products Required on Salesforce Opportunities

Publiseringsdato: Oct 12, 2026
Beskrivelse

Organizations that have purchased the Salesforce Products (Price Books and Products) module can configure Opportunities to prompt users to add Products when saving. This article explains how to enable the Prompt Users to Add Products setting in Opportunity Settings and describes known scenarios where Opportunities may still be saved without Products despite this setting being enabled. It also provides sample Validation Rule formulas to more strictly enforce Product entry.

Løsning

This article explains how to make Products required on Opportunities in Salesforce for organizations that have purchased the Products module, why Opportunities can still be saved without Products, and how to enforce Product entry with a field setting or Validation Rules.

How to Enable the Prompt Users to Add Products Setting

To make Products required on Opportunities, log in as a system administrator and follow the instructions below:

  1. Navigate to Opportunity Settings:
    • In Salesforce Classic: Setup | Customize | Opportunities | Opportunity Settings
    • In Lightning Experience: Setup | Feature Settings | Sales | Opportunities | Opportunity Settings
  2. Select Prompt users to add products to Opportunities.
  3. Click Save.

Scenarios Where the "Prompt Users to Add Products" Setting Can Be Overridden

In certain situations, this setting can be overridden by user behavior, which may result in Opportunities without related Products. This is expected and can happen in any of the following situations:

  1. A Lead is converted and an Opportunity is created at the time of conversion. The User is not brought to the "Product Selection" screen for the Opportunity.
  2. An Opportunity is cloned without Products. The new Opportunity is created without any Products unless the Save & Add Product option is used to add them.
  3. A User creates a new Opportunity and clicks Save & Add Product. On the Product Selection screen, the User clicks Cancel and is brought back to the Opportunity, which is created without Products.
  4. A User creates a new Opportunity and clicks Save & Add Product. The User then closes the browser window or clicks the Back button in the browser. The Opportunity is saved in the system, but the User has used browser behavior to work around the system design.

Salesforce cannot control the fourth situation above because the User is working around the logic structure of the application.

This setting can also be overridden when the Opportunity "New" button is overridden with a component that implements force:createRecord.

Workaround: Make the Amount Field Read-Only to Enforce Product Entry

Salesforce recommends the following workaround to "enforce" Product entry on each Opportunity: make the Amount field read-only on Opportunities. Products then have to be entered on an Opportunity in order for the Amount field to be populated with a value. Review Field Access.

Make Products Required with Validation Rules

To make Products required via Validation Rules, use the field name "Has Line Item" in the formula. Create the Validation Rule here:

  • In Salesforce Classic: Setup | Customize | Opportunities | Validation Rules
  • In Lightning Experience: Setup | Object Manager | Opportunity | Validation Rules

Sample Formula for Multiple Stages

The following formula prevents saving an Opportunity without Products if the Stage is set to Needs Analysis, Qualified, or Proposal Submitted. Update the stage names to match your org's configured Opportunity stages.

AND(
OR(
ISPICKVAL(StageName,"Needs Analysis"),
ISPICKVAL(StageName,"Qualified"),
ISPICKVAL(StageName,"Proposal Submitted")),
HasOpportunityLineItem = FALSE
)

This formula returns TRUE, which triggers the validation error, when the Stage is one of the three listed stages and the Opportunity has no Products (HasOpportunityLineItem is FALSE).

Sample Formula for a Single Stage

The following formula prevents saving an Opportunity without Products only when the Stage is set to Needs Analysis.

AND(
ISPICKVAL(StageName,"Needs Analysis"),
HasOpportunityLineItem = FALSE
)

This formula returns TRUE, which triggers the validation error, when the Stage is Needs Analysis and the Opportunity has no Products.

Note: This validation rule only works if an Opportunity has a Price Book added.

Knowledge-artikkelnummer

000384448

 
Laster
Salesforce Help | Article