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
Aidel BruckAidel Bruck 

How to run a soql query once for many triggers

I have many record types for opportunities. I need to run a soql query to get all the record types. 
My opportunity triggers are coded seperately and I don't want to change the whole setup now. 
I am getting the govern limit error and I think its becuase the soql query for the record types is coded seperately in each trigger. 
Is there any way to run the query one time and somehow make it public for all the triggers?
Shamsi 110Shamsi 110
keep your all record types in Custom settings.
Aidel BruckAidel Bruck
what is custom settings
Aidel BruckAidel Bruck
I figured out what the custom settings is but I don't see how that can help me. 
I need to run a query to get the ids for the different record types. 
The data in the custom settings is hard coded.