Does upsert fire an Update or Insert trigger? Or both?

When I do an upsert DML which trigger code will handle it?

  1. Insert
  2. Update
  3. Both


Is there a pattern to solve potential duplicate executions if it is 3)?


For records that already exist, it will fire updates. For records that are new, it will fire inserts. As a result, an upsert can cause both insert and update triggers to fire if you have both new and existing records in your upsert, but they both won’t fire for the same record.

Source : Link , Question Author : Robert Sösemann , Answer Author : Daniel Hoechst

Leave a Comment