2

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"?

  • for the specific case of Id, every object has an Id field, and its always called Id. – superfell Nov 14 '12 at 20:36
  • Thank you, @superfell. Can you by chance also provide a reference to documentation explaining this, so I can refer back to it when I need to? Maybe that documentation also lists other good-to-know fields that every object has. – Cory Klein Nov 14 '12 at 20:45
  • 5
4

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.

| improve this answer | |
  • I went to Customize->Cases->Fields and there is no ID field, or anything like it, eg Identifier, id, Id, etc – Cory Klein Nov 14 '12 at 20:39
1

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.

| improve this answer | |
  • +1 for Schema Surfer, it's a great free app that gives you quick native access to a lot of data per object/field. – jkraybill Nov 19 '12 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.