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
NagaSudheerNagaSudheer 

what is ment by sobject in salesforce

Best Answer chosen by NagaSudheer
Ajay K DubediAjay K Dubedi
Hi Nagasudheer,
Because Apex is tightly integrated with the database, you can access Salesforce records and their fields directly from Apex. 
Every record in Salesforce is natively represented as a sObject in Apex.
Each Salesforce record is represented as a sObject before it is inserted into Salesforce. 
Likewise, when persisted records are retrieved from Salesforce, they’re stored in a sObject variable.
Standard and custom object records in Salesforce map to their sObject types in Apex. 
 
Creating sObject Variables
To create a sObject, you need to declare a variable and assign it to a sObject instance. The data type of the variable is the sObject type.
Example: Account acct = new Account(Name='Acme');


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
 

All Answers

Ajay K DubediAjay K Dubedi
Hi Nagasudheer,
Because Apex is tightly integrated with the database, you can access Salesforce records and their fields directly from Apex. 
Every record in Salesforce is natively represented as a sObject in Apex.
Each Salesforce record is represented as a sObject before it is inserted into Salesforce. 
Likewise, when persisted records are retrieved from Salesforce, they’re stored in a sObject variable.
Standard and custom object records in Salesforce map to their sObject types in Apex. 
 
Creating sObject Variables
To create a sObject, you need to declare a variable and assign it to a sObject instance. The data type of the variable is the sObject type.
Example: Account acct = new Account(Name='Acme');


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
 
This was selected as the best answer
Deepali KulshresthaDeepali Kulshrestha
Hi Nagasudheer,
Please follow the given below points and links with the help of these, you can solve your problem, it may be helpful to you.

1. Generic sObject means, it can be of any persisted SFDC objects type.
For ex: Vehicle is generic type and Car, Motor Bike all are concrete types of Vehicle.
In SFDC,sObject is generic and Account, Opportunity, CustomObject__c are its concrete type.
Generic sObject abstracts the actual representation of any object assigned to it. sObject is the name of the generic abstract type that can be used to represent any persisted object type

2. An sObject is any object that can be stored in the Force.com platform database. These are not objects in the sense of instances of Apex classes; rather, they are representations of data that has or will be persisted. sObject is a generic abstract type that corresponds to any persisted object type

sObject is a generic abstract type that corresponds to any persisted object type. The generic sObject can be cast into a specific sObject type, such as an account or the Invoice_Statement__c custom object.

This creates an invoice statement, which corresponds to the Invoice_Statement__c custom object, without setting any fields and assigns the new invoice statement to a sObject.

sObject s = new Invoice_Statement__c();

I suggest to visit this link, it will help you:
http://sfdcsrini.blogspot.com/2014/04/what-is-sobject-in-apex.html
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SObject_types.htm

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha