I need to change the API name of one of my fields to more clearly reflect its role in the system and I would like some way to automate the task as much as possible. There are, unfortunately, ~50 instances of it scattered around the visualforce and apex files. I could change it manually by commenting out the offending segments, changing the api name on the object and changing all the comments back but this is fraught with risk of missing one. There is also the option to ignore it but we have had issues with the name misleading people with what it is doing. Is there any such tool, plugin or otherwise to help with my task?


I would accomplish this with the Metadata Toolkit. Build a package to download all the Visualforce pages, classes, components, and triggers, and the object/fields in question. Change all the references at once and deploy the entire package as a change. All of the changes are applied as a single transaction, so as long as all the field references resolve, the code should deploy without any challenges. This will also help prevent missing any references to the field, since the deploy will fail otherwise. You can also try this in the Eclipse IDE, but make sure to disable automatic builds. I find this type of deployment to be trickier in the Eclipse IDE, but it is certainly possible to do with some care.

  • How can i change all the references at once not using Eclipse? – Sergej Utko Nov 18 '13 at 16:04
  • 2
    The ant toolkit downloads all the code/metadata at once. You can use any normal text editor, like notepad (I use Programmer's Notepad to find all references at once). You could also grep the code, write some sort of Perl script, etc. The exact tools you'll use are determined by your skill set. – sfdcfox Nov 18 '13 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.