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 September 2026 (Sep 1–15)Sponsored by FLXBL

Contest runs September 1 - 15. Complete challenges to climb the leaderboard!

1st & 2nd: Salesforce certification exam voucher see all prizes

Only the 15 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In