Skip to main content
2 answers
  1. Jul 24, 2019, 11:31 AM
    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

     
0/9000