# Sync Opportunity Client Contact to Its Account

**Type:** Apex trigger · **Difficulty:** Hard · **Object:** Opportunity · **Topics:** Opportunity, Account, Cross Object Update, Trigger.oldMap, Bulkification

Practice this problem interactively (write and run your Apex trigger against realistic data): https://www.forcechallenges.com/problems/sync-opportunity-client-contact-to-account

## Problem

An Opportunity and its Account both have a Client_Contact__c field. When the Opportunity's client contact changes, copy the new contact to the related Account. Do not update Accounts when the Opportunity has no Account. Handle multiple Opportunities in one batch.

## Constraints

Write bulk-safe trigger logic. Never run SOQL or DML inside a loop.

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