• 1Installation
  • 2Preliminary Knowledge
  • 3Create Triggers
  • 4Trigger Handler
  • 5Bulk Object
  • 6Find Specific Objects
  • 7Data Sharing
  • 8Catch All Events
  • 9Trigger Controller
  • 10Normal Trigger Event Handler
  • 11Trigger Context
  • 12Unit Test
  • 13Take Only Trigger Execution

Trap.apex

  • Docs
  • Tutorials
Getting started with Trap.apex

Trigger Controller

Trap instance actually is a controller for the trigger handlers created by it. The code below shows the relationship:

TriggerHandler handler = Trap.getInstance().find('Case');

Here the Trap controller creates the trigger handler for Case if it is not found, and returns it. Besides creating the trigger handlers, the trigger controller provides much more features.

Trap.getInstance()
    .setEnabled('Case', true) // enable the CaseTrigger
    .setMaxReEntry('Case', 3) // re-entered for 3 times at most
    .setUsingNewTransaction('Case', true); // new transaction in trigger
Done