Trying to implement the popular Financialforce enterprise design patterns library, and not clear on if it provides baked in capability to prevent a trigger recursion. I've looked through the core classes for clues, re-read the docs and no clues so far. Given I dont have control over how the unit of work is initiated i.e. could be a batch job, and I know I need to make an update to records AFTER they hit the database, how would I prevent the recursion ? Should I just add a static var as per 'old' approach

Any suggestions would be most appreciated.


I don't believe the fflib has anything built in to prevent multiple runs of the trigger. You would likely just have to handle it as a static var somewhere in the trigger pattern in the 'old' way.

You could just add the firstRun static boolean in the domain class and set it in the triggerHelper constructor. Then you can have control over what gets run twice as well.

| improve this answer | |
  • Cheers for that. Like the idea re firstRun ststic boolean so we shall consider this solved. – CloudHugger Aug 31 '16 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.