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
AmayAmay 

How to write a generic trigger for all objects. Can it be made configurable somehow?

I have a TriggerHandler class, which is quite generic and my trigger template remains same for every object needed for my usecase. Please tell me How do i configure the trigger scripts somehow, so that based on the object name I pass, it creates a trigger for that object (Standard objects as well as custom ones), can this be achieveable through custom metadata or any other things?
AbhinavAbhinav (Salesforce Developers) 
Hi Amay,

It seems not possible.

Have you checked discussion on below link which expalin a  use case similar to yours ?

https://salesforce.stackexchange.com/questions/17527/generic-apex-trigger

https://salesforce.stackexchange.com/questions/138980/create-one-trigger-for-all-sobject-types

Thanks!