+ 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