# Sync Contact City When Account Billing City Changes

**Type:** Apex trigger · **Difficulty:** Medium · **Object:** Account · **Topics:** Account, Contact, After Update, Bulkification

Practice this problem interactively (write and run your Apex trigger against realistic data): https://www.forcechallenges.com/problems/sync-contact-city-when-account-billing-city-changes

## Problem

When an Account's Billing City changes, update the custom Mailing_City_Copy__c field on all related Contacts to match. Only update Contacts whose city is different. Use one query and one update for the batch.

## Constraints

Use bulk-safe logic. Do not run SOQL or DML inside loops.

---
Source: ForceChallenges · last updated 2026-10-13
