Skip To Content
Back to Blog

How to Use the Force.Com IDE to Find Fields References in Code and Config – for Admins and Developers

By Brock Elgart 03.10.16
Reading time: 3 minutes

When deleting, changing the API Name, or determining the purpose of a field, it can be necessary to find all the places that field is referenced. Most developers know how to find field references in code using their favorite IDE, but both developers and administrators benefit from being able to find field references in configuration such as validation rules and email templates as well.

Admins: Why Use the Force.com IDE

The Force.com IDE may not seem like a tool made for admins, but it can save a lot of time performing certain tasks that Admins regularly engage in. Perhaps there are a number of workflow rules and validation rules built around a particular checkbox field. In order to get an idea of what that checkbox field does, you could use the Force.com IDE to search for all the validation rules, worflow rules, etc. that reference that field and then look them up in Salesforce to get an idea of what the field is used for. It’s more or less impossible to find every place a field is referenced by pouring through your configuration in the setup menu.

Developers: Why Use the Force.com IDE

A lot of config can be downloaded to your favorite IDE by updating the package.xml file of your Salesforce project with the appropriate Metadata types; however, a number of Metadata types (like ValidationRule and EmailTemplate) do not allow you to use wildcards when including them in your package.xml. This means that you have to explicitly name every Validation Rule or Email Template that you wish to download, which is prohibitively time consuming. When you use the Force.com IDE you can automatically download all Metadata exposed to the Metadata API regardless of whether or not the individual Metadata types allow the use of wildcards in your package.xml.

Getting Started

  1. Install the com IDE.
    • You will need to install the appropriate version of Java and Eclipse first, as listed in the installation instructions linked above.
  2. Launch the Eclipse and select a directory to use as your workspace.
    • This will be a folder under which all Salesforce configuration and code will be saved
  3. Select File > New > Force.com project and enter.
    • A Project Name: the name of the folder that represents this Salesforce instance in your workspace folder.
    • Username/Password/Security Token: Must belong to a user with the System Administrator Profile or an equivalent Profile. The “Author Apex” checkbox must also be checked on that person’s User record.
    • Environment: this defaults to Sandbox. Change it to Production or Custom Domain depending on what type of Salesforce Org you’re using.
  4. After clicking Next click the radio box next to Selected metadata components and then click the Choose… button
    new force.com project
  5. Click Select All on the next page and then click OK
    • You may have to wait a few minutes for the IDE to load after you click Select All
  6. Click Finish and wait for your Project to load

Searching for Field References in Code and Config

  1. In the Package Explorer section on the left side of the page, click on [Name of your Project] > Src > [Any yellow folder under source] > [Any file under that folder]
    package explorer
  2. Click on the file which was opened in the center of your screen and type CTRL+H
  3. Enter the API Name of the field you want to search for in the Containing text section and select the Enclosing Projects radio box, then click Search
    Enclosing Projects
  4. When the search is done loading, look at the results at the bottom of the page and look them up in Salesforce
    Search complete

About the Author

Brock has been a Developer and Technical Architect at Silverline since June of 2013. He is a Force.com Certified Platform App Builder and Administrator; and keeps up to date with the latest Salesforce platform updates and development tools.

Ready to see real results? We can help.

Get in Touch

We don't support Internet Explorer

Please use Chrome, Safari, Firefox, or Edge to view this site.