-3

I need to delete custom fields of activities. To do this I need to get the details where the fields are used in any apex classes, vf pages, validation rules/formulas, etc.

With the help of Salesforce advanced Code searcher and the developer console I could find the usages for apex classes, vf pages, components and triggers.

But I also need to find a complete list for formulas, validations, etc.

1 Answer 1

3

Deleting fields in Salesforce is a pain, one which I believe is only surpassed by trying to rename a field (and maybe a few other things), and I'm not aware of any shortcuts to make it easier.

There are two methods that I've used to find every place where a particular field is used:

  • Using an IDE (Eclipse with Force.com IDE plugin, atom/sublime text with mavensmate), I can subscribe to every metadata type that can contain a field (customObject, which contains validation rules, workflow, visualforce pages, etc...). I can then do a global search for a specific field.
  • When the above isn't enough, simply trying to delete the field in the Salesforce web UI will give you a list of places where that field is referenced.

I don't prefer the second method, as the UI that Salesforce provides when there is a conflict that prevents a field deletion is, frankly, horrible (in Salesforce's classic UI at least. I don't know if it's any better in lightning because lightning is still too half-baked for my company).

It'll tell you that the field is referenced in an Apex class, or a workflow, but doesn't tell you the name of the class/workflow/etc... or the location of the reference. You simply get a link (which is better than nothing, but is the absolute least amount of help that Salesforce could give).

3
  • There is another way also, you can see a question I asked and answered here which uses Workbench to deploy destructive change sets. I can absolutely concur changing/deleting fields is a nightmare. But, I guess it's a nightmare for a reason.
    – Dan Jones
    Jan 17, 2017 at 16:21
  • Workbench can definitely help with the deployment (though my preferred tool is ANT because I can type faster than I can click, and workbench requires a package.xml anyway), but I don't think Workbench would be any help in finding all the locations where a given field is referenced (which I think is the focus of the question).
    – Derek F
    Jan 17, 2017 at 16:31
  • You'd probably get the same referencing error if you tried to destructively deploy referenced metadata. Admittedly I probably, in a more complex situation, used MavensMate with Sublime, as you mentioned, to find where everything is referenced, and just build a destructive set off the back of that. Far from clean or effective, but it does work.
    – Dan Jones
    Jan 17, 2017 at 16:36

You must log in to answer this question.

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