This question runs in a pre-configured Salesforce environment - no personal connection required.
Query all Account records that have a non-null BillingCity but a null Site field. For each of these accounts, set the Site field to match the BillingCity value. Update all matching accounts in a single DML operation and return the number of accounts updated. Return 0 if no accounts need updating.
Examples:
Input: (no parameters - queries and updates org data)
Output: 5
Explanation: 5 accounts had a BillingCity but no Site, all were updated
Input: (all accounts already have Site populated)
Output: 0
Explanation: No accounts needed updating
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 October 2026 (Oct 16–31)Sponsored by FLXBL
Contest runs October 16 - 31. 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 16 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.