Apex Class working with both Trigger and Batch

Sometimes there is a need for a class to execute based on a record value (checkbox) or as part of a scheduled batch job. Not a new concept but you will get this error: Static method cannot be referenced from a non static context

So a quick fix is to just create a non-static method that calls the static method…crazy that this works but it does.

Again – nothing magical or new here but in case google was not giving you the results here is one solution.

 

Leave a Reply

Your email address will not be published. Required fields are marked *