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

The sales team wants the current stage echoed into the Next Step field so it is visible on list views. For every open Opportunity (one where IsClosed is false), set NextStep to the text Stage: followed by that record's StageName, then save all of the changes with a single update statement and return how many records were updated.

Closed opportunities must not be touched. If there are no open opportunities, update nothing and return 0.

Examples:

Input: (no parameters - the method updates the org) Output: 34 Explanation: All 34 open opportunities were updated and the count is returned Input: an open opportunity with StageName = 'Prospecting' Output: its NextStep becomes 'Stage: Prospecting' Explanation: The literal text 'Stage: ' is prefixed to the stage name Input: a Closed Won opportunity Output: its NextStep is left exactly as it was Explanation: Only open opportunities are in scope
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 November 2026 (Nov 16–30)Sponsored by FLXBL

Contest runs November 16 - 30. 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.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In