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