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!
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 September 2026 (Sep 16–30)Sponsored by FLXBL
Contest runs September 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.