Skip to main content

Grow your business with Salesforce Starter

Deepen customer relationships with sales, service, and marketing in one app.

Start your free 30-day trial
Time Estimate

Configure the System

Learning Objectives

After completing this unit, you’ll be able to:

  • Create custom fields for recording competitor information.
  • Add validation rules to ensure your sales reps populate the new fields.

Create a Competitor Custom Field

Let’s begin by creating two new custom fields on the Opportunity object, Competitor and Lost Reason. Although there is a similar standard field on the Opportunity object called Main Competitor(s), we are going to create a new picklist field instead.  Plain text fields are fairly challenging to analyze since users will likely enter similar values for the same competitor.  Picture one user entering "Acme" as a competitor, another user entering "Acme Inc.", and yet a third user entering "Acme Industries" - it will lead to messy and inconsistent data about competitors.  For this reason, we recommend creating a new picklist field with pre-defined values.

Here’s how to create the first custom field. 

Note

To take these steps in your sandbox, you need to be a System Administrator. See the Preparation steps in Unit 1.  

  1. Click Setup Gear Icon and select Setup. This launches Setup in a new tab.
  2. Click Object Manager.
  3. Click Opportunity, then Fields & Relationships.
  4. At the top of the Fields & Relationships page, click New.
  5. Select Picklist, and click Next.
  6. For Field Label, enter Competitor.
  7. Select Enter Values with each value separated by a new line.
  8. In the text box, list your main competitors on separate lines.
  9. Make sure Restrict picklist to the values defined in the value set is selected.
  10. In Help Text, offer your users a useful tip about this new field: Identify the primary competitor for this opportunity.
  11. Click Next.
  12. Set the field-level security. Make sure that sales reps and other contributors can edit and update the opportunity values. For example, give edit access to sales reps and managers by selecting Visible for Custom:Sales Profile and Contract Manager.
  13. Click Next.
  14. Select the page layouts that should include the new field, such as any page layouts assigned to the profiles of your sales organization.
  15. Click Save.
Note

It would be a good idea to hide the standard Main Competitor(s) text field from your users page layouts at this point as well to avoid confusion.  See this Salesforce Help article for details on how to edit page layouts.

Create a Lost Reason Field Custom Field

  1. Repeat steps 1–5 above to create a second new picklist field on the Opportunity object, then add the following details.
  2. For Field, enter Lost Reason.
  3. Select Enter Values with each value separated by a new line.
  4. In the text box, on separate lines list the key reasons that deals might have been lost, such as Price, No Decision, Product Gap, Financial.
  5. Make sure Restrict picklist to the values defined in the value set is selected.
  6. In Help Text, offer your users a useful tip about this new field: Select the primary reason this opportunity was lost. This field is only required when closing an opportunity as Closed Lost.
  7. Click Next.
  8. Set the field-level security.
  9. Click Next.
  10. Select the page layouts that should include the new field.
  11. Click Save.

Create a Competitor Validation Rule

Now that you’ve got the two new fields, you can create validation rules to ensure your sales users populate them at the right time in the sales cycle. 

Note

If you’re following along in your org, consult with your users to determine the appropriate stage in your sales cycle to trigger the validation rule. 

Here, we give you steps to enforce this rule only when the opportunity reaches any of these stages in the sales cycle: Proposal / Price Quote, Negotiation / Review, Closed Won, and Closed Lost.

 

  1. Click Setup Gear Icon and select Setup.
  2. Click Object Manager.
  3. Click Opportunity, then click Validation Rules.
  4. At the top of the Validation Rules page, click New.
  5. For the Rule Name, enter Competitor Required. Salesforce automatically inserts “_” between the words.
  6. Make sure that Active is checked.
  7. Copy and paste the following formula into the Error Condition Formula text box.
(ISPICKVAL( StageName , "Proposal/Price Quote") ||
ISPICKVAL( StageName , "Negotiation/Review") ||
ISPICKVAL( StageName , "Closed Won") ||
ISPICKVAL( StageName , "Closed Lost"))
&&
ISBLANK( TEXT(Competitor__c ))
  1. For Error Message, enter Competitor field requires a value before advancing to this Opportunity stage.
  2. For Error Location, select Field, and then choose Competitor from the picklist.
  3. Click Save.

Create a Closed Lost Validation Rule

Next, build out the second validation rule with slightly different requirements. When sales loses an opportunity, it’s important to understand why. Here’s how to create a rule that ensures users populate the new Lost Reason field whenever they change the stage to Closed Lost. 

  1. Click Setup Gear Icon and select Setup.
  2. Click Object Manager.
  3. Click Opportunity, then click Validation Rules.
  4. At the top of the Validation Rules page, click New.
  5. For Rule Name, enter Lost Reason. The system automatically inserts “_” between the words.
  6. Make sure that Active is checked.
  7. For Error Condition Formula, to check for any Closed Lost stage names, paste the following text into the text area.
AND(ISBLANK(TEXT(Lost_Reason__c)), ISPICKVAL( StageName , "Closed Lost"))
  1. For Error Message, enter Lost Reason field requires a value when the stage is Closed Lost.
  2. For Error Location, select Field, and then choose Lost Reason from the picklist.
  3. Click Save.

Test It Out

This is a good place to stop and test your changes. Try walking through the experience as if you're a sales rep. For example, create a new opportunity. Do you see the new Competitor and Lost Reason fields on the page? Enter the Proposal / Price Quote stage. Does that trigger the Competitor field? How about Negotiation / Review, Closed Won, and Closed Lost? And, when you change the stage to Closed Lost, is the Lost Reason field required? When you're satisfied with the behavior of the rules you’ve set up, you’re ready to build some reports. We do that next.

Resources

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities