{
  "id": "20260629_emailmessage_activityid_fromid_backfill",
  "created_at": "2026-06-29T00:00:00Z",
  "title": "Backfill EmailMessage.ActivityId / FromId so Activity-timeline email clicks resolve the EmailMessage (#3459 / #2341 / #2770)",
  "description": "Migrated EmailMessage rows were loaded before pack #2340 restored the ActivityId/FromId columns (loader column-intersect drop), so EmailMessage.ActivityId is NULL on every migrated row and the EmailMessage -> Task -> Contact activity chain is broken: an Activity-timeline email row falls back to the Task page (Email Messages (0)) instead of opening the EmailMessage. 001 backfills ActivityId/FromId from the source SFDC EmailMessage snapshot via scripts/salesforce_migration/generate_emailmessage_activity_link_sql_patch.py. Idempotent (fills only NULL targets) and fail-closed (updates only where the referenced Task / Contact / Lead / User exists on the target env). 099 verifies coverage and the #2770 canonical example. Pairs with the EmailMessage page layout (#3310 / #3460) shipped separately.",
  "sql_files": [
    "001_backfill_emailmessage_activityid_fromid.sql",
    "099_verify_emailmessage_activityid_fromid.sql"
  ]
}
