+ Start a Discussion
craigmhcraigmh 

Id Field, Describe Isn't Unique

I've found that when I do a describe on any SObject, the Unique property of the Id field is returned as False. Is this done by design? I was expecting this to be returned as True. I searched for any reason as to why this might be, but couldn't find anything. Does anyone have any input?

IspitaIspita

Hi craigmh,

With rare exceptions, all objects in the API have a field of type ID that is named Id and contains a unique identifier for each record in the object. It is analogous to a primary key in relational databases. When you create() a new record, the Web service generates an ID value for the record, ensuring that it is unique within your organization’s data. You cannot use the update() call on ID fields. Because the ID value stays constant over the lifetime of the record, you can refer to the record by its ID value in subsequent API calls. Also, the ID value contains a three-character code that identifies the object type, which client applications can retrieve via the describeSObjects() call.

Ideally it should have been the way you are pointing out , functionally they are unique perhaps the attribute is not set to true as far as design is coincerned.

Hope this helps.

craigmhcraigmh

Yeah, I get how it's used. I even have a list of the three letter prefixes posted by my desk. :)

 

I was just surprised at this value, however. I was just curious if this was fully intended for a specific reason.

IspitaIspita

:) .I too was surprised when I saw your post but on closer scrunity was surprised by the findings , perhaps its that way due to some architectural reason .... Just thinking aloud...