Source: ApexTrigger
The ApexClass is the most beloved object for Salesforce Developers.
It identifies a specific Apex Class, so you can query for Classes runtime.
Note that, even if the describe states that the ApexTrigger is creatable and updatable, an exception is thrown if you try to insert/update via API a trigger: use the tooling API or metadata API instead.
Among the fields, you can query for the Body of the trigger, whether it is valid or not, size in byte without comments.
Here an example:
Select Id, Name, ApiVersion, Body, IsValid, LengthWithoutComments, TableEnumOrId, UsageAfterDelete, UsageAfterInsert From ApexTrigger ORDER BY Name
Leave a Reply