Find your content:

Search form

You are here

How can I get a complete list of fields for a standard object?

 
Share

I am new to Apex, but it is apparent to me that most (if not all) standard objects probably have an ID field. However, this field does not appear in the reference for the standard objects in the Soap API Developer's Guide. Instead, it reads:

To verify the complete list of fields for an object, you can use a describe call from the API, or inspect with an appropriate tool, for example, inspecting the WSDL or using a schema viewer.

If I want to find out for sure whether an object has an ID field, or what the field is named (is it ID, Identifier, id, etc), it sounds like I need to use a "describe call" or "an appropriate tool" or inspect the "WSDL" using a "schema viewer".

Now, I am an experienced software developer, but those solutions are so ambiguous I have no idea where to look next to figure out how to get an object's ID. Can anybody either refer me to more specific documentation, or explain how to find the complete field documentation via a "describe call", "appropriate tool", or "schema viewer"?


Attribution to: Cory Klein

Possible Suggestion/Solution #1

From within an org itself, you can view it either via the Object definition or Schema Builder. For standard objects, you'll see them under "Customize->Object Name" in the setup menu (or just type the object name into the quick filter). Or in Schema Builder, you can just filter down to the objects want.

From within Apex, you can use the system level Schema object to do describes. More info here

From the API, you can use the meta data API to get information about customizations, or you can see them via the Enterprise version of the WSDL.

The Id field is a special case in that it exists on all objects. Documentation about the Id field can be found here.


Attribution to: joshbirk

Possible Suggestion/Solution #2

Josh definitely has the answer for you; just thought I would throw in a few more options. The Object Reference for Salesforce and Force.com lists all fields for the standard objects, plus shows the data model, and the Salesforce Fields Reference goes a bit further into the field definitions for standard objects.

I think the field reference is the only place that actually mentions the Id field, probably because it is read only. Just burn it in as fact- every sObject, standard and custom, has an auto-generated Id field and it is the field used for all Master-Detail and Lookup relationships.

I use a couple appexchange tools in my orgs to help with "field wrangling": Shcema Surfer and EasyDescribe; both have been very helpful to me. Schema Surfer has a great GUI interface and EasyDescribe will export to Excel for you.


Attribution to: zjeh
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4410

My Block Status

My Block Content