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.


  1. sObject sObj = [ SELECT Id, Name FROM Account LIMIT 1 ];  
  3. Id acctId = sObj.Id;//Supported  
  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.

No comments:

Post a Comment