ForceChallenges
ProblemsDailyNotes
Sign in
Problem list
Sign in to submit

Require Competitor for Closed Lost Deals

MediumApex Triggeron Opportunity 25 ptsCreated Oct 13, 2026

When an Opportunity is changed to Closed Lost, require the custom Competitor__c field to be filled in. Other stages do not need a competitor. Add Competitor__c to the challenge schema.

Constraints

Keep the trigger bulk-safe. Do not run SOQL or DML inside loops.

OpportunityCustom FieldBefore Update
CodeApex
Loading editor…
Closed lost needs competitor

Seed data

Opportunity× 1 rows
Name: Lost DealCloseDate: 2027-01-01StageName: Prospecting

DML under test

updateOpportunityWHERE Name = 'Lost Deal'
SET
StageName: Closed Lost

Expected