This question runs in a pre-configured Salesforce environment - no personal connection required.
Write a method that returns the number of Opportunity records currently in a given stage. The method receives a stage name (for example 'Prospecting' or 'Closed Won') and should return the count of Opportunities whose StageName matches it exactly.
Examples:
Input: stageName = 'Prospecting'
Output: 4
Explanation: There are 4 Opportunities in the Prospecting stage
Input: stageName = 'Closed Won'
Output: 22
Explanation: 22 Opportunities have been won
Input: stageName = 'Closed Lost'
Output: 5
Explanation: 5 Opportunities are in the Closed Lost stage
Note: The exact counts depend on the org's data. Your solution should query the data directly rather than hardcoding numbers.
Welcome to Lightning Challenge!
How It Works
- • Write your solution in the code editor
- • This challenge runs without connecting your own org
- • Submit to check if your solution passes
- • Use hints if you get stuck
Contest Alert
Contest runs November 1 - 15. Complete challenges to climb the leaderboard!
Prizes 1 & 2: Salesforce certification exam voucher — won by random drawing, where every point is a ticket. see all prizes
Only the 15 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.