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
BARJRDBARJRD 

Global search for string in Apex code, triggers, etc.

Is there a way to perform a "global search" through all Apex code --- classes, triggers, etc.?  For example, if I want to search for a specific block of code but don't remember what class it's in...

Best Answer chosen by Admin (Salesforce Developers) 
imuino2imuino2

You can on Eclipse IDE.

You just need to load all the metadata you want to search in, pages, classes, triggers, and so.

Then press control+h there you'll find a dialog box where you can enter some code and it will search it in all your code.

All Answers

imuino2imuino2

You can on Eclipse IDE.

You just need to load all the metadata you want to search in, pages, classes, triggers, and so.

Then press control+h there you'll find a dialog box where you can enter some code and it will search it in all your code.

This was selected as the best answer
BARJRDBARJRD

Sweet!  Thanks!

Praveen Kumar R 6Praveen Kumar R 6
is there any other way to search the part of text/code through out Salesforce environment?
Gabe Grimley 4Gabe Grimley 4
Within the Developer Console, Control + Shift + H allows you to search all files.
Mitesh JainMitesh Jain
If you are ok with adding a package then you can add an app which is available on App exchange.

Name: Metadata Search
Link: https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009wgF7EAI

They have an amazing feature which can help all customer for searching any metadata object (like classes, triggers, pages, roles, profiles etc) within the Salesforce Org.

Time Saving for developer like us also its very user friendly with the UI and can be easily setup.
Nina KrauwangmonNina Krauwangmon
I found this today and it works great! https://chrome.google.com/webstore/detail/salesforce-advanced-code/lnkgcmpjkkkeffambkllliefdpjdklmi
Raghvendra Singh 22Raghvendra Singh 22
Hi All,
I have 6 objects which have a common field(Business Unit field) but i have more objects in my org.. .i need to take backup only 6 object and its field. Now i need to take backup of all triggers, workflows,classes etc which are related to these objects and this field... i am trying to do in eclipse. Do you have any idea how to do it. 
Devin Jacob 5Devin Jacob 5

In case it's helpful, you can do the same thing in Visual Studio Code with the "Find in Files" function (Command Shift F on a Mac, probably CTL Shift F on PC). 

For anyone else who has moved away from Eclipse, this will achieve the same thing as described in the "best answer" above. This is useful when looking for deprecated code in your codebase, eg <Apex:Flash>. 

Kamran HanifKamran Hanif
@Gabe Grimley 4 Thankyou so much for suggestion. It works like a charm. You can search for anyhting in whole org. Thanks!!!