get sobject type salesforce

While coding generic components we may need to know the type of records(object name) that are stored in a particular list.
Salesforce provides method to find out the type of data that is being stored in a list. We have to use List method getSObjectType() for this.
String objectName = string.valueof(accList.getSObjectType());

Note that this method Only works on sObject data.


  1. Nowadays, most of the businesses rely on cloud based CRM tool to power their business process. They want to access the business from anywhere and anytime. In such scenarios, salesforce CRM will ensure massive advantage to the business owners. Salesforce Training | Salesforce Training in Chennai