This question runs in a pre-configured Salesforce environment - no personal connection required.
Write a method that queries all open Opportunities and returns a Map of stage name to the total Amount for that stage. An open Opportunity is one where IsClosed equals false. Closed Won and Closed Lost stages must be excluded from the result. The returned Map must use the StageName as the key and the summed Amount as the value. If there are no open Opportunities, return an empty Map.
Examples:
Method signature:
public static Map<String, Decimal> pipelineAmountByStage()
Returns:
A Map keyed by StageName containing the SUM of Amount for that stage,
restricted to open Opportunities (IsClosed = false).
Sample output shape:
{
'Prospecting' => 250000,
'Qualification' => 480000,
'Negotiation/Review' => 1500000,
...
}
Apex Code Editor
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
🏆 #CodeEveryDay July 2026
Contest runs July 1 - 31. Complete challenges to climb the leaderboard!
Only the 31 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.