Custom Fields on Standard Objects in the Force.com IDE

Browsing through the Force.com Discussion Boards while playing with the new version of the Force.com IDE (released June 19), the ever helpful JonP explained exactly how to generate a .object file on standard objects.

Fire up Eclipse, and in your Force.com project open up src/unpackaged/package.xml. Find the XML element with the name of “CustomObject” and add in some new subelements with the value of the standard object. It should look like this:

<types>
    <members>*</members>
    <name>CustomObject</name>
    <members>Contact</members>
    <members>Account</members>
</types>

Then, run the “Refresh from Server” functionality by right-clicking on src/objects and accessing the Force.com menu. Your standard objects should then appear.

Alternatively, if you’re paranoid about too many custom fields being editable (and quickly erasable) in the IDE, you can stick in an entirely new types element named CustomField that looks like this:

<types>
    <members>Opportunity.SomeCustomField__c</members>
    <name>CustomField</name>
</types>

Now, you’re able to use the power and speed of the IDE to create, edit, and deploy custom fields on your standard objects. It’s a great productivity win. A big thanks to JonP for explaining all this.

blog comments powered by Disqus