title: How to use System.TriggerOperation Enum
body: <p>There is a new feature provided by <code>Salesforce</code> that allows using <code>TriggerOperation</code> enum. I cannot find any example how to use this approach compared to traditional trigger. For example, how can I replace this code:</p>
  
  <pre class="lang-apex prettyprint-override"><code>trigger TriggerName on ObjectName (before delete, before insert, before update,
                                     after delete, after insert, after update) {
  
      if (Trigger.isBefore) {
         if (Trigger.isInsert) { // do something }
         if (Trigger.isUpdate { // do something }
      } else {
         if (Trigger.isInsert) { // do something }
         if (Trigger.isUpdate { // do something }
      }
  }
  </code></pre>
  
  <p>Thanks.</p>