3

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?

1 Answer 1

4

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.

2
  • How can i change all the references at once not using Eclipse? Commented Nov 18, 2013 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
    Commented Nov 18, 2013 at 16:36

You must log in to answer this question.

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