I would like to know how to get the source code of all triggers in Salesforce database?

Could you please give an example or send a query?

1 Answer 1


You can use ApexTrigger in the metadata API to retrieve all triggers (with code) in salesforce.

If you're just interested what triggers are created and don't need update them you can use ApexTrigger in the data API. The query would be: select name from ApexTrigger

  • You can query the body (source) of non-managed triggers as well.
    – sfdcfox
    Commented Nov 9, 2015 at 21:16
  • 1
    In addition there are many IDE's and tools you can use to download the metadata from your org. Force.com IDE (Eclipse Plugin), Mavensmate, and others. For example if you use Force.com IDE you can use Eclipse's Workspace Search capabilities to search for specific items in the code (variables, methods, etc). All those tools use the Metadata API under the hood. Commented Nov 10, 2015 at 22:57

You must log in to answer this question.

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