A marketing company, aMark, utilizes Salesforce to manage their customer details. Recently, the business introduced a duplicate check logic and aims to extend it to other objects such as leads and opportunities.
The current implementation is tailored to accounts, and they wish to maintain a centralized class for all duplicate checks. To achieve this, the identification of the Sobject type is important.
Complete the provided apex code to find the SObject type for the given record id for both standard and custom objects.
Example:
duplicateCheckController.getSobjectType('0065h00000OP8pFAAT');
// Expected result: Sobject type - Opportunity
duplicateCheckController.getSobjectType('003QE000001kGAw');
// Expected result: Sobject type - Contact
Note : This exercise aims to introduce you to writing a simple apex method which can utilise the built in methods on apex id class.
Read the apex id class documentation and use the functions to find the sobjectType. Feel free to execute code to validate your implementation.