This question runs in a pre-configured Salesforce environment - no personal connection required.

Return the number of opportunities that are won (IsWon is true) and have a CloseDate within the current year. Use the THIS_YEAR SOQL date literal and a COUNT query.

Example 1:

Input: (query won opportunities closing in the current year) Output: 12 Explanation: There are 12 opportunities where IsWon is true and CloseDate falls within the current calendar year.

Example 2:

Input: (no won opportunities close in the current year) Output: 0 Explanation: Open or lost opportunities are excluded. Won opportunities from prior years are also excluded.

Example 3:

Input: (won opportunities exist but all in prior years) Output: 0 Explanation: Only the current calendar year counts. Won opportunities from other years are not included.
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.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In