This question runs in a pre-configured Salesforce environment - no personal connection required.
Given a list of Contact record IDs, set the Department field to "Inactive" for all of them using a single DML update operation. Query the contacts first using the provided IDs, set Department = "Inactive" on each, then perform a bulk update. If the list is empty, do nothing.
Examples:
Input: (no return value - modifies org data)
contactIds = [Id1, Id2, Id3]
Before: Contact Id1.Department = "Sales", Id2.Department = "Marketing", Id3.Department = null
After: Contact Id1.Department = "Inactive", Id2.Department = "Inactive", Id3.Department = "Inactive"
Explanation: All three contacts are updated in a single DML call
contactIds = []
Before/After: No change
Explanation: Empty list results in no DML operation
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
🏆 #CodeEveryDay June 2026
Contest runs June 1 - 30. Complete challenges to climb the leaderboard!
Only the 30 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.