Custom Fields on Standard Objects in the Force.com IDE

Posted by Luigi Montanez
on Thursday, June 26

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.

Comments

Leave a response

  1. Jon PlaxNovember 10, 2008 @ 12:53 PM

    The Winter ‘09 release of the Force.com IDE adds the ability to graphically select what metadata components to download into your Force.com project, including standard objects. Essentially, it’s a GUI editor for package.xml.

    You can access this functionality in several places:

    1. In the New Force.com Project wizard, step two has an option for “Selected metadata components”. Click “Choose” to open the “Choose Metadata Components” dialog.

    2. In an existing Force.com Project, right-click on your project root and select Properties, in the dialog’s left nav go to Force.com > Project Contents, and click Add/Remove…

    3. From any Force.com project source folder, right-click and select Force.com > Add/Remove Metadata Components… to jump right to the Project Contents page from the previous path.

    Jon Plax salesforce.com Product Manager

  2. Karin LittleNovember 12, 2008 @ 03:23 PM

    vrhinv5jvfj6gjo0