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
Mel LisauMel Lisau 

Can I assume that every SObject has a "name" field ?

Can I assume that every SObject will have a name field as the minimum ?
Best Answer chosen by Mel Lisau
Nisar799Nisar799

No, you can't assume that every Sobject will have a name field.

Some standard exception are Case, Contract (They have CaseNumber and ContactNumber instead of Name).
If you need a field that is available on all Sobject consider Id

All Answers

Nisar799Nisar799

No, you can't assume that every Sobject will have a name field.

Some standard exception are Case, Contract (They have CaseNumber and ContactNumber instead of Name).
If you need a field that is available on all Sobject consider Id

This was selected as the best answer
Rohit KumawatRohit Kumawat
Hi Mel Lisau,

No, You can not assume that every SObject will have Name field.

Because when we create any object  then while time of creation of object you will get two data type.
  1. One is Text that can be name field.
  2. Second is Auto Number. so that is genrated by System automatically. Example : Serial Number or Case Number or Roll Number 

So It's not mandatory that a SObject will have only Name field as minimum.
It can have Autonumber Field aslo.


I hope above infomation will be helpful.