Activity Forums Salesforce® Discussions What is an sObject type in Salesforce Apex?

  • shariq

    Member
    September 22, 2018 at 10:57 am

    An sObject is any object that can be stored in the Force.com platform database. Apex allows the use of generic sObject abstract type to represent any object.

    For example, Vehicle is a 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

  • Parul

    Member
    September 22, 2018 at 12:54 pm

    An sObject variable represents a row of data and can only be declared in Apex using the SOAP API name of the object.
    For example:

    Account a = new Account();
    MyCustomObject__c co = new MyCustomObject__c();

    Apex allows the use of the generic sObject abstract type to represent any object. The sObject data type can be used in code that processes different types of sObjects.

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

    For example: sObject s = new Account();

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos