+ Start a Discussion
MJRMJR 

deep meaning of sObject

What is sObject .....can anyone give deep meaning of it 

Satish_SFDCSatish_SFDC

sObject is a generic representation of any object in Salesforce. For eg: Account, Contact, MyCustomObject__c, Test__c etc are sObjects.

Infact we can consider sObject to be the abstract parent class of any object in salesforce. Account, Contact, MyCustomObject__c are the child objects the sObject.

 

Hence, we the following lines of code are true.

 

Account a = new Account();

sObject s = new Account();

sObject s1= new Contact();

 

Here a instance of account or contact can be stored in sObject as it is the parent.

 

Hope this helps.

 

Regards,

Satish Kumar

Advanz Knowledge SystemsAdvanz Knowledge Systems

Hi,

 

sObjects includes all the Standard and Custom objects in your organization.

you can instantiate sObject with any of your object in your org.

sObject sobj = new Account();

sObject sobj = new Custom__c();

souvik9086souvik9086

Hi,

 

The term sObject refers to any object that can be stored in the Force.com platform database.

 

The new operator still requires a concrete sObject type, so all instances are specific sObjects. For example:

sObject s = new Account();

You can also use casting between the generic sObject type and the specific sObject type. For example:

Account a = (Account)s;

Because sObjects work like objects, you can also have the following:

Object obj = s;
a = (Account)obj;

DML operations work on variables declared as the generic sObject data type as well as with regular sObjects.

 

For refernce

http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SObjects.htm

 

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks