+ 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