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
ScottB3ScottB3 

Find all objects that are tracked

I have used the call Schema.getGlobalDescribe().Values(); to find all of the objects in the system.

Is it possible to find all objects that have feed tracking enabled on them?  I'm basically trying to find all objects which can be followed.
Best Answer chosen by ScottB3
Raj VakatiRaj Vakati
You have isFeedEnabled enabled method on the  DescribeSObjectResult  and use it 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject_describe.htm


Sample code
 
Set<String> sobjectWithFeed= new Set<String>() ;
for ( Schema.SObjectType o : Schema.getGlobalDescribe().values() )
{
    Schema.DescribeSObjectResult objResult = o.getDescribe();
	if(objResult.isFeedEnabled()){
	sobjectWithFeed.add(objResult.getName());
	}
   
}

 system.debug( 'sobjectWithFeed: ' + sobjectWithFeed );