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
sandersensandersen 

Invalid Type: EntitySubscription

When I put this line of code in a class, I get an invalid type error:

List<EntitySubscription> newSubscriptions = new List<EntitySubscription> ();

 

But when I have the same line in a Trigger, I don't get the error:
 

trigger chatterFollow on User (after insert) {

if( Trigger.isAfter && Trigger.isInsert ){

List<EntitySubscription> newSubscriptions = new List<EntitySubscription> ();

etc. 

 

Any ideas? 

 
Best Answer chosen by Admin (Salesforce Developers) 
cloudcodercloudcoder
Make sure that the class files version is v18 (If you are developing through the browser, click the version tab at the top of your class). If it is earlier, you will receive this error