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!
Create an Account
Sign up to track your progress, earn points, and compete with others. Your solutions will be saved automatically.
Create accountHow It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • 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.