function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shanth Shenoy 3Shanth Shenoy 3 

Return Type of a Method

If I do not know what is the Object type I am handling in a method, what should be the return type of that method, Thank You 
Best Answer chosen by Shanth Shenoy 3
Kancharla ChakravarthyKancharla Chakravarthy
Shanth

Please use below code

//SObject accepts all types of salesforce objects. You can use SObject type when you process multiple object types 
public static SObject processAnyObject(SObject anyObject){
        
        return anyObject;
        
}

 

All Answers

Kancharla ChakravarthyKancharla Chakravarthy
Shanth

Please use below code

//SObject accepts all types of salesforce objects. You can use SObject type when you process multiple object types 
public static SObject processAnyObject(SObject anyObject){
        
        return anyObject;
        
}

 
This was selected as the best answer
Shanth Shenoy 3Shanth Shenoy 3
Thank you Kancharala, appreciate your response