I’ve used the Force.com IDE which is built on the popular Eclipse platform here and there since it was first released. Mainly to build Apex triggers and VisualForce pages in my developer org in preparation for the Summer ’08 release. I also used it to copy some custom profiles between two orgs. But recently, someone mentioned to me that I could use Eclipse to add custom fields to both custom and standard objects. (I stress the latter because for all my Googling I came across only a single post on this.) Given how frequently I’m building out fields in Salesforce, I’m painfully aware of how the standard wizards (while great for general administrators) are much to slow for developers and consultants deploying multiple fields on multiple objects for multiple instances.
Using Eclipse makes field creation a cut and paste operation. It also allows you to work offline. Those two facts alone make it worthwhile, but you can also copy objects, profiles, VisualForce pages, Apex code, and more between orgs as simply as Ctrl-C…Ctrl-V.
Unfortunately, it took me a while to figure out how to do all this. Documentation is tremendous for the Salesforce app, but lacking for the IDE. So I decided to pay it forward once again and put together a video outlining the major steps for;
- Creating a Force.com Project in Eclipse
- Creating custom objects
- Adding standard objects to your project
- Adding fields to custom and standard objects
The key discovery was the format for fields in the Metadata API. The documentation only had a single example and the Eclipse help file had none. Simply put the fields are defined by XML tags as such;
The IDE is not yet as mature as say, Dreamweaver. So while you’ll get suggestions as to what tags are available as you start typing, it isn’t smart enough yet to just paste in all the parameters needed for the type of field being inserted. This means you have to know that Picklists require a <picklistValues> tag. Or that <externalId> only applies to certain field types.
To save time, download my cut and paste cheatsheet of the custom fields and parameters you can use to cut and paste new fields in Eclipse.