This question runs in a pre-configured Salesforce environment - no personal connection required.
Return the total Amount of all open opportunities, where an opportunity is open when IsClosed is false. Use a SOQL aggregate SUM query. Return 0 if the sum is null.
Example 1:
Input: (query all open opportunities)
Output: 4250000.00
Explanation: The sum of Amount across all opportunities where IsClosed is false is returned as a Decimal.
Example 2:
Input: (only closed opportunities exist)
Output: 0
Explanation: When no open opportunities have amounts, the aggregate SUM returns null and the method returns 0.
Example 3:
Input: (some open, some closed)
Output: 1800000.00
Explanation: Only opportunities where IsClosed is false contribute to the sum. Closed opportunities are excluded.
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
🏆 All Time Leaderboard
Contest runs January 1, 1970 - December 31, 9999. Complete challenges to climb the leaderboard!
Points are calculated for challenges completed during the contest period.