i have already done some codes check the codes below and tel me what's wrong in this
public PageReference send()
{
List<Contact> accounts=[SELECT Email,id FROM Contact WHERE AccountId ='001i000000g7erl'];
List<Id> emailid=new list<Id>();
for(Contact mail: accounts)
{
emailid.add(mail.Id);
}
List<Brand__c> notes = [SELECT Name__c,(SELECT CreatedBy.Name,Title,Body FROM Notes)FROM Brand__c Where Id='a0di0000003EkAU'];
List<String> note=new list<String>();
for(Brand__C no:notes)
{
note.add(no.Id);
note.add(no.Id);
}
//String[]address=new String[] {'note'};
Messaging.MassEmailMessage emails = new Messaging.MassEmailMessage();
emails.setTargetObjectIds(emailid);
emails.setTemplateId('00Xi0000000J9hx');
emails.SaveAsActivity=(false);
emails.setsubject('notes');
emails.setBody(notes.Body);
Messaging.sendEmail(new Messaging.MassEmailMessage[] {emails});
return null;
}
}
my custom object name is brand and i want o fetch the notes and attachment of tat object in this code i have fetch the contact email and i want to fetch the notes and attachment title and body if in this code im getting error like this
Initial term of field expression must be a concrete SObject: LIST at line 31 column 20 if any one know this pls help me in this