Assuming I have two apex classes wherein Class1 handles the simultaneous insertion of parent Parent__c and child Child__c records, and wherein Class2 handles computations.

Meanwhile, let's also assume that I have two apex triggers:

Trigger1 for Parent__c object: (for every Parent__c record inserted, there will be Parent2__c record inserted)

Trigger2 for Child__c object: (for every Child__c records inserted, there will be Child2__c records inserted)

Is it possible to call Class2 apex class from these two triggers?

1 Answer 1


Of course, just like any OOP language, classes do not care where they are executed from. If your class 2 methods are static, in your triggers you would simply call


Keep in mind that each trigger.new will be different SObject types so your Class2 methods will need to be written with that in mind. Either being generic and take List< SObject > or have different methods for Parents and Child.

Without more detail I can't provide much more other then a yes, you can call it from two triggers.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .