Most businesses want to track and report the reason codes for lost opportunities and ensure that these codes are captured when opportunities are moved to Closed Lost.
In the case of Salesforce CRM, this functionality isn’t available out-of-the-box — however, it can be quickly configured. Fortunately, it’s a simple point-and-click setup, with the steps outlined below.
As a result, when a user — such as a sales representative — closes an opportunity, a reason code must be provided, as shown in the image below:

Step 1: Create a “Reason Lost” Field on Opportunity
The first step is to create a list of reason codes:
- Go to Setup → Object Manager → Opportunity.
- Select Fields & Relationships.
- Click New.
- Create a Picklist field named Reason Lost. It’s important to use a picklist rather than a text field, as field dependencies do not work with text fields.
- Enter your list of reason code values.
Step 2: Add Field Dependencies
Once the Reason Lost field has been created, add a dependency between Stage and Reason Lost:
- Go to Setup → Object Manager → Opportunity.
- Select Fields & Relationships.
- Click Field Dependencies.
- Create a new field dependency where Controlling Field is set to Stage and Dependent Field is set to Reason Lost. Include all Reason Lost values:
Step 3: Add a Validation Rule
The final step is to add a validation rule to ensure that a Reason Lost value is required:
- Go to Setup → Object Manager → Opportunity.
- Select Validation Rules.
- Create a validation rule as follows:
Conclusions
At Nexteris, we provide Salesforce development and advanced consulting services, including developing triggers and APEX for complex, high-volume data processing on Salesforce.
Contact us today to find out how we can help you!
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.