Activity Forums Salesforce® Discussions What is generic sObject means in Salesforce?

  • Marziya

    Member
    January 16, 2020 at 1:26 pm

    In SFDC, SObject is generic and Account, Opportunity, CustomObject__c are its concrete type. Generic sObject abstracts the actual representation of any objectassigned to it. sObject is the name of the generic abstract type that can be used to represent any persisted object type.

  • Arun

    Member
    January 16, 2020 at 1:30 pm

    sObject is a generic data type. Every record in Salesforce is natively represented as an sObject in Apex. Any object you store in salesforce organization can be sObject. In a simple language, It is a big object in which you can store any object.

     

  • Aditya

    Member
    January 20, 2020 at 2:07 pm

    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.

  • Kirandeep

    Member
    January 20, 2020 at 2:59 pm

    Hi ,

    Generic sObject means, it can be of any persisted SFDC objects type.
    For ex: Phone is generic type and Samsung,Nokia all are concrete types of Phone.

    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.

    For example :-

    List<SObject> GenericList = new List<SObject>();
    SObject acc = [Select Id, Name from Account limit 1];
    GenericList.add(acc);

    SObject con = [Select Id, Name from Contact limit 1];
    GenericList.add(con);

    system.debug(GenericList);

  • MOHIT

    Member
    January 20, 2020 at 7:58 pm

    Every record in Salesforce is natively represented as an sObject in Apex.

    Each Salesforce record is represented as an sObject before it is inserted into Salesforce. Likewise, when persisted records are retrieved from Salesforce, they’re stored in an sObject variable.

    Standard and custom object records in Salesforce map to their sObject types in Apex. Here are some common sObject type names in Apex used for standard objects.

    Account
    Contact
    Lead
    Opportunity
    If you’ve added custom objects in your organization, use the API names of the custom objects in Apex.

Log In to reply.

Popular Salesforce Blogs