function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
philbophilbo 

Custom Fields on Std. Objects in Eclipse IDE Package Explorer

Hey,
 
In the force.com Eclipse IDE (v11.1.1.200801151537), the Package Explorer window includes custom object definitions (e.g. "src\unpackaged\objects\<customObj>.object").
 
Where in the Package Explorer, if anywhere, are custom FIELD definitions on standard objects displayed?
 
Putting it another way, if I want to include a custom field on a standard object as part of a force.com 'deploy' to another org via the IDE, is there any way to do so?
 
thanks!
 
-philbo
JonPJonP
Philbo,

To include custom fields on standard objects, you need to edit src/unpackaged/package.xml. To get ALL custom fields on a standard object, add an additional <members> tag the CustomObject section:


Code:
<types>
    <members>*</members>
    <members>Account</members>
    <name>CustomObject</name>
</types>

Alternatively, you can specify the custom fields to include, by name, by adding a CustomField section:

Code:
<types>
    <members>Contact.MyCustomField__c</members>
    <name>CustomField</name>
</types>

Note that in both cases, you will get a new .object file in the src/objects/ folder.


We're exploring ways to make this easier and more intuitive in a future release of the IDE.

Jon


philbophilbo
Works like a charm, thanks.  So for each of my standard objects that have custom fields, I gotta go in and add a separate
<types> block, right?
 
Also - this package.xml file is local, right?  When I save it, I wouldn't expect other developers pointing at the same org to pick up the changes (or would I)?
 
-philbo
JonPJonP
It's a little simpler than that--you just need to add new <members> entries to the appropriate <types> section.  Each metadata component type (e.g. "CustomObject" or "CustomField") will have one and only one <types> section in package.xml.

And yes, package.xml is a local file.  It's basically a filter that determines what metadata components are downloaded from the server.

You may encounter a known issue in the IDE  v11.1 where executing "Refresh from Server" at the level of the Force.com project (the topmost folder in Package Explorer) can overwrite your src/unpackaged/package.xml file--so you may want to make a copy.  This is fixed in the upcoming Spring '08 release of the IDE.

Also, you should be aware that including a Standard Object in package.xml causes field-level security settings to be included in profiles.  If you use the CustomField method, the profiles in your project will only include FLS for the fields you explicitly include.  If you use the CustomObject method, your profile metadata will include FLS for all fields on the standard object--both custom and standard fields.  Be careful what you deploy to a production environment, as you don't want to accidentally overwrite your FLS.  (This is why you have to explicitly include Standard Objects in package.xml today.)

Jon
philbophilbo
Hey,

Resurrecting this thread...quoting from an earlier post:

To get ALL custom fields on a standard object, add an additional <members> tag to the CustomObject section:


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

Inspecting this snippet - The first <members>*</members> line - is that shorthand for "all custom objects"?  Would that be valid syntax in the package.xml file?  (I suppose I could just go in and try it...)  And to reiterate what you said - if I want to also include ALL custom fields on a second standard object; e.g. Contact, then it suffices to simply add an additional line


    <members>Contact</members>

to that <types> block, right?

Thanks!

-philbo
Vivek V.ax312Vivek V.ax312
Resurrecting this thread again..

Is there a way to get all fields (including standard fields) for standard objects and/or all standard objects without explicitly mentioning each one of them.

<types>
    <members>*</members>
    <members>*</members>
    <name>CustomObject</name>
</types>
The above Dosent work.


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

The above works but doesn’t get standard fields

Regards

Vivek


JonPJonP
You cannot download standard field definitions in the Force.com IDE or via the metadata API, as these are fixed and uneditable.  If you include standard objects or standard fields in the package.xml file, your .profile files will include security settings for the applicable standard fields.