searching salesforce metadata using the force.com ide

Searching Salesforce Metadata Using The Force.com IDE

“Where is this field being used?” I bet you’ve asked yourself that question quite a bit! While it’s easy enough to determine if a field is on the page layout, or visible to users, it is not as easy to identify workflows, reports or Apex code where the field is being used. And that’s a bad thing.

While it would be nice to have a declarative option built into Salesforce for this type of reporting, the Force.com IDE offers this reporting ability today. Yet, many Admins stray away from using it because it seems too complex. Well, I’m here to tell you that it’s not as difficult as you would imagine!

What is Eclipse & the Force.com IDE?

Eclipse is a developer tool used by all types of developers across the world (not just Salesforce). Think of Eclipse as a shell with some built-in functionality to execute actions, search and write code and the like. Depending on what platform you’re building in, an IDE is installed to provide additional, platform specific functions.

That’s where the Force.com IDE comes in. Once Eclipse is installed, we need to install the Salesforce developed Force.com IDE to do anything with Salesforce metadata.

Now, I’m no expert; this is a layman’s definition so if any developers reading this want to provide a better explanation, please do so!

Installing the Force.com IDE

First thing’s first – we need to install Eclipse. Click here to access the Eclipse software. The current version as of this writing is Eclipse Neon.

Get-Eclipse-Neon

Follow the onscreen prompts to install Eclipse on your computer.

Once Eclipse is installed, it’s time to install the Force.com IDE. Again, these instructions are pretty straightforward and can be found on the Salesforce Developers site.

Creating a Force.com Project

Now that the Force.com IDE is installed into Eclipse, it’s time to create a Force.com Project. The project will contain metadata elements that, in our example, we want to query. We’ll use the very easy wizard-like series of screens to create a project.

First, click the down arrow next to the New icon and then select Force.com Project.

New-Force.com-Project

Next, provide your Login Credentials to the Salesforce Org you want to query and click Next.

Login-Creds-2

Depending on the size of the org, it’s a good idea to break up the metadata elements into chunks to reduce processing time. In this case, I know that the database is very large so I want to limit the metadata components to just a few. Click Select metadata components: then click Choose…

Choose-Package-Contents

Next, select the metadata components that you want to query. Today, I’m interested in finding which reports, report types, email templates and workflow rules the field is used so I’ll select those metadata components. Remember, less is more here – especially for large databases!

Component-Types

Depending on how large your dataset of the components selected, you’ll get this screen. Don’t panic. It can take several minutes to pull everything together. Take this time to get a refill on coffee, or do some deep breathing!

IDE-Progress

Confirm the  metadata components and click Finish! You’ve successfully created a Force.com Project and you’re ready to start searching your metadata!

Metadata-Components

Searching The Metadata

Eclipse has now pulled all of the metadata down and is now searchable in the Force.com IDE. This is where the fun really begins!

After the Force.com Project is created, you’ll be redirected back to the Eclipse Workspace. This is where we’ll perform the analysis. In this example, my project name is called Opp Stage because I want to see where the Opportunity Stage field is being used in the metadata components I pulled down.

Project-Elements

Notice that I selected email, reports, triggers, and workflows so these are the components available to me to query against. I’m going to start my query by clicking on the src folder. This will query all of my metadata components and return results. However, if you have a large number of reports, it’s probably better to select the reports folder to perform the search.

In the toolbar, click Search then Search again to open the search tool.

Search-Metadata

For this specific search, we’re looking at a field which means we’ll want to use the field’s API name. In this case, the standard Stage field on the Opportunity record has an API name of StageName so that’s what we’ll enter into the search box. Keep in mind that custom fields will end in a double underscore c (i.e. Custom_Field__c).

In the File name patterns picklist, choose everything. We want to produce the broadest search possible. Once you’re ready, click Search.

Search-Term

Once the query generates, use the bottom panel of the Workspace to explore the results!

Search-ResultsHere we see that StageName can be found in several locations in my org – specifically in an email called Test Email, in a Report Type called Opportunities with Details and in a workflow rule. Double clicking on any of these results will provide additional detail as to how it’s used.

If the field is used as a report filter, you’ll be able to identify that here which will help you to identify which reports need to be updated.

So, what field are you itching to practice with?


