+ Start a Discussion
knightknight 

expecting semicolon, found ':'

 

Any idea why would I get this message expecting semicolon, found ':' for the class below

 

 ;
 

Pinnacle-AaronPinnacle-Aaron

In the line below, there's a ":" after lst_opencase. Should be an "=".

 

 List<Id> lst_opencase : [SELECT c.OwnerId FROM Case c where c.RecordTypeId = '012300000001mEJAAY'and c.Status !='Closed' and c.Enhancement_Roadmap_Date__c < :dt];

 


SuperfellSuperfell

lst_opencase is a list of Case objects, and Case.ownerid is the schema information for the ownerId field on Case, so list_opencase.add(Case.ownerid) doesn't make any sense.

sforce2009sforce2009

Date dt = System.Date.today();
 List<Case> lst_opencase = [SELECT c.OwnerId FROM Case c where c.RecordTypeId = '012300000001mEJAAY' and c.Status ='Closed' and c.Enhancement_Roadmap_Date__c < :dt];

string[] arryOfIds = new string[lst_opencase.size()];

for(Integer I = 0; i < lst_opencase.size(); i++)

{    arryOfIds.add(lst_opencase[i].Id)}

Messaging.MassEmailMessage mEmail = new messaging.MassEmailMessage();
 mEmail.setTargetObjectIds(arrayOfIds);
 mEmail.setReplyTo('test@test.com');
 mEmail.setSaveAsActivity(false);
  mEmail.setTemplateId('00X300000017Ybx');
 Messaging.sendEmail(new Messaging.MassEmailMessage[] { mEmail });

knightknight

thanks sforce...the code will not work though since you can only send emails to leads,contacts or users..I was able to figure it out