Fields supported in sObject with dot notation

Fields supported in sObject with dot notation

An sObject variable represents a row of data and can only be declared in Apex using the SOAP API name of the object.

Only Id field is supported for sObject.

Example:

  1. sObject sObj = [ SELECT Id, Name FROM Account LIMIT 1 ];  
  2.   
  3. Id acctId = sObj.Id;//Supported  
  4.   
  5. String acctName = sObj.Name;//Not Supported and you cannot save the code  

If you want to perform operations on an sObject, it is recommended that you first convert it into a specific object.

Leave a Reply