function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

More than 1 before Case triggers

ı have more than 1 before trigger for the same object. Can anyone knows a good template for that? Both of them works great in Sandbox but I receive null pointer error from the test code.


There's nothing inherently wrong with having two triggers on the same object.


The fact that it's throwing a null pointer exception probably has to do with the code.


If you post the code perhaps we could help. 


I agree with Spraetz, a null pointer error has nothing to do with the multiple triggers.  Check to see where your code is referencing an uninitialized object.  You should be getting a line number too in your exceptions which will point you directly to the line of code that is causing the issue.


On a side note, IMO it is a best practice to maintain a single Trigger per object when possible.  Take a look at this post.


+1 for kevino80's reply.  Having a single trigger allows you to control the order that code is executed.  If you have two triggers you don't know which one will fire first.