Discover more from Admin Hero

Subscribe to get the latest posts sent to your email.

24 responses to “Searching Salesforce Metadata Using The Force.com IDE”

  1. Nice article Brent! I’m already somewhat (okay, not really) familiar with the Force.com IDE, but that’s an excellent way to use it! I had always thought of it as just a tool for migrating metadata, but I guess I’m wrong! That’s a great way to search for where fields are used, and look at one angle of what impact removing a custom field will make. I’ll make sure to keep this use case in mind the next time I need to perform a task like this.

    Thanks,

    Parker

    Like

    1. Glad you found it useful!

      Like

  2. Brent, this is soooo timely! I did get a JRE Missing error message when I installed Eclipse. Do I need to install BOTH the JRE and the JDK or just one of the other?

    Thanks!

    Like

    1. I think you do need Java to use Eclipse.

      Like

  3. Hi Brett a minor typo in the text

    “Patters” should be “patterns” in the file selection dialog

    Like

    1. Good catch, Stephen! I’ve updated the post.

      Like

  4. Brent,

    Having trouble installing the force.com plugin, it gives me the error:

    Unable to connect to repository https://developer.salesforce.com/media/force-ide/eclipse45/content.xml

    I believe I’ve configured my proxy settings correctly, any idea what could be causing this error? I’ve installed older versions of eclipse and the plugin before without this problem…

    Like

    1. Never mind, my IT guy helped me figure it out. Apparently I had to remove my proxy settings and go on our guest network in order to install the plugin, but then I had to add the proxy settings back in order to create the force.com project. I don’t understand proxy settings, but at least it’s working for me now.

      Like

      1. Cool! Glad you were able to get it working!

        Like

  5. This is so helpful! I have been looking for a way to search for a fields use in reports so this post is exactly what I needed! It also finally pushed me to explore the Force.com IDE! Thank you for writing this.

    Like

  6. Great article especially helpful for admins like me trying to clean up my other thanks for putting all this info together.

    Like

    1. Thanks for reading! Glad you found it useful!

      Like

  7. Good post on searching metadata via force.com IDE. I need to do exactly the project you described (figure out where Opportunity Stage is used) and your post was very helpful, especially the sections from “Creating a force.com Project” on down.

    However, I had great difficult downloading Eclipse and JRE until I accessed the following YouTube video:

    The video gives simple step-by-step instructions for getting JRE and Eclipse installed, in 7 minutes. I futzed around for 30 minutes trying to get it tow work before I found this video.

    Like

    1. Thanks for sharing that video Garrett! Very helpful.

      Like

  8. SO HELPFUL! This is exactly what I needed. I wish this was built into Salesforce so the process could be quicker but at least we have this for now. Thanks so much for posting!

    Like

    1. Awesome! Glad you found it useful Jeremy! Thanks for reading.

      Like

  9. Hi Brent,

    Thanks for this article, very helpful. Looks like the interface for eclipse has since been updated. There’s a few more tabs that come up in the search window i.e. “Remote Search”. My question is which tab is the best to use to query reports? Also what other settings should be considered; file name patter/folderl/scope etc. Thanks for your help

    Like

  10. Nice post! But I prefer to use JetForcer. I find it more convenient for Force.com development.

    Try out https://jetforcer.com/get-started

    Like

  11. Hi Brent,
    This is a great article, my problem is what happens if you search for a field called “Sale__c” but you also have another that is called “Is_Sale__c”? I have more than a 2000 results of usage but they are mixed between Sale__c and Is_Sale__c. How can I search only for Sale__c?
    Thanks for you help.

    Like

    1. I don’t recall what the setting or option is off the top of my head, but there is an option for an exact search which would limit your query to the provided text.

      Like

  12. What do you suggest now that Force.com IDE is not supported?

    Thank you for your help,
    Meg

    Like

    1. Hi Meg! Check out The Welkin Suite. They have a great product which is much more robust and offers some great Admin functionality.

      Like

  13. Alternatively, in 4 clicks and 45 seconds you could use the Elements.cloud app and it will build (and analyze) your Org. https://vimeo.com/286013776

    Like

Leave a reply to Ian Gotts Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Admin Hero

Subscribe now to keep reading and get access to the full archive.

Continue reading