Access Custom Fields on Standard Objects in Force.com IDE

September 17, 2008 Appirio

Kyle Freeman

I recently created a new Force.com Project in Eclipse, but was surprised to find that there was not an option to include Standard Objects in the project manifest. Upon first glance it appears that only Custom Objects can be included.

9-14-2008 2-35-21 PM

This force.com thread by JonP discusses a workaround summarized here.

First, it is worthwhile to note that you cannot include standard fields on standard objects. However, you can include CUSTOM fields on standard objects. From your existing project in Eclipse, open the package.xml file located at src->unpackaged->package.xml Locate the Custom Object section and add a new member for each standard object you would like included in your project.

This method will include all custom fields on the standard object in your project.
For example, I was able to use the following snippet to include all custom fields on the Account, Contact, and Case objects, as well as all fields from all custom objects. Simply add the code to the package.xml file and then refresh the project from the server.

*

Account

Case

Contact

CustomObject

Care should be taken when pushing to production, however as including a standard object will also cause field-level security settings to be pushed to profiles in the salesforce.com production environment. Should your production field-level security settings be out of sync with your sandbox, you could run into some issues.

Utilizing this method can prove invaluable if you are needing to migrate a large number of custom fields and do not want to recreate these manually in production.

Previous Article
Page breaks in Visualforce PDF templates
Page breaks in Visualforce PDF templates

Kyle Roche The Visualforce page component defines a renderAs attribute that supports certain content conver...

Next Article
Escaping Quotes in Merge Fields

Glenn Weinstein S-controls, button on-click Javascript, and Visualforce pages can contain merge fields, whi...